Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
server::ActiveObjectMgr Class Referencefinal

#include <activeobjectmgr.h>

+ Inheritance diagram for server::ActiveObjectMgr:
+ Collaboration diagram for server::ActiveObjectMgr:

Public Member Functions

 ~ActiveObjectMgr () override
 
void clearIf (const std::function< bool(ServerActiveObject *, u16)> &cb)
 
void step (float dtime, const std::function< void(ServerActiveObject *)> &f) override
 
bool registerObject (std::unique_ptr< ServerActiveObject > obj) override
 
void removeObject (u16 id) override
 
void invalidateActiveObjectObserverCaches ()
 
void updateObjectPos (u16 id, v3f pos)
 
void getObjectsInsideRadius (v3f pos, float radius, std::vector< ServerActiveObject * > &result, std::function< bool(ServerActiveObject *obj)> include_obj_cb)
 
void getObjectsInArea (const aabb3f &box, std::vector< ServerActiveObject * > &result, std::function< bool(ServerActiveObject *obj)> include_obj_cb)
 
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)
 
- Public Member Functions inherited from ActiveObjectMgr< ServerActiveObject >
 ActiveObjectMgr ()=default
 
 DISABLE_CLASS_COPY (ActiveObjectMgr)
 
void clear ()
 
ServerActiveObjectgetActiveObject (u16 id)
 

Private Attributes

k_d_tree::DynamicKdTrees< 3, f32, u16 > m_spatial_index
 

Additional Inherited Members

- Protected Member Functions inherited from ActiveObjectMgr< ServerActiveObject >
u16 getFreeId () const
 
bool isFreeId (u16 id) const
 
- Protected Attributes inherited from ActiveObjectMgr< ServerActiveObject >
ModifySafeMap< u16, std::unique_ptr< ServerActiveObject > > m_active_objects
 

Constructor & Destructor Documentation

◆ ~ActiveObjectMgr()

ActiveObjectMgr< T >::~ActiveObjectMgr ( )
overridevirtual

Reimplemented from ActiveObjectMgr< ServerActiveObject >.

References ActiveObjectMgr< ServerActiveObject >::clear(), ModifySafeMap< K, V >::empty(), ActiveObjectMgr< ServerActiveObject >::m_active_objects, and warningstream.

+ Here is the call graph for this function:

Member Function Documentation

◆ clearIf()

void ActiveObjectMgr< T >::clearIf ( const std::function< bool(ServerActiveObject *, u16)> & cb)

References ModifySafeMap< K, V >::iter(), ActiveObjectMgr< ServerActiveObject >::m_active_objects, and removeObject().

Referenced by ServerEnvironment::clearObjects(), ServerEnvironment::deactivateFarObjects(), and ServerEnvironment::removeRemovedObjects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAddedActiveObjectsAroundPos()

void ActiveObjectMgr< T >::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 )

References ACTIVEOBJECT_TYPE_PLAYER, ServerActiveObject::getBasePosition(), ActiveObject::getType(), ServerActiveObject::isEffectivelyObservedBy(), ServerActiveObject::isGone(), ModifySafeMap< K, V >::iter(), and ActiveObjectMgr< ServerActiveObject >::m_active_objects.

Referenced by ServerEnvironment::getAddedActiveObjects(), TestServerActiveObjectMgr::getAddedActiveObjectsAroundPos(), and TEST_CASE().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectsInArea()

void ActiveObjectMgr< T >::getObjectsInArea ( const aabb3f & box,
std::vector< ServerActiveObject * > & result,
std::function< bool(ServerActiveObject *obj)> include_obj_cb )

References _, m_spatial_index, and k_d_tree::DynamicKdTrees< Dim, Component, Id >::rangeQuery().

Referenced by benchGetObjectsInArea(), TestServerActiveObjectMgr::compareObjectsInArea(), and ServerEnvironment::getObjectsInArea().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectsInsideRadius()

void ActiveObjectMgr< T >::getObjectsInsideRadius ( v3f pos,
float radius,
std::vector< ServerActiveObject * > & result,
std::function< bool(ServerActiveObject *obj)> include_obj_cb )

References ModifySafeMap< K, V >::get(), ActiveObjectMgr< ServerActiveObject >::m_active_objects, m_spatial_index, and k_d_tree::DynamicKdTrees< Dim, Component, Id >::rangeQuery().

Referenced by benchGetObjectsInsideRadius(), TestServerActiveObjectMgr::compareObjectsInsideRadius(), ServerEnvironment::getObjectsInsideRadius(), TestServerActiveObjectMgr::getObjectsInsideRadius(), and TEST_CASE().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ invalidateActiveObjectObserverCaches()

void ActiveObjectMgr< T >::invalidateActiveObjectObserverCaches ( )

References ServerActiveObject::invalidateEffectiveObservers(), ModifySafeMap< K, V >::iter(), and ActiveObjectMgr< ServerActiveObject >::m_active_objects.

Referenced by ServerEnvironment::invalidateActiveObjectObserverCaches().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registerObject()

bool ActiveObjectMgr< T >::registerObject ( std::unique_ptr< ServerActiveObject > obj)
overridevirtual

Implements ActiveObjectMgr< ServerActiveObject >.

References errorstream, ActiveObjectMgr< ServerActiveObject >::getFreeId(), k_d_tree::DynamicKdTrees< Dim, Component, Id >::insert(), ActiveObjectMgr< ServerActiveObject >::isFreeId(), ActiveObjectMgr< ServerActiveObject >::m_active_objects, m_spatial_index, objectpos_over_limit(), ModifySafeMap< K, V >::put(), ModifySafeMap< K, V >::size(), verbosestream, and warningstream.

Referenced by ServerEnvironment::addActiveObjectRaw(), TestServerActiveObjectMgr::registerObject(), and TEST_CASE().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeObject()

void ActiveObjectMgr< T >::removeObject ( u16 id)
overridevirtual

Implements ActiveObjectMgr< ServerActiveObject >.

References infostream, ActiveObjectMgr< ServerActiveObject >::m_active_objects, m_spatial_index, k_d_tree::DynamicKdTrees< Dim, Component, Id >::remove(), ModifySafeMap< K, V >::remove(), and verbosestream.

Referenced by ServerEnvironment::addActiveObjectRaw(), clearIf(), and TestServerActiveObjectMgr::removeObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ step()

void ActiveObjectMgr< T >::step ( float dtime,
const std::function< void(ServerActiveObject *)> & f )
overridevirtual

Implements ActiveObjectMgr< ServerActiveObject >.

References Profiler::avg(), g_profiler, ModifySafeMap< K, V >::iter(), and ActiveObjectMgr< ServerActiveObject >::m_active_objects.

Referenced by ServerEnvironment::step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateObjectPos()

void ActiveObjectMgr< T >::updateObjectPos ( u16 id,
v3f pos )

References ModifySafeMap< K, V >::get(), ActiveObjectMgr< ServerActiveObject >::m_active_objects, m_spatial_index, and k_d_tree::DynamicKdTrees< Dim, Component, Id >::update().

Referenced by ServerEnvironment::updateObjectPos(), and TestServerActiveObjectMgr::updateObjectPos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_spatial_index

k_d_tree::DynamicKdTrees<3, f32, u16> server::ActiveObjectMgr::m_spatial_index
private

The documentation for this class was generated from the following files: