summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-02 19:34:28 +0200
committermadmaxoft <github@xoft.cz>2014-05-02 19:34:28 +0200
commit839447f0bbdf97eb9b3c07f943647fa9c92b1e5b (patch)
tree3cde3e248dc73e19f3b241245fdff612842f9632 /src/Entities/Player.cpp
parentA tiny speed improvement in ApplyFoodExhaustion() (diff)
parentFixed MagmaCube spawning. (diff)
downloadcuberite-839447f0bbdf97eb9b3c07f943647fa9c92b1e5b.tar
cuberite-839447f0bbdf97eb9b3c07f943647fa9c92b1e5b.tar.gz
cuberite-839447f0bbdf97eb9b3c07f943647fa9c92b1e5b.tar.bz2
cuberite-839447f0bbdf97eb9b3c07f943647fa9c92b1e5b.tar.lz
cuberite-839447f0bbdf97eb9b3c07f943647fa9c92b1e5b.tar.xz
cuberite-839447f0bbdf97eb9b3c07f943647fa9c92b1e5b.tar.zst
cuberite-839447f0bbdf97eb9b3c07f943647fa9c92b1e5b.zip
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index b43205226..bcbf58623 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -802,14 +802,14 @@ void cPlayer::SetFlying(bool a_IsFlying)
-void cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
+bool cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
{
if ((a_TDI.DamageType != dtInVoid) && (a_TDI.DamageType != dtPlugin))
{
if (IsGameModeCreative())
{
// No damage / health in creative mode if not void or plugin damage
- return;
+ return false;
}
}
@@ -822,17 +822,19 @@ void cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
if (!m_Team->AllowsFriendlyFire())
{
// Friendly fire is disabled
- return;
+ return false;
}
}
}
- super::DoTakeDamage(a_TDI);
-
- // Any kind of damage adds food exhaustion
- AddFoodExhaustion(0.3f);
-
- SendHealth();
+ if (super::DoTakeDamage(a_TDI))
+ {
+ // Any kind of damage adds food exhaustion
+ AddFoodExhaustion(0.3f);
+ SendHealth();
+ return true;
+ }
+ return false;
}
@@ -891,6 +893,7 @@ void cPlayer::KilledBy(cEntity * a_Killer)
void cPlayer::Respawn(void)
{
m_Health = GetMaxHealth();
+ SetInvulnerableTicks(20);
// Reset food level:
m_FoodLevel = MAX_FOOD_LEVEL;