Minetest  5.4.0
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
 
ActiveObjectType getSendType () const
 
std::string getDescription ()
 
void addedToEnvironment (u32 dtime_s)
 
void removingFromEnvironment ()
 
bool isStaticAllowed () const
 
bool shouldUnload () const
 
std::string getClientInitializationData (u16 protocol_version)
 
void getStaticData (std::string *result) const
 
void step (float dtime, bool send_recommended)
 
void setBasePosition (const v3f &position)
 
void setPos (const v3f &pos)
 
void moveTo (v3f pos, bool continuous)
 
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
 
u16 punch (v3f dir, const ToolCapabilities *toolcap, ServerActiveObject *puncher, float time_from_last_punch)
 
void rightClick (ServerActiveObject *clicker)
 
void setHP (s32 hp, const PlayerHPChangeReason &reason)
 
void setHPRaw (u16 hp)
 
u16 getBreath () const
 
void setBreath (const u16 breath, bool send=true)
 
InventorygetInventory () const
 
InventoryLocation getInventoryLocation () const
 
void setInventoryModified ()
 
std::string getWieldList () const
 
u16 getWieldIndex () const
 
ItemStack getWieldedItem (ItemStack *selected, ItemStack *hand=nullptr) const
 
bool setWieldedItem (const ItemStack &item)
 
void disconnected ()
 
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
 
bool getSelectionBox (aabb3f *toset) const
 
bool collideWithObjects () const
 
void finalize (RemotePlayer *player, const std::set< std::string > &privs)
 
v3f getEyePosition () const
 
v3f getEyeOffset () const
 
float getZoomFOV () const
 
MetadatagetMeta ()
 
- Public Member Functions inherited from UnitSAO
 UnitSAO (ServerEnvironment *env, v3f pos)
 
virtual ~UnitSAO ()=default
 
u16 getHP () const
 
bool isDead () const
 
void setRotation (v3f rotation)
 
const v3fgetRotation () const
 
v3f getRadRotation ()
 
f32 getRadYawDep () const
 
bool isImmortal () const
 
void setArmorGroups (const ItemGroupList &armor_groups)
 
const ItemGroupListgetArmorGroups () 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)
 
ServerActiveObjectgetParent () 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
 
ObjectPropertiesaccessObjectProperties ()
 
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 bool environmentDeletes () const
 
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
 
- Public Member Functions inherited from ActiveObject
 ActiveObject (u16 id)
 
u16 getId () const
 
void setId (u16 id)
 

Public Attributes

float m_physics_override_speed = 1.0f
 
float m_physics_override_jump = 1.0f
 
float m_physics_override_gravity = 1.0f
 
bool m_physics_override_sneak = true
 
bool m_physics_override_sneak_glitch = false
 
bool m_physics_override_new_move = 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)
 

Private Member Functions

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

Private Attributes

RemotePlayerm_player = nullptr
 
session_t m_peer_id = 0
 
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
 
Metadata m_meta
 

Additional Inherited Members

- 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 generateUpdateBonePositionCommand (const std::string &bone, const v3f &position, const v3f &rotation)
 
- Static Public Member Functions inherited from ServerActiveObject
static ServerActiveObjectcreate (ActiveObjectType type, ServerEnvironment *env, u16 id, v3f pos, const std::string &data)
 
- Protected Member Functions inherited from ServerActiveObject
virtual void onMarkedForDeactivation ()
 
virtual void onMarkedForRemoval ()
 
- Protected Attributes inherited from UnitSAO
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
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

◆ PlayerSAO()

Member Function Documentation

◆ addedToEnvironment()

void PlayerSAO::addedToEnvironment ( u32  dtime_s)
virtual

Reimplemented from ServerActiveObject.

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

+ Here is the call graph for this function:

◆ checkMovementCheat()

bool PlayerSAO::checkMovementCheat ( )

References actionstream, g_settings, Settings::getBool(), ServerEnvironment::getMaxLagEstimate(), Player::getName(), LagPool::grab(), UnitSAO::isAttached(), ServerActiveObject::m_base_position, ServerActiveObject::m_env, m_is_singleplayer, m_last_good_position, m_max_speed_override, m_max_speed_override_time, m_move_pool, m_physics_override_jump, m_physics_override_speed, m_player, m_privs, m_time_from_last_teleport, Player::movement_speed_fast, Player::movement_speed_jump, Player::movement_speed_walk, MYMAX, and setBasePosition().

Referenced by Server::process_PlayerPos().

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

◆ collideWithObjects()

bool PlayerSAO::collideWithObjects ( ) const
inlinevirtual

Implements ActiveObject.

◆ disconnected()

void PlayerSAO::disconnected ( )

References m_peer_id, ServerActiveObject::markForRemoval(), and PEER_ID_INEXISTENT.

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_physics_override_gravity, m_physics_override_jump, m_physics_override_new_move, m_physics_override_sneak, m_physics_override_sneak_glitch, m_physics_override_speed, 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:

◆ getClientInitializationData()

◆ getCollisionBox()

bool PlayerSAO::getCollisionBox ( aabb3f toset) const
virtual

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 ( )
virtual

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
virtual

Reimplemented from ServerActiveObject.

References Player::inventory, and m_player.

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

+ Here is the caller graph for this function:

◆ getInventoryLocation()

InventoryLocation PlayerSAO::getInventoryLocation ( ) const
virtual

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()

Metadata& 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
inline

References m_peer_id.

Referenced by ObjectRef::l_add_velocity(), Server::SendInventory(), Server::SendPlayerBreath(), and Server::SendPlayerHPOrDie().

+ Here is the caller graph for this function:

◆ getPlayer()

RemotePlayer* PlayerSAO::getPlayer ( )
inline

References m_player.

Referenced by Server::DiePlayer(), ObjectRef::getplayer(), Server::handleCommand_ClientReady(), Server::handleCommand_Interact(), Server::handleCommand_PlayerItem(), PlayerDatabaseSQLite3::loadPlayer(), Server::RespawnPlayer(), and Server::SendInventory().

+ Here is the caller graph for this function:

◆ 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
virtual

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, ObjectProperties::pointable, and ObjectProperties::selectionbox.

◆ getSendType()

ActiveObjectType PlayerSAO::getSendType ( ) const
inlinevirtual

Reimplemented from ServerActiveObject.

References ACTIVEOBJECT_TYPE_GENERIC.

◆ getStaticData()

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

Reimplemented from ServerActiveObject.

References FATAL_ERROR.

◆ getType()

ActiveObjectType PlayerSAO::getType ( ) const
inlinevirtual

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
virtual

Reimplemented from ServerActiveObject.

References Player::getWieldedItem(), and m_player.

Referenced by Server::handleCommand_Interact().

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

◆ getWieldIndex()

u16 PlayerSAO::getWieldIndex ( ) const
virtual

Reimplemented from ServerActiveObject.

References Player::getWieldIndex(), and m_player.

+ Here is the call graph for this function:

◆ getWieldList()

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

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
inlinevirtual

Reimplemented from ServerActiveObject.

◆ moveTo()

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

Reimplemented from ServerActiveObject.

References LagPool::empty(), ServerEnvironment::getGameDef(), UnitSAO::isAttached(), ServerActiveObject::m_env, m_last_good_position, m_move_pool, m_peer_id, 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 ( )
virtual

Reimplemented from ServerActiveObject.

References ServerEnvironment::deleteParticleSpawner(), RemotePlayer::getPlayerSAO(), ServerActiveObject::m_attached_particle_spawners, ServerActiveObject::m_env, m_player, ServerActiveObject::removingFromEnvironment(), 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:

◆ rightClick()

void PlayerSAO::rightClick ( ServerActiveObject clicker)
virtual

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 ( const v3f position)

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

Referenced by checkMovementCheat(), PlayerDatabaseFiles::deSerialize(), ServerEnvironment::loadPlayer(), 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(), Server::RespawnPlayer(), and step().

+ Here is the call graph for this function:
+ 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()

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

Reimplemented from ServerActiveObject.

References ServerEnvironment::getScriptIface(), ObjectProperties::hp_max, UnitSAO::isImmortal(), ServerActiveObject::m_env, UnitSAO::m_hp, UnitSAO::m_prop, UnitSAO::m_properties_sent, ScriptApiPlayer::on_player_hpchange(), and rangelim.

Referenced by Server::DiePlayer(), Server::handleCommand_Damage(), punch(), Server::RespawnPlayer(), and step().

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

◆ 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 ( )
inlinevirtual

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, m_peer_id, 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:

◆ 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, m_peer_id, 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)
virtual

Reimplemented from ServerActiveObject.

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

Referenced by Server::RespawnPlayer().

+ 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)
virtual

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
inlinevirtual

Reimplemented from ServerActiveObject.

◆ step()

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

Reimplemented from ServerActiveObject.

References LagPool::add(), ObjectProperties::breath_max, BS, UnitSAO::clearParentAttachment(), ObjectProperties::collisionbox, CONTENT_IGNORE, ContentFeatures::damage_per_second, ContentFeatures::drowning, PlayerHPChangeReason::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, 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_peer_id, 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(), Server::SendMovePlayer(), UnitSAO::sendOutdatedData(), Server::SendPlayerHPOrDie(), setBasePosition(), setBreath(), setHP(), LagPool::setMax(), 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, PEER_ID_INEXISTENT, ServerEnvironment::removePlayer(), ServerEnvironment::savePlayer(), RemotePlayer::setPeerId(), and RemotePlayer::setPlayerSAO().

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

◆ 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_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().

◆ 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

Metadata 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

◆ m_physics_override_gravity

float PlayerSAO::m_physics_override_gravity = 1.0f

◆ m_physics_override_jump

◆ m_physics_override_new_move

bool PlayerSAO::m_physics_override_new_move = true

◆ m_physics_override_sent

bool PlayerSAO::m_physics_override_sent = false

◆ m_physics_override_sneak

bool PlayerSAO::m_physics_override_sneak = true

◆ m_physics_override_sneak_glitch

bool PlayerSAO::m_physics_override_sneak_glitch = false

◆ m_physics_override_speed

◆ 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().


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