#include <serveractiveobject.h>
Inheritance diagram for ServerActiveObject:
Collaboration diagram for ServerActiveObject:Public Types | |
| using | Observers = std::optional<std::unordered_set<std::string>> |
Public Types inherited from ActiveObject | |
| typedef u16 | object_t |
Public Member Functions | |
| ServerActiveObject (ServerEnvironment *env, v3f pos) | |
| virtual | ~ServerActiveObject ()=default |
| virtual ActiveObjectType | getSendType () const |
| virtual void | addedToEnvironment (u32 dtime_s) |
| virtual void | removingFromEnvironment () |
| void | markForRemoval () |
| void | markForDeactivation () |
| v3f | getBasePosition () const |
| void | setBasePosition (v3f pos) |
| ServerEnvironment * | getEnv () |
| virtual void | setPos (const v3f &pos) |
| virtual void | addPos (const v3f &added_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 u32 | punch (v3f dir, const ToolCapabilities *toolcap=nullptr, ServerActiveObject *puncher=nullptr, float time_from_last_punch=1000000.0f, u16 initial_wear=0) |
| 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 ItemGroupList & | getArmorGroups () 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 | setBoneOverride (const std::string &bone, const BoneOverride &props) |
| virtual BoneOverride | getBoneOverride (const std::string &bone) |
| virtual const BoneOverrideMap & | getBoneOverrides () const |
| virtual const std::unordered_set< object_t > & | getAttachmentChildIds () const |
| virtual ServerActiveObject * | getParent () const |
| virtual ObjectProperties * | accessObjectProperties () |
| virtual void | notifyObjectPropertiesModified () |
| virtual Inventory * | getInventory () 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 |
| void | invalidateEffectiveObservers () |
| Invalidate final observer cache. | |
| const Observers & | getEffectiveObservers () |
Cache m_effective_observers with the names of all observers, also indirect observers (object attachment chain). | |
| const Observers & | recalculateEffectiveObservers () |
| Force a recalculation of final observers (including all parents). | |
| bool | isEffectivelyObservedBy (const std::string &player_name) |
Whether the object is sent to player_name | |
Public Member Functions inherited from ActiveObject | |
| ActiveObject (object_t id) | |
| object_t | getId () const |
| void | setId (object_t 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 (object_t parent_id, const std::string &bone, v3f position, v3f rotation, bool force_visible) |
| virtual void | getAttachment (object_t *parent_id, std::string *bone, v3f *position, v3f *rotation, bool *force_visible) const |
| virtual void | clearChildAttachments () |
| virtual void | clearParentAttachment () |
| virtual void | addAttachmentChild (object_t child_id) |
| virtual void | removeAttachmentChild (object_t child_id) |
Public Attributes | |
| u16 | m_known_by_count = 0 |
| bool | m_static_exists = false |
| v3s16 | m_static_block = v3s16(1337,1337,1337) |
| Observers | m_observers |
Protected Member Functions | |
| virtual void | onMarkedForDeactivation () |
| virtual void | onMarkedForRemoval () |
Protected Attributes | |
| std::optional< Observers > | m_effective_observers |
| ServerEnvironment * | m_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< ActiveObjectMessage > | m_messages_out |
Protected Attributes inherited from ActiveObject | |
| object_t | m_id |
| using ServerActiveObject::Observers = std::optional<std::unordered_set<std::string>> |
| ServerActiveObject::ServerActiveObject | ( | ServerEnvironment * | env, |
| v3f | pos ) |
|
virtualdefault |
|
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:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
Referenced by LuaEntitySAO::addedToEnvironment(), and PlayerSAO::addedToEnvironment().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in PlayerSAO.
References m_base_position, and setBasePosition().
Referenced by ObjectRef::l_add_pos().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
References m_attached_particle_spawners.
|
inline |
References m_attached_particle_spawners.
Referenced by ServerEnvironment::deleteParticleSpawner().
Here is the caller graph for this function:| void ServerActiveObject::dumpAOMessagesToQueue | ( | std::queue< ActiveObjectMessage > & | queue | ) |
References m_messages_out.
| 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:
|
inlinevirtual |
Reimplemented in UnitSAO.
Referenced by ObjectRef::l_get_animation().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in UnitSAO.
Referenced by ObjectRef::l_get_armor_groups().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in UnitSAO.
Referenced by ObjectRef::l_get_children().
Here is the caller graph for this function:
|
inline |
References m_base_position.
Referenced by PlayerSAO::addPos(), ICraftAction::apply(), IDropAction::apply(), ServerEnvironment::deactivateFarObjects(), ServerEnvironment::getAddedActiveObjects(), server::ActiveObjectMgr::getAddedActiveObjectsAroundPos(), RemoteClient::GetNextBlocks(), server::ActiveObjectMgr::getObjectsInArea(), server::ActiveObjectMgr::getObjectsInsideRadius(), ServerPlayingSound::getPos(), ServerEnvironment::getRemovedActiveObjects(), Server::handleCommand_Damage(), Server::handleCommand_Interact(), ObjectRef::l_get_pos(), ObjectRef::l_punch(), PlayerSAO::moveTo(), Server::playSound(), PlayerDatabaseLevelDB::savePlayer(), PlayerDatabaseSQLite3::savePlayer(), Server::SendAddParticleSpawner(), Server::sendMetadataChanged(), Server::SendMovePlayer(), Server::sendNodeChangePkt(), Server::SendSpawnParticle(), PlayerDatabaseFiles::serialize(), and PlayerSAO::setPos().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in UnitSAO.
Referenced by ObjectRef::l_get_bone_override(), and ObjectRef::l_get_bone_position().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in UnitSAO.
Referenced by ObjectRef::l_get_bone_overrides().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
Referenced by generateUpdateInfantCommand(), and Server::SendActiveObjectRemoveAdd().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
Referenced by ICraftAction::apply(), Server::handleCommand_Interact(), LuaEntitySAO::punch(), and PlayerSAO::punch().
Here is the caller graph for this function:| const Observers & ServerActiveObject::getEffectiveObservers | ( | ) |
Cache m_effective_observers with the names of all observers, also indirect observers (object attachment chain).
References getParent(), m_effective_observers, and m_observers.
Referenced by isEffectivelyObservedBy(), and recalculateEffectiveObservers().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
References m_env.
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and UnitSAO.
Referenced by ObjectRef::l_get_hp(), LuaEntitySAO::punch(), PlayerSAO::punch(), and read_object_properties().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in PlayerSAO.
|
virtual |
Reimplemented in PlayerSAO.
Referenced by ObjectRef::l_get_inventory().
Here is the caller graph for this function:
|
virtual |
Reimplemented in LuaEntitySAO.
References BS.
Referenced by ServerEnvironment::deactivateFarObjects().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in UnitSAO.
Referenced by Server::AsyncRunStep(), getAttachedObject(), and getEffectiveObservers().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
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:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
References isStaticAllowed().
Referenced by StaticObject::StaticObject().
Here is the call graph for this function:
Here is the caller graph for this function:
|
virtual |
Reimplemented in PlayerSAO.
Referenced by ObjectRef::l_get_wielded_item(), and LuaEntitySAO::punch().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in PlayerSAO.
Referenced by ObjectRef::l_get_wield_index().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in PlayerSAO.
Referenced by ObjectRef::l_get_wield_list().
Here is the caller graph for this function:| void ServerActiveObject::invalidateEffectiveObservers | ( | ) |
Invalidate final observer cache.
This needs to be done whenever the observers of this object or any of its ancestors may have changed.
References m_effective_observers.
Referenced by server::ActiveObjectMgr::invalidateActiveObjectObserverCaches().
Here is the caller graph for this function:| bool ServerActiveObject::isEffectivelyObservedBy | ( | const std::string & | player_name | ) |
Whether the object is sent to player_name
References getEffectiveObservers().
Referenced by ServerEnvironment::getAddedActiveObjects(), server::ActiveObjectMgr::getAddedActiveObjectsAroundPos(), and ServerEnvironment::getRemovedActiveObjects().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
References m_pending_deactivation, and m_pending_removal.
Referenced by ServerEnvironment::deactivateFarObjects(), LuaEntitySAO::dispatchScriptDeactivate(), server::ActiveObjectMgr::getAddedActiveObjectsAroundPos(), ObjectRef::getobject(), ServerEnvironment::getRemovedActiveObjects(), Server::handleCommand_Interact(), ModApiEnv::l_get_connected_players(), ModApiEnv::l_get_player_by_name(), ScriptApiBase::objectrefGetOrCreate(), UnitSAO::onAttach(), UnitSAO::onDetach(), ServerEnvironment::processActiveObjectRemove(), ServerEnvironment::removeRemovedObjects(), UnitSAO::setAttachment(), and LuaEntitySAO::setHP().
Here is the caller graph for this function:
|
inline |
References m_pending_removal.
Referenced by ServerEnvironment::removeRemovedObjects().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
Referenced by StaticObject::StaticObject(), ServerEnvironment::deactivateFarObjects(), and getStaticData().
Here is the caller graph for this function:| 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:| void ServerActiveObject::markForRemoval | ( | ) |
References m_pending_removal, and onMarkedForRemoval().
Referenced by ServerEnvironment::clearObjects(), PlayerSAO::disconnected(), ObjectRef::l_remove(), LuaEntitySAO::punch(), and LuaEntitySAO::setHP().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
References setBasePosition().
Referenced by ObjectRef::l_move_to().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in UnitSAO.
Referenced by ObjectRef::l_set_nametag_attributes(), and ObjectRef::l_set_properties().
Here is the caller graph for this function:
|
inlineprotectedvirtual |
Reimplemented in LuaEntitySAO, and UnitSAO.
Referenced by markForDeactivation(), and UnitSAO::onMarkedForDeactivation().
Here is the caller graph for this function:
|
inlineprotectedvirtual |
Reimplemented in LuaEntitySAO, and UnitSAO.
Referenced by markForRemoval(), and UnitSAO::onMarkedForRemoval().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
Referenced by Server::handleCommand_Interact(), and ObjectRef::l_punch().
Here is the caller graph for this function:| const Observers & ServerActiveObject::recalculateEffectiveObservers | ( | ) |
Force a recalculation of final observers (including all parents).
References getEffectiveObservers().
Here is the call graph for this function:
|
inlinevirtual |
Reimplemented in PlayerSAO.
Referenced by ServerEnvironment::processActiveObjectRemove(), and PlayerSAO::removingFromEnvironment().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
Referenced by Server::handleCommand_Interact(), and ObjectRef::l_right_click().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in UnitSAO.
Referenced by ObjectRef::l_set_animation().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in UnitSAO.
Referenced by ObjectRef::l_set_animation_frame_speed().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in UnitSAO.
Referenced by ObjectRef::l_set_armor_groups().
Here is the caller graph for this function:
|
inline |
References m_base_position.
Referenced by PlayerSAO::addedToEnvironment(), addPos(), moveTo(), PlayerSAO::setBasePosition(), and setPos().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in UnitSAO.
Referenced by ObjectRef::l_set_bone_override(), and ObjectRef::l_set_bone_position().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
Referenced by ObjectRef::l_set_hp(), and read_object_properties().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in PlayerSAO.
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
References setBasePosition().
Referenced by ObjectRef::l_set_pos().
Here is the call graph for this function:
Here is the caller graph for this function:
|
virtual |
Reimplemented in PlayerSAO.
Referenced by ObjectRef::l_set_wielded_item().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
Referenced by ServerEnvironment::deactivateFarObjects().
Here is the caller graph for this function:
|
inlinevirtual |
Reimplemented in LuaEntitySAO, and PlayerSAO.
|
protected |
|
protected |
Referenced by PlayerSAO::addedToEnvironment(), addPos(), PlayerSAO::checkMovementCheat(), getBasePosition(), LuaEntitySAO::getClientInitializationData(), PlayerSAO::getClientInitializationData(), LuaEntitySAO::getCollisionBox(), PlayerSAO::getCollisionBox(), LuaEntitySAO::getDescription(), PlayerSAO::getEyePosition(), LuaEntitySAO::moveTo(), LuaEntitySAO::sendPosition(), PlayerSAO::setBasePosition(), setBasePosition(), LuaEntitySAO::setPos(), LuaEntitySAO::step(), and PlayerSAO::step().
|
protected |
Referenced by getEffectiveObservers(), and invalidateEffectiveObservers().
|
protected |
Referenced by LuaEntitySAO::~LuaEntitySAO(), LuaEntitySAO::addedToEnvironment(), PlayerSAO::addPos(), PlayerSAO::checkMovementCheat(), UnitSAO::clearChildAttachments(), LuaEntitySAO::dispatchScriptDeactivate(), LuaEntitySAO::getClientInitializationData(), PlayerSAO::getClientInitializationData(), getEnv(), UnitSAO::getParent(), LuaEntitySAO::getStaticData(), PlayerSAO::moveTo(), UnitSAO::onAttach(), UnitSAO::onDetach(), LuaEntitySAO::punch(), PlayerSAO::punch(), PlayerSAO::removingFromEnvironment(), PlayerSAO::respawn(), LuaEntitySAO::rightClick(), PlayerSAO::rightClick(), LuaEntitySAO::sendPosition(), UnitSAO::setAttachment(), PlayerSAO::setBasePosition(), PlayerSAO::setBreath(), LuaEntitySAO::setHP(), PlayerSAO::setHP(), PlayerSAO::setLookPitchAndSend(), PlayerSAO::setPlayerYawAndSend(), PlayerSAO::setPos(), LuaEntitySAO::step(), PlayerSAO::step(), and PlayerSAO::unlinkPlayerSessionAndSave().
| u16 ServerActiveObject::m_known_by_count = 0 |
|
protected |
| Observers ServerActiveObject::m_observers |
Referenced by getEffectiveObservers(), and ObjectRef::l_set_observers().
|
protected |
Referenced by isGone(), and markForDeactivation().
|
protected |
Referenced by isGone(), isPendingRemoval(), and markForRemoval().
| bool ServerActiveObject::m_static_exists = false |