Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
activeobjectmgr.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2010-2018 nerzhul, Loic BLOT <loic.blot@unix-experience.fr>
4
5#pragma once
6
7#include <functional>
8#include <vector>
9#include <set>
10#include "../activeobjectmgr.h"
11#include "serveractiveobject.h"
12#include "util/k_d_tree.h"
13
14namespace server
15{
16class ActiveObjectMgr final : public ::ActiveObjectMgr<ServerActiveObject>
17{
18public:
19 ~ActiveObjectMgr() override;
20
21 // If cb returns true, the obj will be deleted
22 void clearIf(const std::function<bool(ServerActiveObject *, u16)> &cb);
23 void step(float dtime,
24 const std::function<void(ServerActiveObject *)> &f) override;
25 bool registerObject(std::unique_ptr<ServerActiveObject> obj) override;
26 void removeObject(u16 id) override;
27
29
30 void updateObjectPos(u16 id, v3f pos);
31
32 void getObjectsInsideRadius(v3f pos, float radius,
33 std::vector<ServerActiveObject *> &result,
34 std::function<bool(ServerActiveObject *obj)> include_obj_cb);
35 void getObjectsInArea(const aabb3f &box,
36 std::vector<ServerActiveObject *> &result,
37 std::function<bool(ServerActiveObject *obj)> include_obj_cb);
39 v3f player_pos, const std::string &player_name,
40 f32 radius, f32 player_radius,
41 const std::set<u16> &current_objects,
42 std::vector<u16> &added_objects);
43
44private:
46};
47} // namespace server
Definition activeobjectmgr.h:16
Definition serveractiveobject.h:41
Definition k_d_tree.h:391
Definition activeobjectmgr.h:17
~ActiveObjectMgr() override
Definition activeobjectmgr.cpp:13
void updateObjectPos(u16 id, v3f pos)
Definition activeobjectmgr.cpp:119
k_d_tree::DynamicKdTrees< 3, f32, u16 > m_spatial_index
Definition activeobjectmgr.h:45
void getObjectsInArea(const aabb3f &box, std::vector< ServerActiveObject * > &result, std::function< bool(ServerActiveObject *obj)> include_obj_cb)
Definition activeobjectmgr.cpp:145
void step(float dtime, const std::function< void(ServerActiveObject *)> &f) override
Definition activeobjectmgr.cpp:34
void getAddedActiveObjectsAroundPos(v3f player_pos, const std::string &player_name, f32 radius, f32 player_radius, const std::set< u16 > &current_objects, std::vector< u16 > &added_objects)
Definition activeobjectmgr.cpp:158
void invalidateActiveObjectObserverCaches()
Definition activeobjectmgr.cpp:109
void removeObject(u16 id) override
Definition activeobjectmgr.cpp:94
void getObjectsInsideRadius(v3f pos, float radius, std::vector< ServerActiveObject * > &result, std::function< bool(ServerActiveObject *obj)> include_obj_cb)
Definition activeobjectmgr.cpp:128
void clearIf(const std::function< bool(ServerActiveObject *, u16)> &cb)
Definition activeobjectmgr.cpp:22
bool registerObject(std::unique_ptr< ServerActiveObject > obj) override
Definition activeobjectmgr.cpp:49
core::aabbox3d< f32 > aabb3f
Definition irr_aabb3d.h:11
core::vector3df v3f
Definition irr_v3d.h:11
Definition activeobjectmgr.cpp:11