diff options
author | SmallJoker <mk939@ymail.com> | 2017-08-13 09:49:29 +0200 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2017-12-10 14:23:45 +0000 |
commit | 03caa1e31902d99d60ad3c015c681a3fee679638 (patch) | |
tree | ae2e3d161d5600183468a5771c7c9ae9d313b8f5 /src | |
parent | d677f292cc9fcb61078cb258761049c1fa4a424b (diff) | |
download | minetest-03caa1e31902d99d60ad3c015c681a3fee679638.tar.gz minetest-03caa1e31902d99d60ad3c015c681a3fee679638.tar.bz2 minetest-03caa1e31902d99d60ad3c015c681a3fee679638.zip |
Damage: Remove damage ignore timer
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 25 | ||||
-rw-r--r-- | src/client.h | 1 | ||||
-rw-r--r-- | src/network/clientpackethandler.cpp | 4 |
3 files changed, 9 insertions, 21 deletions
diff --git a/src/client.cpp b/src/client.cpp index 2d1572d8e..c04bf055a 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -264,14 +264,9 @@ void Client::connect(Address address, bool is_local_server) void Client::step(float dtime) { // Limit a bit - if(dtime > 2.0) + if (dtime > 2.0) dtime = 2.0; - if(m_ignore_damage_timer > dtime) - m_ignore_damage_timer -= dtime; - else - m_ignore_damage_timer = 0.0; - m_animation_time += dtime; if(m_animation_time > 60.0) m_animation_time -= 60.0; @@ -394,18 +389,16 @@ void Client::step(float dtime) ClientEnvEvent envEvent = m_env.getClientEnvEvent(); if (envEvent.type == CEE_PLAYER_DAMAGE) { - if (m_ignore_damage_timer <= 0) { - u8 damage = envEvent.player_damage.amount; + u8 damage = envEvent.player_damage.amount; - if (envEvent.player_damage.send_to_server) - sendDamage(damage); + if (envEvent.player_damage.send_to_server) + sendDamage(damage); - // Add to ClientEvent queue - ClientEvent *event = new ClientEvent(); - event->type = CE_PLAYER_DAMAGE; - event->player_damage.amount = damage; - m_client_event_queue.push(event); - } + // Add to ClientEvent queue + ClientEvent *event = new ClientEvent(); + event->type = CE_PLAYER_DAMAGE; + event->player_damage.amount = damage; + m_client_event_queue.push(event); } } diff --git a/src/client.h b/src/client.h index d8b56b0b3..06c67105f 100644 --- a/src/client.h +++ b/src/client.h @@ -469,7 +469,6 @@ private: float m_connection_reinit_timer = 0.1f; float m_avg_rtt_timer = 0.0f; float m_playerpos_send_timer = 0.0f; - float m_ignore_damage_timer = 0.0f; // Used after server moves player IntervalLimiter m_map_timer_and_unload_interval; IWritableTextureSource *m_tsrc; diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index b5e2203c8..5de99418e 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -573,10 +573,6 @@ void Client::handleCommand_MovePlayer(NetworkPacket* pkt) event->player_force_move.pitch = pitch; event->player_force_move.yaw = yaw; m_client_event_queue.push(event); - - // Ignore damage for a few seconds, so that the player doesn't - // get damage from falling on ground - m_ignore_damage_timer = 3.0; } void Client::handleCommand_DeathScreen(NetworkPacket* pkt) |