From 88cdd3a363668cfb2fd07b5381cce29738aed0bf Mon Sep 17 00:00:00 2001 From: Kahrl Date: Tue, 24 Jan 2012 00:00:26 +0100 Subject: Players stay in environment even when dead, damage flash and fall damage fixes Don't set m_removed on dead players (dead players are indicated by hp == 0). Local damage flash is shown whatever the cause was (even from Lua set_hp). PlayerCAO damage flash matches duration of local damage flash. Fall damage is dealt much more consistently (this is done by disallowing jumping when speed.Y is very negative, up to now jumping could sometimes negate fall damage) --- src/environment.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/environment.cpp') diff --git a/src/environment.cpp b/src/environment.cpp index 7c2aef272..6f1d8ff55 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -797,6 +797,8 @@ void ServerEnvironment::clearAllObjects() i.atEnd()==false; i++) { ServerActiveObject* obj = i.getNode()->getValue(); + if(obj->getType() == ACTIVEOBJECT_TYPE_PLAYER) + continue; u16 id = i.getNode()->getKey(); v3f objectpos = obj->getBasePosition(); // Delete static object if block is loaded @@ -1983,16 +1985,7 @@ void ClientEnvironment::step(float dtime) { f32 damage_f = (info.speed - tolerance)/BS*factor; u16 damage = (u16)(damage_f+0.5); - if(lplayer->hp > damage) - lplayer->hp -= damage; - else - lplayer->hp = 0; - - ClientEnvEvent event; - event.type = CEE_PLAYER_DAMAGE; - event.player_damage.amount = damage; - event.player_damage.send_to_server = true; - m_client_event_queue.push_back(event); + damageLocalPlayer(damage, true); } } } @@ -2022,11 +2015,7 @@ void ClientEnvironment::step(float dtime) if(damage_per_second != 0) { - ClientEnvEvent event; - event.type = CEE_PLAYER_DAMAGE; - event.player_damage.amount = damage_per_second; - event.player_damage.send_to_server = true; - m_client_event_queue.push_back(event); + damageLocalPlayer(damage_per_second, true); } } -- cgit v1.2.3