aboutsummaryrefslogtreecommitdiff
path: root/src/environment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/environment.cpp')
-rw-r--r--src/environment.cpp19
1 files changed, 4 insertions, 15 deletions
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);
}
}