1
0
Fork 0

Prevent time traveling mobs from being invulnerable if the clock is adjusted

This commit is contained in:
Eliy21 2023-11-20 14:02:38 +00:00
parent ce1f09f679
commit 0fbfe99c1d
1 changed files with 3 additions and 1 deletions

View File

@ -537,8 +537,10 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
local is_player = hitter:is_player()
if is_player then
local time_diff = time_now - self.invul_timestamp
-- 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
end