diff options
author | Mattes D <github@xoft.cz> | 2014-07-17 11:23:09 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-07-17 11:23:09 +0200 |
commit | ec77cf1b06c3008a3c9046a6e0b6a85b0629dba4 (patch) | |
tree | e2a6e048422755b6a5b04c0fbe3afd0bfbf1c700 /src/Entities/Player.cpp | |
parent | Merge pull request #1193 from mc-server/deathmessages (diff) | |
parent | Fixed 3 MSVC warnings in SplashPotionEntity. (diff) | |
download | cuberite-ec77cf1b06c3008a3c9046a6e0b6a85b0629dba4.tar cuberite-ec77cf1b06c3008a3c9046a6e0b6a85b0629dba4.tar.gz cuberite-ec77cf1b06c3008a3c9046a6e0b6a85b0629dba4.tar.bz2 cuberite-ec77cf1b06c3008a3c9046a6e0b6a85b0629dba4.tar.lz cuberite-ec77cf1b06c3008a3c9046a6e0b6a85b0629dba4.tar.xz cuberite-ec77cf1b06c3008a3c9046a6e0b6a85b0629dba4.tar.zst cuberite-ec77cf1b06c3008a3c9046a6e0b6a85b0629dba4.zip |
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r-- | src/Entities/Player.cpp | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index c9533d3ac..da50843b6 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -41,7 +41,6 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) : m_FoodSaturationLevel(5.0), m_FoodTickTimer(0), m_FoodExhaustionLevel(0.0), - m_FoodPoisonedTicksRemaining(0), m_LastJumpHeight(0), m_LastGroundHeight(0), m_bTouchGround(false), @@ -563,18 +562,9 @@ void cPlayer::SetFoodExhaustionLevel(double a_FoodExhaustionLevel) -void cPlayer::SetFoodPoisonedTicksRemaining(int a_FoodPoisonedTicksRemaining) -{ - m_FoodPoisonedTicksRemaining = a_FoodPoisonedTicksRemaining; -} - - - - - bool cPlayer::Feed(int a_Food, double a_Saturation) { - if (m_FoodLevel >= MAX_FOOD_LEVEL) + if (IsSatiated()) { return false; } @@ -590,17 +580,7 @@ bool cPlayer::Feed(int a_Food, double a_Saturation) void cPlayer::FoodPoison(int a_NumTicks) { - bool HasBeenFoodPoisoned = (m_FoodPoisonedTicksRemaining > 0); - m_FoodPoisonedTicksRemaining = std::max(m_FoodPoisonedTicksRemaining, a_NumTicks); - if (!HasBeenFoodPoisoned) - { - m_World->BroadcastRemoveEntityEffect(*this, E_EFFECT_HUNGER); - SendHealth(); - } - else - { - m_World->BroadcastEntityEffect(*this, E_EFFECT_HUNGER, 0, 400); // Give the player the "Hunger" effect for 20 seconds. - } + AddEntityEffect(cEntityEffect::effHunger, a_NumTicks, 0, NULL); } @@ -2015,17 +1995,6 @@ void cPlayer::HandleFood(void) } } - // Apply food poisoning food exhaustion: - if (m_FoodPoisonedTicksRemaining > 0) - { - m_FoodPoisonedTicksRemaining--; - m_FoodExhaustionLevel += 0.025; // 0.5 per second = 0.025 per tick - } - else - { - m_World->BroadcastRemoveEntityEffect(*this, E_EFFECT_HUNGER); // Remove the "Hunger" effect. - } - // Apply food exhaustion that has accumulated: if (m_FoodExhaustionLevel >= 4.0) { |