#include <unit_sao.h>
Public Member Functions | |
UnitSAO (ServerEnvironment *env, v3f pos) | |
virtual | ~UnitSAO ()=default |
u16 | getHP () const |
bool | isDead () const |
void | setRotation (v3f rotation) |
const v3f & | getRotation () const |
v3f | getRadRotation () |
f32 | getRadYawDep () const |
bool | isImmortal () const |
void | setArmorGroups (const ItemGroupList &armor_groups) |
const ItemGroupList & | getArmorGroups () const |
void | setAnimation (v2f frame_range, float frame_speed, float frame_blend, bool frame_loop) |
void | getAnimation (v2f *frame_range, float *frame_speed, float *frame_blend, bool *frame_loop) |
void | setAnimationSpeed (float frame_speed) |
void | setBonePosition (const std::string &bone, v3f position, v3f rotation) |
void | getBonePosition (const std::string &bone, v3f *position, v3f *rotation) |
ServerActiveObject * | getParent () const |
bool | isAttached () const |
void | setAttachment (int parent_id, const std::string &bone, v3f position, v3f rotation, bool force_visible) |
void | getAttachment (int *parent_id, std::string *bone, v3f *position, v3f *rotation, bool *force_visible) const |
void | clearChildAttachments () |
void | clearParentAttachment () |
void | addAttachmentChild (int child_id) |
void | removeAttachmentChild (int child_id) |
const std::unordered_set< int > & | getAttachmentChildIds () const |
ObjectProperties * | accessObjectProperties () |
void | notifyObjectPropertiesModified () |
void | sendOutdatedData () |
std::string | generateUpdateAttachmentCommand () const |
std::string | generateUpdateAnimationSpeedCommand () const |
std::string | generateUpdateAnimationCommand () const |
std::string | generateUpdateArmorGroupsCommand () const |
std::string | generateSetPropertiesCommand (const ObjectProperties &prop) const |
void | sendPunchCommand () |
Public Member Functions inherited from ServerActiveObject | |
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) |
ServerEnvironment * | getEnv () |
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 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 |
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 |
Static Public Member Functions | |
static std::string | generateUpdatePositionCommand (const v3f &position, const v3f &velocity, const v3f &acceleration, const v3f &rotation, bool do_interpolate, bool is_movement_end, f32 update_interval) |
static std::string | generateUpdateBonePositionCommand (const std::string &bone, const v3f &position, const v3f &rotation) |
Static Public Member Functions inherited from ServerActiveObject | |
static ServerActiveObject * | create (ActiveObjectType type, ServerEnvironment *env, u16 id, v3f pos, const std::string &data) |
Protected Attributes | |
u16 | m_hp = 1 |
v3f | m_rotation |
ItemGroupList | m_armor_groups |
bool | m_properties_sent = true |
ObjectProperties | m_prop |
std::unordered_map< std::string, core::vector2d< v3f > > | m_bone_position |
int | m_attachment_parent_id = 0 |
Protected Attributes inherited from ServerActiveObject | |
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 | |
u16 | m_id |
Private Member Functions | |
void | onAttach (int parent_id) |
void | onDetach (int parent_id) |
std::string | generatePunchCommand (u16 result_hp) const |
Private Attributes | |
bool | m_armor_groups_sent = false |
v2f | m_animation_range |
float | m_animation_speed = 0.0f |
float | m_animation_blend = 0.0f |
bool | m_animation_loop = true |
bool | m_animation_sent = false |
bool | m_animation_speed_sent = false |
bool | m_bone_position_sent = false |
std::unordered_set< int > | m_attachment_child_ids |
std::string | m_attachment_bone = "" |
v3f | m_attachment_position |
v3f | m_attachment_rotation |
bool | m_attachment_sent = false |
bool | m_force_visible = false |
Additional Inherited Members | |
Public Attributes inherited from ServerActiveObject | |
u16 | m_known_by_count = 0 |
bool | m_static_exists = false |
v3s16 | m_static_block = v3s16(1337,1337,1337) |
Protected Member Functions inherited from ServerActiveObject | |
virtual void | onMarkedForDeactivation () |
virtual void | onMarkedForRemoval () |
UnitSAO::UnitSAO | ( | ServerEnvironment * | env, |
v3f | pos | ||
) |
References m_armor_groups.
|
virtualdefault |
|
virtual |
Reimplemented from ServerActiveObject.
References m_prop.
Referenced by Server::RespawnPlayer().
|
virtual |
Reimplemented from ActiveObject.
References m_attachment_child_ids.
|
virtual |
Reimplemented from ActiveObject.
References ServerEnvironment::getActiveObject(), m_attachment_child_ids, and ServerActiveObject::m_env.
Referenced by Server::DeleteClient(), and LuaEntitySAO::punch().
|
virtual |
Reimplemented from ActiveObject.
References ServerEnvironment::getActiveObject(), m_attachment_parent_id, m_attachment_position, m_attachment_rotation, ServerActiveObject::m_env, ActiveObject::m_id, ActiveObject::removeAttachmentChild(), and setAttachment().
Referenced by Server::DeleteClient(), Server::DiePlayer(), LuaEntitySAO::punch(), LuaEntitySAO::step(), and PlayerSAO::step().
|
private |
References AO_CMD_PUNCHED, writeU16(), and writeU8().
Referenced by sendPunchCommand().
std::string UnitSAO::generateSetPropertiesCommand | ( | const ObjectProperties & | prop | ) | const |
References AO_CMD_SET_PROPERTIES, ObjectProperties::serialize(), and writeU8().
Referenced by LuaEntitySAO::getPropertyPacket(), and PlayerSAO::getPropertyPacket().
std::string UnitSAO::generateUpdateAnimationCommand | ( | ) | const |
References AO_CMD_SET_ANIMATION, m_animation_blend, m_animation_loop, m_animation_range, m_animation_speed, writeF32(), writeU8(), and writeV2F32().
Referenced by LuaEntitySAO::getClientInitializationData(), PlayerSAO::getClientInitializationData(), and sendOutdatedData().
std::string UnitSAO::generateUpdateAnimationSpeedCommand | ( | ) | const |
References AO_CMD_SET_ANIMATION_SPEED, m_animation_speed, writeF32(), and writeU8().
Referenced by sendOutdatedData().
std::string UnitSAO::generateUpdateArmorGroupsCommand | ( | ) | const |
References AO_CMD_UPDATE_ARMOR_GROUPS, m_armor_groups, serializeString16(), writeS16(), writeU16(), and writeU8().
Referenced by LuaEntitySAO::getClientInitializationData(), PlayerSAO::getClientInitializationData(), and sendOutdatedData().
std::string UnitSAO::generateUpdateAttachmentCommand | ( | ) | const |
References AO_CMD_ATTACH_TO, m_attachment_bone, m_attachment_parent_id, m_attachment_position, m_attachment_rotation, m_force_visible, serializeString16(), writeS16(), writeU8(), and writeV3F32().
Referenced by LuaEntitySAO::getClientInitializationData(), PlayerSAO::getClientInitializationData(), and sendOutdatedData().
|
static |
References AO_CMD_SET_BONE_POSITION, serializeString16(), writeU8(), and writeV3F32().
Referenced by LuaEntitySAO::getClientInitializationData(), PlayerSAO::getClientInitializationData(), and sendOutdatedData().
|
static |
References AO_CMD_UPDATE_POSITION, writeF32(), writeU8(), and writeV3F32().
Referenced by LuaEntitySAO::sendPosition(), and PlayerSAO::step().
|
virtual |
Reimplemented from ServerActiveObject.
References m_animation_blend, m_animation_loop, m_animation_range, and m_animation_speed.
|
virtual |
Reimplemented from ServerActiveObject.
References m_armor_groups.
Referenced by isImmortal().
|
virtual |
Reimplemented from ActiveObject.
References m_attachment_bone, m_attachment_parent_id, m_attachment_position, m_attachment_rotation, and m_force_visible.
Referenced by getAttachedObject().
|
virtual |
Reimplemented from ServerActiveObject.
References m_attachment_child_ids.
Referenced by LuaEntitySAO::getClientInitializationData(), and PlayerSAO::getClientInitializationData().
Reimplemented from ServerActiveObject.
References m_bone_position.
|
inlinevirtual |
Reimplemented from ServerActiveObject.
References m_hp.
Referenced by PlayerSAO::getClientInitializationData(), Server::handleCommand_Damage(), Server::handleCommand_Interact(), PlayerSAO::punch(), PlayerDatabaseLevelDB::savePlayer(), PlayerDatabaseSQLite3::savePlayer(), Server::SendPlayerHP(), sendPunchCommand(), and PlayerDatabaseFiles::serialize().
|
virtual |
Reimplemented from ServerActiveObject.
References ServerEnvironment::getActiveObject(), m_attachment_parent_id, and ServerActiveObject::m_env.
Referenced by isAttached(), LuaEntitySAO::step(), and PlayerSAO::step().
|
inline |
References m_rotation.
Referenced by ObjectRef::l_get_look_horizontal().
|
inline |
References m_rotation.
Referenced by ObjectRef::l_get_look_dir(), and ObjectRef::l_get_look_yaw().
|
inline |
References m_rotation.
Referenced by RemoteClient::GetNextBlocks(), ObjectRef::l_get_rotation(), ObjectRef::l_get_yaw(), PlayerDatabaseLevelDB::savePlayer(), PlayerDatabaseSQLite3::savePlayer(), Server::SendMovePlayer(), and PlayerDatabaseFiles::serialize().
|
inline |
References getParent().
Referenced by PlayerSAO::checkMovementCheat(), getAttachedObject(), LuaEntitySAO::moveTo(), PlayerSAO::moveTo(), Server::process_PlayerPos(), LuaEntitySAO::sendPosition(), LuaEntitySAO::setPos(), PlayerSAO::setPos(), LuaEntitySAO::step(), and PlayerSAO::step().
|
inline |
References m_hp.
Referenced by Server::handleCommand_Damage(), Server::handleCommand_Interact(), Server::handleCommand_InventoryAction(), Server::handleCommand_PlayerPos(), Server::handleCommand_Respawn(), Server::SendPlayerHPOrDie(), and Server::StageTwoClientInit().
|
inline |
References getArmorGroups(), and itemgroup_get().
Referenced by Server::handleCommand_Damage(), PlayerSAO::punch(), Server::SendPlayerHPOrDie(), PlayerSAO::setHP(), and PlayerSAO::step().
|
virtual |
Reimplemented from ServerActiveObject.
References m_properties_sent.
|
privatevirtual |
Reimplemented from ServerActiveObject.
References ACTIVEOBJECT_TYPE_LUAENTITY, ServerEnvironment::getActiveObject(), ServerEnvironment::getScriptIface(), ActiveObject::getType(), ServerActiveObject::isGone(), ScriptApiEntity::luaentity_on_attach_child(), and ServerActiveObject::m_env.
Referenced by setAttachment().
|
privatevirtual |
Reimplemented from ServerActiveObject.
References ACTIVEOBJECT_TYPE_LUAENTITY, ServerEnvironment::getActiveObject(), ServerEnvironment::getScriptIface(), ActiveObject::getType(), ServerActiveObject::isGone(), ScriptApiEntity::luaentity_on_detach(), ScriptApiEntity::luaentity_on_detach_child(), ServerActiveObject::m_env, and ActiveObject::m_id.
Referenced by setAttachment().
|
virtual |
Reimplemented from ActiveObject.
References m_attachment_child_ids.
void UnitSAO::sendOutdatedData | ( | ) |
References generateUpdateAnimationCommand(), generateUpdateAnimationSpeedCommand(), generateUpdateArmorGroupsCommand(), generateUpdateAttachmentCommand(), generateUpdateBonePositionCommand(), ActiveObject::getId(), m_animation_sent, m_animation_speed_sent, m_armor_groups_sent, m_attachment_sent, m_bone_position, m_bone_position_sent, and ServerActiveObject::m_messages_out.
Referenced by Server::SendMovePlayer(), LuaEntitySAO::sendPosition(), LuaEntitySAO::step(), and PlayerSAO::step().
void UnitSAO::sendPunchCommand | ( | ) |
References generatePunchCommand(), getHP(), ActiveObject::getId(), and ServerActiveObject::m_messages_out.
Referenced by PlayerSAO::punch(), LuaEntitySAO::punch(), and Server::SendPlayerHP().
|
virtual |
Reimplemented from ServerActiveObject.
References m_animation_blend, m_animation_loop, m_animation_range, m_animation_sent, and m_animation_speed.
|
virtual |
Reimplemented from ServerActiveObject.
References m_animation_speed, and m_animation_speed_sent.
|
virtual |
Reimplemented from ServerActiveObject.
References m_armor_groups, and m_armor_groups_sent.
|
virtual |
Reimplemented from ActiveObject.
References m_attachment_bone, m_attachment_parent_id, m_attachment_position, m_attachment_rotation, m_attachment_sent, m_force_visible, onAttach(), and onDetach().
Referenced by clearParentAttachment().
Reimplemented from ServerActiveObject.
References m_bone_position, and m_bone_position_sent.
|
inline |
References m_rotation.
Referenced by ObjectRef::l_set_rotation(), ObjectRef::l_set_yaw(), and PlayerSAO::setPlayerYaw().
|
private |
Referenced by generateUpdateAnimationCommand(), getAnimation(), and setAnimation().
|
private |
Referenced by generateUpdateAnimationCommand(), getAnimation(), and setAnimation().
|
private |
Referenced by generateUpdateAnimationCommand(), getAnimation(), and setAnimation().
|
private |
Referenced by sendOutdatedData(), and setAnimation().
|
private |
|
private |
Referenced by sendOutdatedData(), and setAnimationSpeed().
|
protected |
|
private |
Referenced by sendOutdatedData(), and setArmorGroups().
|
private |
Referenced by generateUpdateAttachmentCommand(), getAttachment(), and setAttachment().
|
private |
Referenced by addAttachmentChild(), clearChildAttachments(), getAttachmentChildIds(), and removeAttachmentChild().
|
protected |
|
private |
Referenced by clearParentAttachment(), generateUpdateAttachmentCommand(), getAttachment(), and setAttachment().
|
private |
Referenced by clearParentAttachment(), generateUpdateAttachmentCommand(), getAttachment(), and setAttachment().
|
private |
Referenced by sendOutdatedData(), and setAttachment().
|
protected |
|
private |
Referenced by sendOutdatedData(), and setBonePosition().
|
private |
Referenced by generateUpdateAttachmentCommand(), getAttachment(), and setAttachment().
|
protected |
Referenced by LuaEntitySAO::LuaEntitySAO(), PlayerSAO::PlayerSAO(), LuaEntitySAO::addedToEnvironment(), LuaEntitySAO::getClientInitializationData(), LuaEntitySAO::getHP(), getHP(), LuaEntitySAO::getStaticData(), isDead(), PlayerSAO::punch(), LuaEntitySAO::punch(), LuaEntitySAO::setHP(), PlayerSAO::setHP(), PlayerSAO::setHPRaw(), and PlayerSAO::step().
|
protected |
Referenced by PlayerSAO::PlayerSAO(), accessObjectProperties(), LuaEntitySAO::addedToEnvironment(), LuaEntitySAO::collideWithObjects(), LuaEntitySAO::getCollisionBox(), PlayerSAO::getCollisionBox(), PlayerSAO::getEyeOffset(), LuaEntitySAO::getPropertyPacket(), PlayerSAO::getPropertyPacket(), LuaEntitySAO::getSelectionBox(), PlayerSAO::getSelectionBox(), PlayerSAO::getZoomFOV(), LuaEntitySAO::isStaticAllowed(), PlayerSAO::setBreath(), PlayerSAO::setHP(), LuaEntitySAO::step(), and PlayerSAO::step().
|
protected |
Referenced by notifyObjectPropertiesModified(), PlayerSAO::setHP(), LuaEntitySAO::step(), and PlayerSAO::step().
|
protected |
Referenced by LuaEntitySAO::LuaEntitySAO(), LuaEntitySAO::getClientInitializationData(), PlayerSAO::getClientInitializationData(), getRadRotation(), getRadYawDep(), getRotation(), LuaEntitySAO::getStaticData(), LuaEntitySAO::sendPosition(), PlayerSAO::setPlayerYaw(), setRotation(), LuaEntitySAO::step(), and PlayerSAO::step().