More cProtocol cleanup
* Alpha sort functions * Simplify hand handling * Fix left handed mode client-side display
This commit is contained in:
@@ -123,6 +123,7 @@ cPlayer::cPlayer(const std::shared_ptr<cClientHandle> & a_Client) :
|
||||
m_IsFlightCapable(false),
|
||||
m_IsFlying(false),
|
||||
m_IsFrozen(false),
|
||||
m_IsLeftHanded(false),
|
||||
m_IsTeleporting(false),
|
||||
m_IsVisible(true),
|
||||
m_EatingFinishTick(-1),
|
||||
@@ -132,8 +133,7 @@ cPlayer::cPlayer(const std::shared_ptr<cClientHandle> & a_Client) :
|
||||
m_FloaterID(cEntity::INVALID_ID),
|
||||
m_Team(nullptr),
|
||||
m_TicksUntilNextSave(PLAYER_INVENTORY_SAVE_INTERVAL),
|
||||
m_SkinParts(0),
|
||||
m_MainHand(mhRight)
|
||||
m_SkinParts(0)
|
||||
{
|
||||
ASSERT(GetName().length() <= 16); // Otherwise this player could crash many clients...
|
||||
|
||||
@@ -449,6 +449,15 @@ bool cPlayer::IsInBed(void) const
|
||||
|
||||
|
||||
|
||||
bool cPlayer::IsLeftHanded() const
|
||||
{
|
||||
return m_IsLeftHanded;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cPlayer::IsStanding() const
|
||||
{
|
||||
return std::holds_alternative<BodyStanceStanding>(m_BodyStance);
|
||||
@@ -692,6 +701,16 @@ void cPlayer::SetFlying(const bool a_ShouldFly)
|
||||
|
||||
|
||||
|
||||
void cPlayer::SetLeftHanded(const bool a_IsLeftHanded)
|
||||
{
|
||||
m_IsLeftHanded = a_IsLeftHanded;
|
||||
m_World->BroadcastEntityMetadata(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cPlayer::SetSprint(const bool a_ShouldSprint)
|
||||
{
|
||||
if (a_ShouldSprint && IsStanding())
|
||||
@@ -2544,16 +2563,6 @@ void cPlayer::SetSkinParts(int a_Parts)
|
||||
|
||||
|
||||
|
||||
void cPlayer::SetMainHand(eMainHand a_Hand)
|
||||
{
|
||||
m_MainHand = a_Hand;
|
||||
m_World->BroadcastEntityMetadata(*this, m_ClientHandle.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cPlayer::AttachTo(cEntity * a_AttachTo)
|
||||
{
|
||||
// Different attach, if this is a spectator
|
||||
|
||||
Reference in New Issue
Block a user