summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-10-24 11:05:43 +0200
committermadmaxoft <github@xoft.cz>2013-10-24 12:24:39 +0200
commitd359c5a2fe8a0e5af849916cbd225d31919f1826 (patch)
tree952e4a9fe4f39329ada3121a12e1a403b87450d7
parentMerge pull request #286 from tigerw/pickupdelay (diff)
downloadcuberite-d359c5a2fe8a0e5af849916cbd225d31919f1826.tar
cuberite-d359c5a2fe8a0e5af849916cbd225d31919f1826.tar.gz
cuberite-d359c5a2fe8a0e5af849916cbd225d31919f1826.tar.bz2
cuberite-d359c5a2fe8a0e5af849916cbd225d31919f1826.tar.lz
cuberite-d359c5a2fe8a0e5af849916cbd225d31919f1826.tar.xz
cuberite-d359c5a2fe8a0e5af849916cbd225d31919f1826.tar.zst
cuberite-d359c5a2fe8a0e5af849916cbd225d31919f1826.zip
-rw-r--r--source/Entities/Player.cpp7
-rw-r--r--source/Entities/Player.h15
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;