Luanti 5.19.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
const PlayerControl & getPlayerControl ()
ItemStack & getWieldedItem (ItemStack *selected, ItemStack *hand) const
void setWieldIndex (u16 index)
u16 getWieldIndex ()
bool setFov (const PlayerFovSpec &spec)
const PlayerFovSpec & getFov () const
u16 getMaxHotbarItemcount ()

Public Attributes

CameraMode allowed_camera_mode = CAMERA_MODE_ANY
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
std::array< v2f,(size_t) LocalPlayerAnimation::COUNT > local_animations
 Animation frame ranges for different local player animation "states".
float local_animation_speed
std::string inventory_formspec
std::string formspec_prepend
PlayerControl control
PlayerPhysicsOverride physics_override
PlayerHud hud
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 }

Constructor & Destructor Documentation

◆ Player()

◆ ~Player()

Player::~Player ( )
pure virtual

Member Function Documentation

◆ DISABLE_CLASS_COPY()

Player::DISABLE_CLASS_COPY ( Player )

References Player().

Here is the call graph for this function:

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

◆ 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(), PlayerDatabaseFiles::deSerialize(), 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::SendAddParticleSpawner(), Server::SendPlayerPrivileges(), PlayerDatabaseFiles::serialize(), 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:

◆ 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

◆ allowed_camera_mode

◆ control

◆ eye_offset_first

◆ eye_offset_third

◆ eye_offset_third_front

◆ formspec_prepend

◆ hud

◆ hud_flags

◆ hud_hotbar_itemcount

◆ inventory

◆ inventory_formspec

◆ local_animation_speed

◆ local_animations

std::array<v2f, (size_t) LocalPlayerAnimation::COUNT> Player::local_animations

Animation frame ranges for different local player animation "states".

Note
Frames are into the first animation track of a model.
A range of [0, 0] is used to denote an absent local animation.

Referenced by GenericCAO::applyTrackAnimation(), RemotePlayer::getLocalAnimations(), Client::handleCommand_LocalPlayerAnimations(), RemotePlayer::setLocalAnimations(), and GenericCAO::setLocalPlayerAnimation().

◆ m_fov_override_spec

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

Referenced by getFov(), and setFov().

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