forked from VoxeLibre/VoxeLibre
Prevent time traveling mobs from being invulnerable if the clock is adjusted
This commit is contained in:
parent
ce1f09f679
commit
0fbfe99c1d
|
@ -537,8 +537,10 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
local is_player = hitter:is_player()
|
local is_player = hitter:is_player()
|
||||||
|
|
||||||
if is_player then
|
if is_player then
|
||||||
|
local time_diff = time_now - self.invul_timestamp
|
||||||
|
|
||||||
-- check for invulnerability time in microseconds (0.5 second)
|
-- check for invulnerability time in microseconds (0.5 second)
|
||||||
if time_now - self.invul_timestamp <= 500000 then
|
if time_diff <= 500000 and time_diff >= 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue