mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
PlayerSAO/LocalPlayer refactor: (#4612)
* Create UnitSAO, a common part between PlayerSAO & LuaEntitySAO * Move breath to PlayerSAO & LocalPlayer * Migrate m_yaw from (Remote)Player & LuaEntitySAO to UnitSAO * Migrate m_yaw from Player to LocalPlayer for client * Move some functions outside of player class to PlayerSAO/RemotePlayer or LocalPlayer depending on which class needs it * Move pitch to LocalPlayer & PlayerSAO * Move m_position from Player to LocalPlayer * Move camera_barely_in_ceiling to LocalPlayer as it's used only there * use PlayerSAO::m_base_position for Server side positions * remove a unused variable * ServerActiveObject::setPos now uses const ref * use ServerEnv::loadPlayer unconditionnaly as it creates RemotePlayer only if it's not already loaded * Move hp from Player to LocalPlayer * Move m_hp from LuaEntitySAO to UnitSAO * Use m_hp from PlayerSAO/UnitSAO instead of RemotePlayer
This commit is contained in:
parent
d43326021a
commit
9d25242c5c
18 changed files with 353 additions and 335 deletions
|
@ -30,18 +30,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
|
||||
Player::Player(const char *name, IItemDefManager *idef):
|
||||
camera_barely_in_ceiling(false),
|
||||
inventory(idef),
|
||||
hp(PLAYER_MAX_HP),
|
||||
peer_id(PEER_ID_INEXISTENT),
|
||||
keyPressed(0),
|
||||
// protected
|
||||
m_breath(PLAYER_MAX_BREATH),
|
||||
m_pitch(0),
|
||||
m_yaw(0),
|
||||
m_speed(0,0,0),
|
||||
m_position(0,0,0),
|
||||
m_collisionbox(-BS*0.30,0.0,-BS*0.30,BS*0.30,BS*1.75,BS*0.30)
|
||||
m_speed(0,0,0)
|
||||
{
|
||||
strlcpy(m_name, name, PLAYERNAME_SIZE);
|
||||
|
||||
|
@ -90,11 +83,6 @@ Player::~Player()
|
|||
clearHud();
|
||||
}
|
||||
|
||||
v3s16 Player::getLightPosition() const
|
||||
{
|
||||
return floatToInt(m_position + v3f(0,BS+BS/2,0), BS);
|
||||
}
|
||||
|
||||
u32 Player::addHud(HudElement *toadd)
|
||||
{
|
||||
MutexAutoLock lock(m_mutex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue