diff options
-rw-r--r-- | source/Entities/Player.cpp | 7 | ||||
-rw-r--r-- | source/Entities/Player.h | 15 |
2 files changed, 11 insertions, 11 deletions
diff --git a/source/Entities/Player.cpp b/source/Entities/Player.cpp index e06281998..f92d42556 100644 --- a/source/Entities/Player.cpp +++ b/source/Entities/Player.cpp @@ -349,11 +349,8 @@ void cPlayer::SetTouchGround(bool a_bTouchGround) void cPlayer::Heal(int a_Health) { - if (m_Health < GetMaxHealth()) - { - m_Health = (short)std::min((int)a_Health + m_Health, (int)GetMaxHealth()); - SendHealth(); - } + super::Heal(a_Health); + SendHealth(); } diff --git a/source/Entities/Player.h b/source/Entities/Player.h index 82ff48954..067a996e5 100644 --- a/source/Entities/Player.h +++ b/source/Entities/Player.h @@ -167,13 +167,15 @@ public: StringList GetResolvedPermissions(); // >> EXPORTED IN MANUALBINDINGS << bool IsInGroup( const AString & a_Group ); // tolua_export - AString GetColor(void) const; // tolua_export + // tolua_begin + + /// Returns the full color code to use for this player, based on their primary group or set in m_Color + AString GetColor(void) const; - void TossItem(bool a_bDraggingItem, char a_Amount = 1, short a_CreateType = 0, short a_CreateHealth = 0); // tolua_export + void TossItem(bool a_bDraggingItem, char a_Amount = 1, short a_CreateType = 0, short a_CreateHealth = 0); - void Heal( int a_Health ); // tolua_export - - // tolua_begin + /// Heals the player by the specified amount of HPs (positive only); sends health update + void Heal(int a_Health); int GetFoodLevel (void) const { return m_FoodLevel; } double GetFoodSaturationLevel (void) const { return m_FoodSaturationLevel; } @@ -181,7 +183,7 @@ public: double GetFoodExhaustionLevel (void) const { return m_FoodExhaustionLevel; } int GetFoodPoisonedTicksRemaining(void) const { return m_FoodPoisonedTicksRemaining; } - int GetAirLevel (void) const { return m_AirLevel; } + int GetAirLevel (void) const { return m_AirLevel; } /// Returns true if the player is satiated, i. e. their foodlevel is at the max and they cannot eat anymore bool IsSatiated(void) const { return (m_FoodLevel >= MAX_FOOD_LEVEL); } @@ -302,6 +304,7 @@ protected: /// Player's air level (for swimming) int m_AirLevel; + /// used to time ticks between damage taken via drowning/suffocation int m_AirTickTimer; |