mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Damage: Remove damage ignore timer
This commit is contained in:
parent
6f80e302fd
commit
f9738c1909
@ -73,7 +73,6 @@ Client::Client(
|
|||||||
m_connection_reinit_timer(0.1),
|
m_connection_reinit_timer(0.1),
|
||||||
m_avg_rtt_timer(0.0),
|
m_avg_rtt_timer(0.0),
|
||||||
m_playerpos_send_timer(0.0),
|
m_playerpos_send_timer(0.0),
|
||||||
m_ignore_damage_timer(0.0),
|
|
||||||
m_tsrc(tsrc),
|
m_tsrc(tsrc),
|
||||||
m_shsrc(shsrc),
|
m_shsrc(shsrc),
|
||||||
m_itemdef(itemdef),
|
m_itemdef(itemdef),
|
||||||
@ -275,14 +274,9 @@ void Client::step(float dtime)
|
|||||||
DSTACK(FUNCTION_NAME);
|
DSTACK(FUNCTION_NAME);
|
||||||
|
|
||||||
// Limit a bit
|
// Limit a bit
|
||||||
if(dtime > 2.0)
|
if (dtime > 2.0)
|
||||||
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;
|
m_animation_time += dtime;
|
||||||
if(m_animation_time > 60.0)
|
if(m_animation_time > 60.0)
|
||||||
m_animation_time -= 60.0;
|
m_animation_time -= 60.0;
|
||||||
@ -429,7 +423,6 @@ void Client::step(float dtime)
|
|||||||
ClientEnvEvent envEvent = m_env.getClientEnvEvent();
|
ClientEnvEvent envEvent = m_env.getClientEnvEvent();
|
||||||
|
|
||||||
if (envEvent.type == CEE_PLAYER_DAMAGE) {
|
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)
|
if (envEvent.player_damage.send_to_server)
|
||||||
@ -441,7 +434,6 @@ void Client::step(float dtime)
|
|||||||
event.player_damage.amount = damage;
|
event.player_damage.amount = damage;
|
||||||
m_client_event_queue.push(event);
|
m_client_event_queue.push(event);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// Protocol v29 or greater obsoleted this event
|
// Protocol v29 or greater obsoleted this event
|
||||||
else if (envEvent.type == CEE_PLAYER_BREATH && m_proto_ver < 29) {
|
else if (envEvent.type == CEE_PLAYER_BREATH && m_proto_ver < 29) {
|
||||||
u16 breath = envEvent.player_breath.amount;
|
u16 breath = envEvent.player_breath.amount;
|
||||||
|
@ -574,7 +574,6 @@ private:
|
|||||||
float m_connection_reinit_timer;
|
float m_connection_reinit_timer;
|
||||||
float m_avg_rtt_timer;
|
float m_avg_rtt_timer;
|
||||||
float m_playerpos_send_timer;
|
float m_playerpos_send_timer;
|
||||||
float m_ignore_damage_timer; // Used after server moves player
|
|
||||||
IntervalLimiter m_map_timer_and_unload_interval;
|
IntervalLimiter m_map_timer_and_unload_interval;
|
||||||
|
|
||||||
IWritableTextureSource *m_tsrc;
|
IWritableTextureSource *m_tsrc;
|
||||||
|
@ -580,10 +580,6 @@ void Client::handleCommand_MovePlayer(NetworkPacket* pkt)
|
|||||||
event.player_force_move.pitch = pitch;
|
event.player_force_move.pitch = pitch;
|
||||||
event.player_force_move.yaw = yaw;
|
event.player_force_move.yaw = yaw;
|
||||||
m_client_event_queue.push(event);
|
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)
|
void Client::handleCommand_DeathScreen(NetworkPacket* pkt)
|
||||||
|
Loading…
Reference in New Issue
Block a user