Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
Player Class Referenceabstract

#include <player.h>

+ Inheritance diagram for Player:
+ Collaboration diagram for Player:

Public Member Functions

 Player (const std::string &name, IItemDefManager *idef)
 
virtual ~Player ()=0
 
 DISABLE_CLASS_COPY (Player)
 
void setSpeed (v3f speed)
 
v3f getSpeed () const
 
const std::string & getName () const
 
u32 getFreeHudID ()
 
const PlayerControlgetPlayerControl ()
 
ItemStackgetWieldedItem (ItemStack *selected, ItemStack *hand) const
 
void setWieldIndex (u16 index)
 
u16 getWieldIndex ()
 
bool setFov (const PlayerFovSpec &spec)
 
const PlayerFovSpecgetFov () const
 
HudElementgetHud (u32 id)
 
void hudApply (std::function< void(const std::vector< HudElement * > &)> f)
 
u32 addHud (HudElement *hud)
 
HudElementremoveHud (u32 id)
 
void clearHud ()
 
u16 getMaxHotbarItemcount ()
 

Public Attributes

v3f eye_offset_first
 
v3f eye_offset_third
 
v3f eye_offset_third_front
 
Inventory inventory
 
f32 movement_acceleration_default
 
f32 movement_acceleration_air
 
f32 movement_acceleration_fast
 
f32 movement_speed_walk
 
f32 movement_speed_crouch
 
f32 movement_speed_fast
 
f32 movement_speed_climb
 
f32 movement_speed_jump
 
f32 movement_liquid_fluidity
 
f32 movement_liquid_fluidity_smooth
 
f32 movement_liquid_sink
 
f32 movement_gravity
 
v2f local_animations [4]
 
float local_animation_speed
 
std::string inventory_formspec
 
std::string formspec_prepend
 
PlayerControl control
 
PlayerPhysicsOverride physics_override
 
u32 hud_flags
 
s32 hud_hotbar_itemcount
 

Protected Attributes

std::string m_name
 
v3f m_speed
 
u16 m_wield_index = 0
 
PlayerFovSpec m_fov_override_spec = { 0.0f, false, 0.0f }
 
std::vector< HudElement * > hud
 

Private Attributes

std::mutex m_mutex
 

Constructor & Destructor Documentation

◆ Player()

◆ ~Player()

Player::~Player ( )
pure virtual

References clearHud().

+ Here is the call graph for this function:

Member Function Documentation

◆ addHud()

u32 Player::addHud ( HudElement * hud)

References getFreeHudID(), hud, and m_mutex.

Referenced by Game::handleClientEvent_HudAdd(), Server::hudAdd(), and LuaLocalPlayer::l_hud_add().

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

◆ clearHud()

void Player::clearHud ( )

References hud, and m_mutex.

Referenced by ~Player(), and ServerEnvironment::loadPlayer().

+ Here is the caller graph for this function:

◆ DISABLE_CLASS_COPY()

Player::DISABLE_CLASS_COPY ( Player )

◆ getFov()

const PlayerFovSpec & Player::getFov ( ) const
inline

References m_fov_override_spec.

Referenced by Game::checkZoomEnabled(), ObjectRef::l_get_fov(), Camera::notifyFovChange(), and Server::SendPlayerFov().

+ Here is the caller graph for this function:

◆ getFreeHudID()

u32 Player::getFreeHudID ( )
inline

References hud.

Referenced by addHud().

+ Here is the caller graph for this function:

◆ getHud()

HudElement * Player::getHud ( u32 id)

References hud, and m_mutex.

Referenced by Hud::drawLuaElements(), Game::handleClientEvent_HudChange(), Hud::hasElementOfType(), LuaLocalPlayer::l_hud_change(), ObjectRef::l_hud_change(), LuaLocalPlayer::l_hud_get(), and ObjectRef::l_hud_get().

+ Here is the caller graph for this function:

◆ getMaxHotbarItemcount()

u16 Player::getMaxHotbarItemcount ( )

References Inventory::getList(), InventoryList::getSize(), hud_hotbar_itemcount, and inventory.

Referenced by Hud::drawHotbar(), getWieldIndex(), Server::handleCommand_Interact(), Server::handleCommand_PlayerItem(), ObjectRef::l_hud_get_hotbar_itemcount(), and Game::processItemSelection().

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

◆ getName()

const std::string & Player::getName ( ) const
inline

References m_name.

Referenced by ServerEnvironment::addPlayer(), Server::checkInteractDistance(), PlayerSAO::checkMovementCheat(), Server::DeleteClient(), Server::emergePlayer(), ServerEnvironment::getAddedActiveObjects(), PlayerSAO::getClientInitializationData(), PlayerSAO::getDescription(), Client::getInventory(), PlayerSAO::getInventoryLocation(), Server::getPlayerName(), ServerEnvironment::getRemovedActiveObjects(), Server::handleCommand_ChatMessage(), Server::handleCommand_ClientReady(), Server::handleCommand_Damage(), Server::handleCommand_Interact(), Server::handleCommand_InventoryAction(), Server::handleCommand_InventoryFields(), Server::handleCommand_NodeMetaFields(), Server::handleCommand_PlayerItem(), Server::handleCommand_PlayerPos(), Server::HandlePlayerDeath(), ObjectRef::l_get_meta(), LuaLocalPlayer::l_get_name(), ObjectRef::l_get_player_name(), ObjectRef::l_set_formspec_prepend(), ObjectRef::l_set_inventory_formspec(), ObjectRef::l_set_observers(), PlayerDatabaseFiles::listPlayers(), Database_Dummy::loadPlayer(), PlayerDatabaseFiles::loadPlayer(), PlayerDatabaseLevelDB::loadPlayer(), PlayerDatabaseSQLite3::loadPlayer(), ServerEnvironment::loadPlayer(), Server::playSound(), GenericCAO::processInitData(), PlayerDatabaseFiles::removePlayer(), Server::reportPrivsModified(), PlayerSAO::respawn(), Database_Dummy::savePlayer(), PlayerDatabaseFiles::savePlayer(), PlayerDatabaseLevelDB::savePlayer(), PlayerDatabaseSQLite3::savePlayer(), ServerEnvironment::savePlayer(), Server::SendPlayerPrivileges(), Server::StageTwoClientInit(), Client::startAuth(), Client::step(), Server::UpdateCrafting(), and ClientInterface::UpdatePlayerList().

◆ getPlayerControl()

const PlayerControl & Player::getPlayerControl ( )
inline

References control.

Referenced by LuaLocalPlayer::l_get_control(), ObjectRef::l_get_player_control(), ObjectRef::l_get_player_control_bits(), GenericCAO::step(), and Camera::update().

+ Here is the caller graph for this function:

◆ getSpeed()

v3f Player::getSpeed ( ) const
inline

References m_speed.

Referenced by LocalPlayer::applyControl(), RemoteClient::GetNextBlocks(), LuaLocalPlayer::l_get_velocity(), ObjectRef::l_get_velocity(), LocalPlayer::move(), LocalPlayer::old_move(), Client::sendPlayerPos(), ClientEnvironment::step(), Camera::update(), Game::updateSound(), and writePlayerPos().

+ Here is the caller graph for this function:

◆ getWieldedItem()

ItemStack & Player::getWieldedItem ( ItemStack * selected,
ItemStack * hand ) const

References InventoryList::getItem(), Inventory::getList(), inventory, m_wield_index, and ItemStack::name.

Referenced by Server::checkInteractDistance(), PlayerSAO::getWieldedItem(), Server::handleCommand_Interact(), LuaLocalPlayer::l_get_wielded_item(), Game::processPlayerInteraction(), Game::updateCamera(), and Game::updateFrame().

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

◆ getWieldIndex()

u16 Player::getWieldIndex ( )

References getMaxHotbarItemcount(), and m_wield_index.

Referenced by Hud::drawHotbar(), PlayerSAO::getWieldIndex(), Client::interact(), LuaLocalPlayer::l_get_wield_index(), Game::processItemSelection(), PlayerSAO::setWieldedItem(), and Game::updateFrame().

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

◆ hudApply()

void Player::hudApply ( std::function< void(const std::vector< HudElement * > &)> f)

References hud, and m_mutex.

Referenced by LuaLocalPlayer::l_hud_get_all(), and ObjectRef::l_hud_get_all().

+ Here is the caller graph for this function:

◆ removeHud()

HudElement * Player::removeHud ( u32 id)

References hud, and m_mutex.

Referenced by Game::handleClientEvent_HudRemove(), Server::hudRemove(), and LuaLocalPlayer::l_hud_remove().

+ Here is the caller graph for this function:

◆ setFov()

bool Player::setFov ( const PlayerFovSpec & spec)
inline

References m_fov_override_spec.

Referenced by Client::handleCommand_Fov(), and ObjectRef::l_set_fov().

+ Here is the caller graph for this function:

◆ setSpeed()

void Player::setSpeed ( v3f speed)
inline

References m_speed.

Referenced by LocalPlayer::applyControl(), LocalPlayer::move(), LocalPlayer::old_move(), Server::process_PlayerPos(), ClientEnvironment::step(), and PlayerSAO::step().

+ Here is the caller graph for this function:

◆ setWieldIndex()

void Player::setWieldIndex ( u16 index)

References Inventory::getList(), InventoryList::getSize(), inventory, m_wield_index, and MYMIN.

Referenced by Server::handleCommand_Interact(), Server::handleCommand_PlayerItem(), and Client::setPlayerItem().

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

Member Data Documentation

◆ control

◆ eye_offset_first

◆ eye_offset_third

◆ eye_offset_third_front

◆ formspec_prepend

◆ hud

std::vector<HudElement *> Player::hud
protected

◆ hud_flags

◆ hud_hotbar_itemcount

◆ inventory

◆ inventory_formspec

◆ local_animation_speed

◆ local_animations

◆ m_fov_override_spec

PlayerFovSpec Player::m_fov_override_spec = { 0.0f, false, 0.0f }
protected

Referenced by getFov(), and setFov().

◆ m_mutex

std::mutex Player::m_mutex
private

◆ m_name

std::string Player::m_name
protected

◆ m_speed

◆ m_wield_index

u16 Player::m_wield_index = 0
protected

◆ movement_acceleration_air

◆ movement_acceleration_default

◆ movement_acceleration_fast

◆ movement_gravity

◆ movement_liquid_fluidity

◆ movement_liquid_fluidity_smooth

◆ movement_liquid_sink

◆ movement_speed_climb

◆ movement_speed_crouch

◆ movement_speed_fast

◆ movement_speed_jump

◆ movement_speed_walk

◆ physics_override


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