Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
PlayerSAO Class Reference

#include <player_sao.h>

+ Inheritance diagram for PlayerSAO:
+ Collaboration diagram for PlayerSAO:

Public Member Functions

 PlayerSAO (ServerEnvironment *env_, RemotePlayer *player_, session_t peer_id_, bool is_singleplayer)
 
ActiveObjectType getType () const override
 
ActiveObjectType getSendType () const override
 
std::string getDescription () override
 
void addedToEnvironment (u32 dtime_s) override
 
void removingFromEnvironment () override
 
bool isStaticAllowed () const override
 
bool shouldUnload () const override
 
std::string getClientInitializationData (u16 protocol_version) override
 
void getStaticData (std::string *result) const override
 
void step (float dtime, bool send_recommended) override
 
void setBasePosition (v3f position)
 
void setPos (const v3f &pos) override
 
void addPos (const v3f &added_pos) override
 
void moveTo (v3f pos, bool continuous) override
 
void setPlayerYaw (const float yaw)
 
void setPlayerYawAndSend (const float yaw)
 
void setLookPitch (const float pitch)
 
void setLookPitchAndSend (const float pitch)
 
f32 getLookPitch () const
 
f32 getRadLookPitch () const
 
f32 getRadLookPitchDep () const
 
void setFov (const float pitch)
 
f32 getFov () const
 
void setWantedRange (const s16 range)
 
s16 getWantedRange () const
 
void setCameraInverted (bool camera_inverted)
 
bool getCameraInverted () const
 
u32 punch (v3f dir, const ToolCapabilities *toolcap, ServerActiveObject *puncher, float time_from_last_punch, u16 initial_wear=0) override
 
void rightClick (ServerActiveObject *clicker) override
 
void setHP (s32 hp, const PlayerHPChangeReason &reason) override
 
void setHP (s32 hp, const PlayerHPChangeReason &reason, bool from_client)
 
void setHPRaw (u16 hp)
 
u16 getBreath () const
 
void setBreath (const u16 breath, bool send=true)
 
void respawn ()
 
InventorygetInventory () const override
 
InventoryLocation getInventoryLocation () const override
 
void setInventoryModified () override
 
std::string getWieldList () const override
 
u16 getWieldIndex () const override
 
ItemStack getWieldedItem (ItemStack *selected, ItemStack *hand=nullptr) const override
 
bool setWieldedItem (const ItemStack &item) override
 
void disconnected ()
 
void setPlayer (RemotePlayer *player)
 
RemotePlayergetPlayer ()
 
session_t getPeerID () const
 
v3f getLastGoodPosition () const
 
float resetTimeFromLastPunch ()
 
void noCheatDigStart (const v3s16 &p)
 
v3s16 getNoCheatDigPos ()
 
float getNoCheatDigTime ()
 
void noCheatDigEnd ()
 
LagPoolgetDigPool ()
 
void setMaxSpeedOverride (const v3f &vel)
 
bool checkMovementCheat ()
 
void updatePrivileges (const std::set< std::string > &privs, bool is_singleplayer)
 
bool getCollisionBox (aabb3f *toset) const override
 
bool getSelectionBox (aabb3f *toset) const override
 
bool collideWithObjects () const override
 
void finalize (RemotePlayer *player, const std::set< std::string > &privs)
 
v3f getEyePosition () const
 
v3f getEyeOffset () const
 
float getZoomFOV () const
 
SimpleMetadatagetMeta ()
 
- Public Member Functions inherited from UnitSAO
 UnitSAO (ServerEnvironment *env, v3f pos)
 
virtual ~UnitSAO ()=default
 
u16 getHP () const override
 
bool isDead () const
 
void setRotation (v3f rotation)
 
const v3fgetRotation () const
 
const v3f getTotalRotation () const
 
v3f getRadRotation ()
 
f32 getRadYawDep () const
 
bool isImmortal () const
 
void setArmorGroups (const ItemGroupList &armor_groups) override
 
const ItemGroupListgetArmorGroups () const override
 
void setAnimation (v2f frame_range, float frame_speed, float frame_blend, bool frame_loop) override
 
void getAnimation (v2f *frame_range, float *frame_speed, float *frame_blend, bool *frame_loop) override
 
void setAnimationSpeed (float frame_speed) override
 
void setBoneOverride (const std::string &bone, const BoneOverride &props) override
 
BoneOverride getBoneOverride (const std::string &bone) override
 
const std::unordered_map< std::string, BoneOverride > & getBoneOverrides () const override
 
ServerActiveObjectgetParent () const override
 
bool isAttached () const
 
void setAttachment (object_t parent_id, const std::string &bone, v3f position, v3f rotation, bool force_visible) override
 
void getAttachment (object_t *parent_id, std::string *bone, v3f *position, v3f *rotation, bool *force_visible) const override
 
void clearChildAttachments () override
 
void addAttachmentChild (object_t child_id) override
 
void removeAttachmentChild (object_t child_id) override
 
const std::unordered_set< object_t > & getAttachmentChildIds () const override
 
ObjectPropertiesaccessObjectProperties () override
 
void notifyObjectPropertiesModified () override
 
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
 
void markForRemoval ()
 
void markForDeactivation ()
 
v3f getBasePosition () const
 
void setBasePosition (v3f pos)
 
ServerEnvironmentgetEnv ()
 
virtual float getMinimumSavedMovement ()
 
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 ObserversgetEffectiveObservers ()
 Cache m_effective_observers with the names of all observers, also indirect observers (object attachment chain).
 
const ObserversrecalculateEffectiveObservers ()
 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 void clearParentAttachment ()
 

Public Attributes

struct { 
 
   bool   breathing: 1 
 
   bool   drowning: 1 
 
   bool   node_damage: 1 
 
m_flags = {true, true, true} 
 
bool m_physics_override_sent = false
 
- Public Attributes inherited from ServerActiveObject
u16 m_known_by_count = 0
 
bool m_static_exists = false
 
v3s16 m_static_block = v3s16(1337,1337,1337)
 
Observers m_observers
 

Private Member Functions

std::string getPropertyPacket ()
 
void unlinkPlayerSessionAndSave ()
 
std::string generateUpdatePhysicsOverrideCommand () const
 

Private Attributes

RemotePlayerm_player = nullptr
 
session_t m_peer_id_initial = 0
 only used to initialize RemotePlayer
 
LagPool m_dig_pool
 
LagPool m_move_pool
 
v3f m_last_good_position
 
float m_time_from_last_teleport = 0.0f
 
float m_time_from_last_punch = 0.0f
 
v3s16 m_nocheat_dig_pos = v3s16(32767, 32767, 32767)
 
float m_nocheat_dig_time = 0.0f
 
float m_max_speed_override_time = 0.0f
 
v3f m_max_speed_override = v3f(0.0f, 0.0f, 0.0f)
 
IntervalLimiter m_breathing_interval
 
IntervalLimiter m_drowning_interval
 
IntervalLimiter m_node_hurt_interval
 
bool m_position_not_sent = false
 
std::set< std::string > m_privs
 
bool m_is_singleplayer
 
u16 m_breath = PLAYER_MAX_BREATH_DEFAULT
 
f32 m_pitch = 0.0f
 
f32 m_fov = 0.0f
 
s16 m_wanted_range = 0.0f
 
bool m_camera_inverted = false
 
SimpleMetadata m_meta
 

Additional Inherited Members

- Public Types inherited from ServerActiveObject
using Observers = std::optional<std::unordered_set<std::string>>
 
- Public Types inherited from ActiveObject
typedef u16 object_t
 
- Static Public Member Functions inherited from UnitSAO
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 generateUpdateBoneOverrideCommand (const std::string &bone, const BoneOverride &props)
 
- Protected Member Functions inherited from UnitSAO
void clearAnyAttachments ()
 
virtual void onMarkedForDeactivation () override
 
virtual void onMarkedForRemoval () override
 
- Protected Attributes inherited from UnitSAO
u16 m_hp = 1
 
v3f m_rotation
 
f32 m_rotation_add_yaw = 0
 
ItemGroupList m_armor_groups
 
bool m_properties_sent = true
 
ObjectProperties m_prop
 
std::unordered_map< std::string, BoneOverridem_bone_override
 
object_t m_attachment_parent_id = 0
 
- Protected Attributes inherited from ServerActiveObject
std::optional< Observersm_effective_observers
 
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
object_t m_id
 

Constructor & Destructor Documentation

◆ PlayerSAO()

Member Function Documentation

◆ addedToEnvironment()

void PlayerSAO::addedToEnvironment ( u32 dtime_s)
overridevirtual

Reimplemented from ServerActiveObject.

References ServerActiveObject::addedToEnvironment(), ServerActiveObject::m_base_position, m_last_good_position, m_peer_id_initial, m_player, PEER_ID_INEXISTENT, ServerActiveObject::setBasePosition(), RemotePlayer::setPeerId(), and RemotePlayer::setPlayerSAO().

+ Here is the call graph for this function:

◆ addPos()

void PlayerSAO::addPos ( const v3f & added_pos)
overridevirtual

◆ checkMovementCheat()

◆ collideWithObjects()

bool PlayerSAO::collideWithObjects ( ) const
inlineoverridevirtual

Implements ActiveObject.

◆ disconnected()

void PlayerSAO::disconnected ( )

References m_player, ServerActiveObject::markForRemoval(), PEER_ID_INEXISTENT, and RemotePlayer::setPeerId().

Referenced by Server::DeleteClient().

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

◆ finalize()

void PlayerSAO::finalize ( RemotePlayer * player,
const std::set< std::string > & privs )

References m_player, and m_privs.

Referenced by Server::emergePlayer(), and ServerEnvironment::migratePlayersDatabase().

+ Here is the caller graph for this function:

◆ generateUpdatePhysicsOverrideCommand()

std::string PlayerSAO::generateUpdatePhysicsOverrideCommand ( ) const
private

References AO_CMD_SET_PHYSICS_OVERRIDE, m_player, Player::physics_override, writeF32(), and writeU8().

Referenced by getClientInitializationData(), and step().

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

◆ getBreath()

u16 PlayerSAO::getBreath ( ) const
inline

References m_breath.

Referenced by ObjectRef::l_get_breath(), read_object_properties(), PlayerDatabaseLevelDB::savePlayer(), PlayerDatabaseSQLite3::savePlayer(), Server::SendPlayerBreath(), and PlayerDatabaseFiles::serialize().

+ Here is the caller graph for this function:

◆ getCameraInverted()

bool PlayerSAO::getCameraInverted ( ) const
inline

References m_camera_inverted.

Referenced by RemoteClient::GetNextBlocks().

+ Here is the caller graph for this function:

◆ getClientInitializationData()

◆ getCollisionBox()

bool PlayerSAO::getCollisionBox ( aabb3f * toset) const
overridevirtual

Returns the collision box of the object. This box is translated by the object's location. The box's coordinates are world coordinates.

Returns
true if the object has a collision box.

Implements ActiveObject.

References BS, ObjectProperties::collisionbox, ServerActiveObject::m_base_position, and UnitSAO::m_prop.

◆ getDescription()

std::string PlayerSAO::getDescription ( )
overridevirtual

Reimplemented from ServerActiveObject.

References Player::getName(), and m_player.

Referenced by punch().

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

◆ getDigPool()

LagPool & PlayerSAO::getDigPool ( )
inline

References m_dig_pool.

Referenced by Server::handleCommand_Interact().

+ Here is the caller graph for this function:

◆ getEyeOffset()

v3f PlayerSAO::getEyeOffset ( ) const

References BS, ObjectProperties::eye_height, and UnitSAO::m_prop.

Referenced by getEyePosition(), and Server::handleCommand_Interact().

+ Here is the caller graph for this function:

◆ getEyePosition()

v3f PlayerSAO::getEyePosition ( ) const
inline

References getEyeOffset(), and ServerActiveObject::m_base_position.

Referenced by RemoteClient::GetNextBlocks(), Server::handleCommand_Interact(), Server::handleCommand_InventoryAction(), and step().

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

◆ getFov()

f32 PlayerSAO::getFov ( ) const
inline

References m_fov.

Referenced by RemoteClient::GetNextBlocks().

+ Here is the caller graph for this function:

◆ getInventory()

Inventory * PlayerSAO::getInventory ( ) const
overridevirtual

Reimplemented from ServerActiveObject.

References Player::inventory, and m_player.

Referenced by ServerInventoryManager::getInventory(), and PlayerDatabaseSQLite3::savePlayer().

+ Here is the caller graph for this function:

◆ getInventoryLocation()

InventoryLocation PlayerSAO::getInventoryLocation ( ) const
overridevirtual

Reimplemented from ServerActiveObject.

References Player::getName(), m_player, and InventoryLocation::setPlayer().

+ Here is the call graph for this function:

◆ getLastGoodPosition()

v3f PlayerSAO::getLastGoodPosition ( ) const
inline

References m_last_good_position.

Referenced by Server::handleCommand_Interact().

+ Here is the caller graph for this function:

◆ getLookPitch()

f32 PlayerSAO::getLookPitch ( ) const
inline

References m_pitch.

Referenced by RemoteClient::GetNextBlocks(), PlayerDatabaseLevelDB::savePlayer(), PlayerDatabaseSQLite3::savePlayer(), Server::SendMovePlayer(), and PlayerDatabaseFiles::serialize().

+ Here is the caller graph for this function:

◆ getMeta()

SimpleMetadata & PlayerSAO::getMeta ( )
inline

◆ getNoCheatDigPos()

v3s16 PlayerSAO::getNoCheatDigPos ( )
inline

References m_nocheat_dig_pos.

Referenced by Server::handleCommand_Interact().

+ Here is the caller graph for this function:

◆ getNoCheatDigTime()

float PlayerSAO::getNoCheatDigTime ( )
inline

References m_nocheat_dig_time.

Referenced by Server::handleCommand_Interact().

+ Here is the caller graph for this function:

◆ getPeerID()

session_t PlayerSAO::getPeerID ( ) const

References RemotePlayer::getPeerId(), m_player, and PEER_ID_INEXISTENT.

Referenced by addPos(), ObjectRef::l_add_velocity(), Server::SendMovePlayer(), Server::SendPlayerBreath(), Server::SendPlayerHP(), and setPos().

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

◆ getPlayer()

◆ getPropertyPacket()

std::string PlayerSAO::getPropertyPacket ( )
private

References UnitSAO::generateSetPropertiesCommand(), ObjectProperties::is_visible, and UnitSAO::m_prop.

Referenced by getClientInitializationData(), and step().

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

◆ getRadLookPitch()

f32 PlayerSAO::getRadLookPitch ( ) const
inline

References m_pitch.

Referenced by ObjectRef::l_get_look_vertical().

+ Here is the caller graph for this function:

◆ getRadLookPitchDep()

f32 PlayerSAO::getRadLookPitchDep ( ) const
inline

References m_pitch.

Referenced by ObjectRef::l_get_look_dir(), and ObjectRef::l_get_look_pitch().

+ Here is the caller graph for this function:

◆ getSelectionBox()

bool PlayerSAO::getSelectionBox ( aabb3f * toset) const
overridevirtual

Returns the selection box of the object. This box is not translated when the object moves. The box's coordinates are world coordinates.

Returns
true if the object has a selection box.

Implements ActiveObject.

References BS, ObjectProperties::is_visible, UnitSAO::m_prop, and ObjectProperties::selectionbox.

◆ getSendType()

ActiveObjectType PlayerSAO::getSendType ( ) const
inlineoverridevirtual

Reimplemented from ServerActiveObject.

References ACTIVEOBJECT_TYPE_GENERIC.

◆ getStaticData()

void PlayerSAO::getStaticData ( std::string * result) const
overridevirtual

Reimplemented from ServerActiveObject.

References FATAL_ERROR.

◆ getType()

ActiveObjectType PlayerSAO::getType ( ) const
inlineoverridevirtual

Implements ActiveObject.

References ACTIVEOBJECT_TYPE_PLAYER.

◆ getWantedRange()

s16 PlayerSAO::getWantedRange ( ) const
inline

References m_wanted_range.

Referenced by RemoteClient::GetNextBlocks(), and Server::SendActiveObjectRemoveAdd().

+ Here is the caller graph for this function:

◆ getWieldedItem()

ItemStack PlayerSAO::getWieldedItem ( ItemStack * selected,
ItemStack * hand = nullptr ) const
overridevirtual

Reimplemented from ServerActiveObject.

References Player::getWieldedItem(), and m_player.

Referenced by getWieldedItem(), and Server::handleCommand_Interact().

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

◆ getWieldIndex()

u16 PlayerSAO::getWieldIndex ( ) const
overridevirtual

Reimplemented from ServerActiveObject.

References Player::getWieldIndex(), and m_player.

+ Here is the call graph for this function:

◆ getWieldList()

std::string PlayerSAO::getWieldList ( ) const
inlineoverridevirtual

Reimplemented from ServerActiveObject.

Referenced by setWieldedItem().

+ Here is the caller graph for this function:

◆ getZoomFOV()

float PlayerSAO::getZoomFOV ( ) const

References UnitSAO::m_prop, and ObjectProperties::zoom_fov.

Referenced by RemoteClient::GetNextBlocks().

+ Here is the caller graph for this function:

◆ isStaticAllowed()

bool PlayerSAO::isStaticAllowed ( ) const
inlineoverridevirtual

Reimplemented from ServerActiveObject.

◆ moveTo()

void PlayerSAO::moveTo ( v3f pos,
bool continuous )
overridevirtual

Reimplemented from ServerActiveObject.

References LagPool::empty(), ServerActiveObject::getBasePosition(), ServerEnvironment::getGameDef(), UnitSAO::isAttached(), ServerActiveObject::m_env, m_last_good_position, m_move_pool, m_time_from_last_teleport, Server::SendMovePlayer(), and setBasePosition().

+ Here is the call graph for this function:

◆ noCheatDigEnd()

void PlayerSAO::noCheatDigEnd ( )
inline

References m_nocheat_dig_pos.

Referenced by Server::handleCommand_Interact().

+ Here is the caller graph for this function:

◆ noCheatDigStart()

void PlayerSAO::noCheatDigStart ( const v3s16 & p)
inline

References m_nocheat_dig_pos, m_nocheat_dig_time, and p().

Referenced by Server::handleCommand_Interact().

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

◆ punch()

◆ removingFromEnvironment()

void PlayerSAO::removingFromEnvironment ( )
overridevirtual

Reimplemented from ServerActiveObject.

References ServerEnvironment::deleteParticleSpawner(), RemotePlayer::getPlayerSAO(), ServerActiveObject::m_attached_particle_spawners, ServerActiveObject::m_env, m_player, ServerActiveObject::removingFromEnvironment(), SANITY_CHECK, and unlinkPlayerSessionAndSave().

+ Here is the call graph for this function:

◆ resetTimeFromLastPunch()

float PlayerSAO::resetTimeFromLastPunch ( )
inline

References m_time_from_last_punch.

Referenced by Server::handleCommand_Interact().

+ Here is the caller graph for this function:

◆ respawn()

void PlayerSAO::respawn ( )

◆ rightClick()

void PlayerSAO::rightClick ( ServerActiveObject * clicker)
overridevirtual

Reimplemented from ServerActiveObject.

References ServerEnvironment::getScriptIface(), ServerActiveObject::m_env, and ScriptApiPlayer::on_rightclickplayer().

+ Here is the call graph for this function:

◆ setBasePosition()

void PlayerSAO::setBasePosition ( v3f position)

References ServerActiveObject::m_base_position, ServerActiveObject::m_env, m_player, m_position_not_sent, ServerActiveObject::setBasePosition(), and RemotePlayer::setDirty().

Referenced by addPos(), checkMovementCheat(), PlayerDatabaseFiles::deSerialize(), PlayerDatabaseLevelDB::loadPlayer(), PlayerDatabaseSQLite3::loadPlayer(), moveTo(), Server::process_PlayerPos(), setPos(), and step().

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

◆ setBreath()

void PlayerSAO::setBreath ( const u16 breath,
bool send = true )

References ObjectProperties::breath_max, ServerEnvironment::getGameDef(), m_breath, ServerActiveObject::m_env, m_player, UnitSAO::m_prop, rangelim, Server::SendPlayerBreath(), and RemotePlayer::setDirty().

Referenced by PlayerDatabaseFiles::deSerialize(), ObjectRef::l_set_breath(), PlayerDatabaseLevelDB::loadPlayer(), PlayerDatabaseSQLite3::loadPlayer(), read_object_properties(), respawn(), and step().

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

◆ setCameraInverted()

void PlayerSAO::setCameraInverted ( bool camera_inverted)
inline

References m_camera_inverted.

Referenced by Server::process_PlayerPos().

+ Here is the caller graph for this function:

◆ setFov()

void PlayerSAO::setFov ( const float pitch)

References m_fov, m_player, and RemotePlayer::setDirty().

Referenced by Server::process_PlayerPos().

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

◆ setHP() [1/2]

void PlayerSAO::setHP ( s32 hp,
const PlayerHPChangeReason & reason )
inlineoverridevirtual

Reimplemented from ServerActiveObject.

References setHP().

Referenced by Server::handleCommand_Damage(), punch(), respawn(), setHP(), and step().

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

◆ setHP() [2/2]

void PlayerSAO::setHP ( s32 hp,
const PlayerHPChangeReason & reason,
bool from_client )

◆ setHPRaw()

void PlayerSAO::setHPRaw ( u16 hp)
inline

References UnitSAO::m_hp.

Referenced by PlayerDatabaseFiles::deSerialize(), PlayerDatabaseLevelDB::loadPlayer(), and PlayerDatabaseSQLite3::loadPlayer().

+ Here is the caller graph for this function:

◆ setInventoryModified()

void PlayerSAO::setInventoryModified ( )
inlineoverridevirtual

Reimplemented from ServerActiveObject.

◆ setLookPitch()

void PlayerSAO::setLookPitch ( const float pitch)

References m_pitch, m_player, and RemotePlayer::setDirty().

Referenced by PlayerDatabaseFiles::deSerialize(), PlayerDatabaseLevelDB::loadPlayer(), PlayerDatabaseSQLite3::loadPlayer(), Server::process_PlayerPos(), and setLookPitchAndSend().

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

◆ setLookPitchAndSend()

void PlayerSAO::setLookPitchAndSend ( const float pitch)

References ServerEnvironment::getGameDef(), ServerActiveObject::m_env, Server::SendMovePlayer(), and setLookPitch().

Referenced by ObjectRef::l_set_look_pitch(), and ObjectRef::l_set_look_vertical().

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

◆ setMaxSpeedOverride()

void PlayerSAO::setMaxSpeedOverride ( const v3f & vel)

References BS, m_max_speed_override, m_max_speed_override_time, m_player, Player::movement_acceleration_air, Player::movement_acceleration_default, and MYMIN.

Referenced by ObjectRef::l_add_velocity().

+ Here is the caller graph for this function:

◆ setPlayer()

void PlayerSAO::setPlayer ( RemotePlayer * player)
inline

References m_player.

Referenced by RemotePlayer::~RemotePlayer().

+ Here is the caller graph for this function:

◆ setPlayerYaw()

void PlayerSAO::setPlayerYaw ( const float yaw)

References m_player, UnitSAO::m_rotation, RemotePlayer::setDirty(), and UnitSAO::setRotation().

Referenced by PlayerDatabaseFiles::deSerialize(), PlayerDatabaseLevelDB::loadPlayer(), PlayerDatabaseSQLite3::loadPlayer(), Server::process_PlayerPos(), and setPlayerYawAndSend().

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

◆ setPlayerYawAndSend()

void PlayerSAO::setPlayerYawAndSend ( const float yaw)

References ServerEnvironment::getGameDef(), ServerActiveObject::m_env, Server::SendMovePlayer(), and setPlayerYaw().

Referenced by ObjectRef::l_set_look_horizontal(), and ObjectRef::l_set_look_yaw().

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

◆ setPos()

void PlayerSAO::setPos ( const v3f & pos)
overridevirtual

Reimplemented from ServerActiveObject.

References LagPool::empty(), ServerActiveObject::getBasePosition(), ServerEnvironment::getGameDef(), getPeerID(), UnitSAO::isAttached(), ServerActiveObject::m_env, m_last_good_position, m_move_pool, m_time_from_last_teleport, MAP_BLOCKSIZE, Server::SendBlock(), Server::SendMovePlayer(), and setBasePosition().

Referenced by addPos(), respawn(), and step().

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

◆ setWantedRange()

void PlayerSAO::setWantedRange ( const s16 range)

References m_player, m_wanted_range, and RemotePlayer::setDirty().

Referenced by Server::process_PlayerPos().

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

◆ setWieldedItem()

bool PlayerSAO::setWieldedItem ( const ItemStack & item)
overridevirtual

Reimplemented from ServerActiveObject.

References InventoryList::changeItem(), Inventory::getList(), Player::getWieldIndex(), getWieldList(), Player::inventory, and m_player.

Referenced by Server::handleCommand_Interact().

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

◆ shouldUnload()

bool PlayerSAO::shouldUnload ( ) const
inlineoverridevirtual

Reimplemented from ServerActiveObject.

◆ step()

void PlayerSAO::step ( float dtime,
bool send_recommended )
overridevirtual

Reimplemented from ServerActiveObject.

References LagPool::add(), ObjectProperties::breath_max, BS, ActiveObject::clearParentAttachment(), ObjectProperties::collisionbox, CONTENT_IGNORE, ContentFeatures::damage_per_second, PlayerHPChangeReason::DROWNING, ContentFeatures::drowning, floatToInt(), generateUpdatePhysicsOverrideCommand(), UnitSAO::generateUpdatePositionCommand(), NodeDefManager::get(), MapNode::getContent(), getEyePosition(), ServerEnvironment::getGameDef(), ActiveObject::getId(), ServerEnvironment::getMap(), ServerEnvironment::getMaxLagEstimate(), Map::getNode(), UnitSAO::getParent(), getPropertyPacket(), ServerEnvironment::getScriptIface(), ServerEnvironment::getSendRecommendedInterval(), UnitSAO::isAttached(), UnitSAO::isImmortal(), UnitSAO::m_attachment_parent_id, ServerActiveObject::m_base_position, m_breath, m_breathing_interval, m_dig_pool, m_drowning_interval, ServerActiveObject::m_env, m_flags, UnitSAO::m_hp, ActiveObject::m_id, m_last_good_position, m_max_speed_override_time, ServerActiveObject::m_messages_out, m_move_pool, m_nocheat_dig_time, m_node_hurt_interval, m_physics_override_sent, m_player, m_position_not_sent, UnitSAO::m_prop, UnitSAO::m_properties_sent, UnitSAO::m_rotation, m_time_from_last_punch, m_time_from_last_teleport, MYMAX, ContentFeatures::name, IGameDef::ndef(), PlayerHPChangeReason::NODE_DAMAGE, p(), ScriptApiEnv::player_event(), UnitSAO::sendOutdatedData(), setBasePosition(), setBreath(), setHP(), LagPool::setMax(), setPos(), Player::setSpeed(), IntervalLimiter::step(), and warningstream.

+ Here is the call graph for this function:

◆ unlinkPlayerSessionAndSave()

void PlayerSAO::unlinkPlayerSessionAndSave ( )
private

References RemotePlayer::getPlayerSAO(), ServerActiveObject::m_env, m_player, ServerEnvironment::removePlayer(), and ServerEnvironment::savePlayer().

Referenced by removingFromEnvironment().

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

◆ updatePrivileges()

void PlayerSAO::updatePrivileges ( const std::set< std::string > & privs,
bool is_singleplayer )
inline

References m_is_singleplayer, and m_privs.

Referenced by Server::reportPrivsModified().

+ Here is the caller graph for this function:

Member Data Documentation

◆ breathing

bool PlayerSAO::breathing

◆ drowning

bool PlayerSAO::drowning

◆ m_breath

u16 PlayerSAO::m_breath = PLAYER_MAX_BREATH_DEFAULT
private

Referenced by PlayerSAO(), getBreath(), setBreath(), and step().

◆ m_breathing_interval

IntervalLimiter PlayerSAO::m_breathing_interval
private

Referenced by step().

◆ m_camera_inverted

bool PlayerSAO::m_camera_inverted = false
private

◆ m_dig_pool

LagPool PlayerSAO::m_dig_pool
private

Referenced by getDigPool(), and step().

◆ m_drowning_interval

IntervalLimiter PlayerSAO::m_drowning_interval
private

Referenced by step().

◆ [struct]

struct { ... } PlayerSAO::m_flags

Referenced by step().

◆ m_fov

f32 PlayerSAO::m_fov = 0.0f
private

Referenced by getFov(), and setFov().

◆ m_is_singleplayer

bool PlayerSAO::m_is_singleplayer
private

◆ m_last_good_position

v3f PlayerSAO::m_last_good_position
private

◆ m_max_speed_override

v3f PlayerSAO::m_max_speed_override = v3f(0.0f, 0.0f, 0.0f)
private

◆ m_max_speed_override_time

float PlayerSAO::m_max_speed_override_time = 0.0f
private

◆ m_meta

SimpleMetadata PlayerSAO::m_meta
private

Referenced by getMeta().

◆ m_move_pool

LagPool PlayerSAO::m_move_pool
private

◆ m_nocheat_dig_pos

v3s16 PlayerSAO::m_nocheat_dig_pos = v3s16(32767, 32767, 32767)
private

◆ m_nocheat_dig_time

float PlayerSAO::m_nocheat_dig_time = 0.0f
private

◆ m_node_hurt_interval

IntervalLimiter PlayerSAO::m_node_hurt_interval
private

Referenced by step().

◆ m_peer_id_initial

session_t PlayerSAO::m_peer_id_initial = 0
private

only used to initialize RemotePlayer

Referenced by PlayerSAO(), and addedToEnvironment().

◆ m_physics_override_sent

bool PlayerSAO::m_physics_override_sent = false

◆ m_pitch

f32 PlayerSAO::m_pitch = 0.0f
private

◆ m_player

◆ m_position_not_sent

bool PlayerSAO::m_position_not_sent = false
private

Referenced by setBasePosition(), and step().

◆ m_privs

std::set<std::string> PlayerSAO::m_privs
private

◆ m_time_from_last_punch

float PlayerSAO::m_time_from_last_punch = 0.0f
private

Referenced by resetTimeFromLastPunch(), and step().

◆ m_time_from_last_teleport

float PlayerSAO::m_time_from_last_teleport = 0.0f
private

◆ m_wanted_range

s16 PlayerSAO::m_wanted_range = 0.0f
private

Referenced by getWantedRange(), and setWantedRange().

◆ node_damage

bool PlayerSAO::node_damage

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