mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
Revert unreliable bugfix
There are times when the continuous damage when punching players does not happen so will not fix at the moment as using other weapons does still work.
This commit is contained in:
parent
6b439fd1de
commit
60367cdbe0
1 changed files with 7 additions and 7 deletions
|
@ -664,7 +664,6 @@ minetest.register_on_joinplayer(function(player)
|
||||||
swimDistance = 0,
|
swimDistance = 0,
|
||||||
jump_cooldown = -1, -- Cooldown timer for jumping, we need this to prevent the jump exhaustion to increase rapidly
|
jump_cooldown = -1, -- Cooldown timer for jumping, we need this to prevent the jump exhaustion to increase rapidly
|
||||||
last_damage = 0,
|
last_damage = 0,
|
||||||
invul_timestamp = 0,
|
|
||||||
}
|
}
|
||||||
mcl_playerplus.elytra[player] = {active = false, rocketing = 0, speed = 0}
|
mcl_playerplus.elytra[player] = {active = false, rocketing = 0, speed = 0}
|
||||||
|
|
||||||
|
@ -742,11 +741,9 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch,
|
||||||
-- damage invulnerability
|
-- damage invulnerability
|
||||||
if hitter then
|
if hitter then
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local time_now = minetest.get_us_time()
|
-- check for invulnerability time for 0.5 second
|
||||||
local invul_timestamp = mcl_playerplus_internal[name].invul_timestamp
|
local invul = player:get_meta():get_int("mcl_damage:invulnerable")
|
||||||
local time_diff = time_now - invul_timestamp
|
if invul > 0 then
|
||||||
-- check for invulnerability time in microseconds (0.5 second)
|
|
||||||
if time_diff <= 500000 and time_diff >= 0 then
|
|
||||||
damage = damage - mcl_playerplus_internal[name].last_damage
|
damage = damage - mcl_playerplus_internal[name].last_damage
|
||||||
if damage < 0 then
|
if damage < 0 then
|
||||||
damage = 0
|
damage = 0
|
||||||
|
@ -754,7 +751,10 @@ minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch,
|
||||||
return damage
|
return damage
|
||||||
else
|
else
|
||||||
mcl_playerplus_internal[name].last_damage = damage
|
mcl_playerplus_internal[name].last_damage = damage
|
||||||
mcl_playerplus_internal[name].invul_timestamp = time_now
|
player:get_meta():set_int("mcl_damage:invulnerable", 1)
|
||||||
|
minetest.after(0.5, function()
|
||||||
|
player:get_meta():set_int("mcl_damage:invulnerable", 0)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in a new issue