diff options
author | Craig Robbins <kde.psych@gmail.com> | 2015-03-17 16:21:48 +1000 |
---|---|---|
committer | Craig Robbins <kde.psych@gmail.com> | 2015-03-17 17:08:00 +1000 |
commit | c552d293fa340a1484d0b918b3341d7d141e7931 (patch) | |
tree | 19f522214653680a97654ffef83aeff4ad6bb26d | |
parent | 34c5a5b377413cd937c2262fe367290c7baa6603 (diff) | |
download | minetest-c552d293fa340a1484d0b918b3341d7d141e7931.tar.gz minetest-c552d293fa340a1484d0b918b3341d7d141e7931.tar.bz2 minetest-c552d293fa340a1484d0b918b3341d7d141e7931.zip |
Fix various damage related bugs (client-side)
E.g. spawning or teleporting into lava to become invinsible
-rw-r--r-- | src/environment.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index 953fa2860..f83414a6a 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -2563,16 +2563,10 @@ void ClientEnvironment::damageLocalPlayer(u8 damage, bool handle_hp) LocalPlayer *lplayer = getLocalPlayer(); assert(lplayer); - if(handle_hp) { - // Don't damage a dead player - if (lplayer->isDead()) - return; - - if(lplayer->hp > damage) - lplayer->hp -= damage; - else - lplayer->hp = 0; - } + if (handle_hp && lplayer->hp > damage) + lplayer->hp -= damage; + else + lplayer->hp = 0; ClientEnvEvent event; event.type = CEE_PLAYER_DAMAGE; |