summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-04-28 22:05:02 +0200
committermadmaxoft <github@xoft.cz>2014-04-28 22:05:02 +0200
commit0b16e6821ff475dca0539426ec403241170ce93d (patch)
treee272cae036cd9117e1d1f4cea3555c0c0d3aa748 /src/Entities/Player.cpp
parentAdded the G1 root cert. (diff)
parentMerge pull request #940 from Howaner/GlobalFixes (diff)
downloadcuberite-0b16e6821ff475dca0539426ec403241170ce93d.tar
cuberite-0b16e6821ff475dca0539426ec403241170ce93d.tar.gz
cuberite-0b16e6821ff475dca0539426ec403241170ce93d.tar.bz2
cuberite-0b16e6821ff475dca0539426ec403241170ce93d.tar.lz
cuberite-0b16e6821ff475dca0539426ec403241170ce93d.tar.xz
cuberite-0b16e6821ff475dca0539426ec403241170ce93d.tar.zst
cuberite-0b16e6821ff475dca0539426ec403241170ce93d.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 fedb62527..08b7d3984 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -808,14 +808,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;
}
}
@@ -828,17 +828,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;
}
@@ -897,6 +899,7 @@ void cPlayer::KilledBy(cEntity * a_Killer)
void cPlayer::Respawn(void)
{
m_Health = GetMaxHealth();
+ SetInvulnerableTicks(20);
// Reset food level:
m_FoodLevel = MAX_FOOD_LEVEL;