Skip to content

Commit

Permalink
Fix various damage related bugs (client-side)
Browse files Browse the repository at this point in the history
E.g. spawning or teleporting into lava to become invinsible
  • Loading branch information
Zeno- committed Mar 17, 2015
1 parent 34c5a5b commit c552d29
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/environment.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit c552d29

Please sign in to comment.