Minetest  5.4.0
ServerActiveObject Class Reference

#include <serveractiveobject.h>

+ Inheritance diagram for ServerActiveObject:
+ Collaboration diagram for ServerActiveObject:

Public Member Functions

 ServerActiveObject (ServerEnvironment *env, v3f pos)
 
virtual ~ServerActiveObject ()=default
 
virtual ActiveObjectType getSendType () const
 
virtual void addedToEnvironment (u32 dtime_s)
 
virtual void removingFromEnvironment ()
 
virtual bool environmentDeletes () const
 
void markForRemoval ()
 
void markForDeactivation ()
 
v3f getBasePosition () const
 
void setBasePosition (v3f pos)
 
ServerEnvironmentgetEnv ()
 
virtual void setPos (const v3f &pos)
 
virtual void moveTo (v3f pos, bool continuous)
 
virtual float getMinimumSavedMovement ()
 
virtual std::string getDescription ()
 
virtual void step (float dtime, bool send_recommended)
 
virtual std::string getClientInitializationData (u16 protocol_version)
 
virtual void getStaticData (std::string *result) const
 
virtual bool isStaticAllowed () const
 
virtual bool shouldUnload () const
 
virtual u16 punch (v3f dir, const ToolCapabilities *toolcap=nullptr, ServerActiveObject *puncher=nullptr, float time_from_last_punch=1000000.0f)
 
virtual void rightClick (ServerActiveObject *clicker)
 
virtual void setHP (s32 hp, const PlayerHPChangeReason &reason)
 
virtual u16 getHP () const
 
virtual void setArmorGroups (const ItemGroupList &armor_groups)
 
virtual const ItemGroupListgetArmorGroups () const
 
virtual void setAnimation (v2f frames, float frame_speed, float frame_blend, bool frame_loop)
 
virtual void getAnimation (v2f *frames, float *frame_speed, float *frame_blend, bool *frame_loop)
 
virtual void setAnimationSpeed (float frame_speed)
 
virtual void setBonePosition (const std::string &bone, v3f position, v3f rotation)
 
virtual void getBonePosition (const std::string &bone, v3f *position, v3f *lotation)
 
virtual const std::unordered_set< int > & getAttachmentChildIds () const
 
virtual ServerActiveObjectgetParent () const
 
virtual ObjectPropertiesaccessObjectProperties ()
 
virtual void notifyObjectPropertiesModified ()
 
virtual InventorygetInventory () const
 
virtual InventoryLocation getInventoryLocation () const
 
virtual void setInventoryModified ()
 
virtual std::string getWieldList () const
 
virtual u16 getWieldIndex () const
 
virtual ItemStack getWieldedItem (ItemStack *selected, ItemStack *hand=nullptr) const
 
virtual bool setWieldedItem (const ItemStack &item)
 
void attachParticleSpawner (u32 id)
 
void detachParticleSpawner (u32 id)
 
std::string generateUpdateInfantCommand (u16 infant_id, u16 protocol_version)
 
void dumpAOMessagesToQueue (std::queue< ActiveObjectMessage > &queue)
 
bool isGone () const
 
bool isPendingRemoval () const
 
- Public Member Functions inherited from ActiveObject
 ActiveObject (u16 id)
 
u16 getId () const
 
void setId (u16 id)
 
virtual ActiveObjectType getType () const =0
 
virtual bool getCollisionBox (aabb3f *toset) const =0
 
virtual bool getSelectionBox (aabb3f *toset) const =0
 
virtual bool collideWithObjects () const =0
 
virtual void setAttachment (int parent_id, const std::string &bone, v3f position, v3f rotation, bool force_visible)
 
virtual void getAttachment (int *parent_id, std::string *bone, v3f *position, v3f *rotation, bool *force_visible) const
 
virtual void clearChildAttachments ()
 
virtual void clearParentAttachment ()
 
virtual void addAttachmentChild (int child_id)
 
virtual void removeAttachmentChild (int child_id)
 

Static Public Member Functions

static ServerActiveObjectcreate (ActiveObjectType type, ServerEnvironment *env, u16 id, v3f pos, const std::string &data)
 

Public Attributes

u16 m_known_by_count = 0
 
bool m_static_exists = false
 
v3s16 m_static_block = v3s16(1337,1337,1337)
 

Protected Member Functions

virtual void onMarkedForDeactivation ()
 
virtual void onMarkedForRemoval ()
 
virtual void onAttach (int parent_id)
 
virtual void onDetach (int parent_id)
 

Protected Attributes

ServerEnvironmentm_env
 
v3f m_base_position
 
std::unordered_set< u32 > m_attached_particle_spawners
 
bool m_pending_deactivation = false
 
bool m_pending_removal = false
 
std::queue< ActiveObjectMessagem_messages_out
 
- Protected Attributes inherited from ActiveObject
u16 m_id
 

Constructor & Destructor Documentation

◆ ServerActiveObject()

ServerActiveObject::ServerActiveObject ( ServerEnvironment env,
v3f  pos 
)

◆ ~ServerActiveObject()

virtual ServerActiveObject::~ServerActiveObject ( )
virtualdefault

Member Function Documentation

◆ accessObjectProperties()

virtual ObjectProperties* ServerActiveObject::accessObjectProperties ( )
inlinevirtual

Reimplemented in UnitSAO.

Referenced by ObjectRef::l_get_nametag_attributes(), ObjectRef::l_get_properties(), ObjectRef::l_set_nametag_attributes(), and ObjectRef::l_set_properties().

+ Here is the caller graph for this function:

◆ addedToEnvironment()

virtual void ServerActiveObject::addedToEnvironment ( u32  dtime_s)
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

Referenced by LuaEntitySAO::addedToEnvironment(), and PlayerSAO::addedToEnvironment().

+ Here is the caller graph for this function:

◆ attachParticleSpawner()

void ServerActiveObject::attachParticleSpawner ( u32  id)
inline

◆ create()

static ServerActiveObject* ServerActiveObject::create ( ActiveObjectType  type,
ServerEnvironment env,
u16  id,
v3f  pos,
const std::string &  data 
)
static

◆ detachParticleSpawner()

void ServerActiveObject::detachParticleSpawner ( u32  id)
inline

References m_attached_particle_spawners.

Referenced by ServerEnvironment::deleteParticleSpawner().

+ Here is the caller graph for this function:

◆ dumpAOMessagesToQueue()

void ServerActiveObject::dumpAOMessagesToQueue ( std::queue< ActiveObjectMessage > &  queue)

References m_messages_out.

◆ environmentDeletes()

virtual bool ServerActiveObject::environmentDeletes ( ) const
inlinevirtual

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

+ Here is the caller graph for this function:

◆ generateUpdateInfantCommand()

std::string ServerActiveObject::generateUpdateInfantCommand ( u16  infant_id,
u16  protocol_version 
)

References AO_CMD_SPAWN_INFANT, getClientInitializationData(), getSendType(), serializeString32(), writeU16(), and writeU8().

+ Here is the call graph for this function:

◆ getAnimation()

virtual void ServerActiveObject::getAnimation ( v2f frames,
float *  frame_speed,
float *  frame_blend,
bool *  frame_loop 
)
inlinevirtual

Reimplemented in UnitSAO.

Referenced by ObjectRef::l_get_animation().

+ Here is the caller graph for this function:

◆ getArmorGroups()

virtual const ItemGroupList& ServerActiveObject::getArmorGroups ( ) const
inlinevirtual

Reimplemented in UnitSAO.

Referenced by ObjectRef::l_get_armor_groups().

+ Here is the caller graph for this function:

◆ getAttachmentChildIds()

virtual const std::unordered_set<int>& ServerActiveObject::getAttachmentChildIds ( ) const
inlinevirtual

Reimplemented in UnitSAO.

Referenced by ObjectRef::l_get_children().

+ Here is the caller graph for this function:

◆ getBasePosition()

◆ getBonePosition()

virtual void ServerActiveObject::getBonePosition ( const std::string &  bone,
v3f position,
v3f lotation 
)
inlinevirtual

Reimplemented in UnitSAO.

Referenced by ObjectRef::l_get_bone_position().

+ Here is the caller graph for this function:

◆ getClientInitializationData()

virtual std::string ServerActiveObject::getClientInitializationData ( u16  protocol_version)
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

Referenced by generateUpdateInfantCommand(), and Server::SendActiveObjectRemoveAdd().

+ Here is the caller graph for this function:

◆ getDescription()

virtual std::string ServerActiveObject::getDescription ( )
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

Referenced by ICraftAction::apply(), Server::handleCommand_Interact(), PlayerSAO::punch(), and LuaEntitySAO::punch().

+ Here is the caller graph for this function:

◆ getEnv()

ServerEnvironment* ServerActiveObject::getEnv ( )
inline

References m_env.

Referenced by read_object_properties().

+ Here is the caller graph for this function:

◆ getHP()

virtual u16 ServerActiveObject::getHP ( ) const
inlinevirtual

Reimplemented in UnitSAO, and LuaEntitySAO.

Referenced by Server::handleCommand_Interact(), ObjectRef::l_get_hp(), ObjectRef::l_punch(), PlayerSAO::punch(), LuaEntitySAO::punch(), and read_object_properties().

+ Here is the caller graph for this function:

◆ getInventory()

virtual Inventory* ServerActiveObject::getInventory ( ) const
inlinevirtual

Reimplemented in PlayerSAO.

◆ getInventoryLocation()

virtual InventoryLocation ServerActiveObject::getInventoryLocation ( ) const
inlinevirtual

Reimplemented in PlayerSAO.

Referenced by ObjectRef::l_get_inventory().

+ Here is the caller graph for this function:

◆ getMinimumSavedMovement()

float ServerActiveObject::getMinimumSavedMovement ( )
virtual

Reimplemented in LuaEntitySAO.

References BS.

Referenced by ServerEnvironment::deactivateFarObjects().

+ Here is the caller graph for this function:

◆ getParent()

virtual ServerActiveObject* ServerActiveObject::getParent ( ) const
inlinevirtual

Reimplemented in UnitSAO.

Referenced by Server::AsyncRunStep().

+ Here is the caller graph for this function:

◆ getSendType()

virtual ActiveObjectType ServerActiveObject::getSendType ( ) const
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

References ActiveObject::getType().

Referenced by generateUpdateInfantCommand(), and Server::SendActiveObjectRemoveAdd().

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

◆ getStaticData()

virtual void ServerActiveObject::getStaticData ( std::string *  result) const
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

References isStaticAllowed().

Referenced by StaticObject::StaticObject().

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

◆ getWieldedItem()

ItemStack ServerActiveObject::getWieldedItem ( ItemStack selected,
ItemStack hand = nullptr 
) const
virtual

Reimplemented in PlayerSAO.

Referenced by ObjectRef::l_get_wielded_item(), and LuaEntitySAO::punch().

+ Here is the caller graph for this function:

◆ getWieldIndex()

virtual u16 ServerActiveObject::getWieldIndex ( ) const
inlinevirtual

Reimplemented in PlayerSAO.

Referenced by ObjectRef::l_get_wield_index().

+ Here is the caller graph for this function:

◆ getWieldList()

virtual std::string ServerActiveObject::getWieldList ( ) const
inlinevirtual

Reimplemented in PlayerSAO.

Referenced by ObjectRef::l_get_wield_list().

+ Here is the caller graph for this function:

◆ isGone()

◆ isPendingRemoval()

bool ServerActiveObject::isPendingRemoval ( ) const
inline

References m_pending_removal.

Referenced by ServerEnvironment::removeRemovedObjects().

+ Here is the caller graph for this function:

◆ isStaticAllowed()

virtual bool ServerActiveObject::isStaticAllowed ( ) const
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

Referenced by ServerEnvironment::addActiveObjectRaw(), ServerEnvironment::deactivateFarObjects(), and getStaticData().

+ Here is the caller graph for this function:

◆ markForDeactivation()

void ServerActiveObject::markForDeactivation ( )

References m_pending_deactivation, and onMarkedForDeactivation().

Referenced by ServerEnvironment::deactivateFarObjects().

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

◆ markForRemoval()

void ServerActiveObject::markForRemoval ( )

References m_pending_removal, and onMarkedForRemoval().

Referenced by ServerEnvironment::clearObjects(), PlayerSAO::disconnected(), ObjectRef::l_remove(), and LuaEntitySAO::punch().

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

◆ moveTo()

virtual void ServerActiveObject::moveTo ( v3f  pos,
bool  continuous 
)
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

References setBasePosition().

Referenced by ObjectRef::l_move_to().

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

◆ notifyObjectPropertiesModified()

virtual void ServerActiveObject::notifyObjectPropertiesModified ( )
inlinevirtual

Reimplemented in UnitSAO.

Referenced by ObjectRef::l_set_nametag_attributes(), and ObjectRef::l_set_properties().

+ Here is the caller graph for this function:

◆ onAttach()

virtual void ServerActiveObject::onAttach ( int  parent_id)
inlineprotectedvirtual

Reimplemented in UnitSAO.

◆ onDetach()

virtual void ServerActiveObject::onDetach ( int  parent_id)
inlineprotectedvirtual

Reimplemented in UnitSAO.

◆ onMarkedForDeactivation()

virtual void ServerActiveObject::onMarkedForDeactivation ( )
inlineprotectedvirtual

Reimplemented in LuaEntitySAO.

Referenced by markForDeactivation().

+ Here is the caller graph for this function:

◆ onMarkedForRemoval()

virtual void ServerActiveObject::onMarkedForRemoval ( )
inlineprotectedvirtual

Reimplemented in LuaEntitySAO.

Referenced by markForRemoval().

+ Here is the caller graph for this function:

◆ punch()

virtual u16 ServerActiveObject::punch ( v3f  dir,
const ToolCapabilities toolcap = nullptr,
ServerActiveObject puncher = nullptr,
float  time_from_last_punch = 1000000.0f 
)
inlinevirtual

Reimplemented in LuaEntitySAO, and PlayerSAO.

Referenced by Server::handleCommand_Interact(), and ObjectRef::l_punch().

+ Here is the caller graph for this function:

◆ removingFromEnvironment()

virtual void ServerActiveObject::removingFromEnvironment ( )
inlinevirtual

Reimplemented in PlayerSAO.

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

+ Here is the caller graph for this function:

◆ rightClick()

virtual void ServerActiveObject::rightClick ( ServerActiveObject clicker)
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

Referenced by Server::handleCommand_Interact(), and ObjectRef::l_right_click().

+ Here is the caller graph for this function:

◆ setAnimation()

virtual void ServerActiveObject::setAnimation ( v2f  frames,
float  frame_speed,
float  frame_blend,
bool  frame_loop 
)
inlinevirtual

Reimplemented in UnitSAO.

Referenced by ObjectRef::l_set_animation().

+ Here is the caller graph for this function:

◆ setAnimationSpeed()

virtual void ServerActiveObject::setAnimationSpeed ( float  frame_speed)
inlinevirtual

Reimplemented in UnitSAO.

Referenced by ObjectRef::l_set_animation_frame_speed().

+ Here is the caller graph for this function:

◆ setArmorGroups()

virtual void ServerActiveObject::setArmorGroups ( const ItemGroupList armor_groups)
inlinevirtual

Reimplemented in UnitSAO.

Referenced by ObjectRef::l_set_armor_groups().

+ Here is the caller graph for this function:

◆ setBasePosition()

void ServerActiveObject::setBasePosition ( v3f  pos)
inline

References m_base_position.

Referenced by PlayerSAO::addedToEnvironment(), moveTo(), PlayerSAO::setBasePosition(), and setPos().

+ Here is the caller graph for this function:

◆ setBonePosition()

virtual void ServerActiveObject::setBonePosition ( const std::string &  bone,
v3f  position,
v3f  rotation 
)
inlinevirtual

Reimplemented in UnitSAO.

Referenced by ObjectRef::l_set_bone_position().

+ Here is the caller graph for this function:

◆ setHP()

virtual void ServerActiveObject::setHP ( s32  hp,
const PlayerHPChangeReason reason 
)
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

Referenced by ObjectRef::l_set_hp(), and read_object_properties().

+ Here is the caller graph for this function:

◆ setInventoryModified()

virtual void ServerActiveObject::setInventoryModified ( )
inlinevirtual

Reimplemented in PlayerSAO.

◆ setPos()

virtual void ServerActiveObject::setPos ( const v3f pos)
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

References setBasePosition().

Referenced by ObjectRef::l_set_pos().

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

◆ setWieldedItem()

bool ServerActiveObject::setWieldedItem ( const ItemStack item)
virtual

Reimplemented in PlayerSAO.

Referenced by ObjectRef::l_set_wielded_item().

+ Here is the caller graph for this function:

◆ shouldUnload()

virtual bool ServerActiveObject::shouldUnload ( ) const
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

Referenced by ServerEnvironment::deactivateFarObjects().

+ Here is the caller graph for this function:

◆ step()

virtual void ServerActiveObject::step ( float  dtime,
bool  send_recommended 
)
inlinevirtual

Reimplemented in PlayerSAO, and LuaEntitySAO.

Member Data Documentation

◆ m_attached_particle_spawners

std::unordered_set<u32> ServerActiveObject::m_attached_particle_spawners
protected

◆ m_base_position

◆ m_env

◆ m_known_by_count

◆ m_messages_out

◆ m_pending_deactivation

bool ServerActiveObject::m_pending_deactivation = false
protected

Referenced by isGone(), and markForDeactivation().

◆ m_pending_removal

bool ServerActiveObject::m_pending_removal = false
protected

◆ m_static_block

◆ m_static_exists


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