mirror of
https://github.com/minetest/minetest.git
synced 2024-12-04 13:33:44 +01:00
Fix various damage related bugs (client-side)
E.g. spawning or teleporting into lava to become invinsible
This commit is contained in:
parent
34c5a5b377
commit
c552d293fa
@ -2563,16 +2563,10 @@ void ClientEnvironment::damageLocalPlayer(u8 damage, bool handle_hp)
|
|||||||
LocalPlayer *lplayer = getLocalPlayer();
|
LocalPlayer *lplayer = getLocalPlayer();
|
||||||
assert(lplayer);
|
assert(lplayer);
|
||||||
|
|
||||||
if(handle_hp) {
|
if (handle_hp && lplayer->hp > damage)
|
||||||
// Don't damage a dead player
|
|
||||||
if (lplayer->isDead())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(lplayer->hp > damage)
|
|
||||||
lplayer->hp -= damage;
|
lplayer->hp -= damage;
|
||||||
else
|
else
|
||||||
lplayer->hp = 0;
|
lplayer->hp = 0;
|
||||||
}
|
|
||||||
|
|
||||||
ClientEnvEvent event;
|
ClientEnvEvent event;
|
||||||
event.type = CEE_PLAYER_DAMAGE;
|
event.type = CEE_PLAYER_DAMAGE;
|
||||||
|
Loading…
Reference in New Issue
Block a user