Added player damage invulnerability

the-real-herowl 2023-11-28 04:28:05 +01:00 committed by the-real-herowl
parent 24ffd64cad
commit cca6645524

@ -721,6 +721,20 @@ mcl_damage.register_modifier(function(obj, damage, reason)
end
end, -200)
-- damage invulnerability
mcl_damage.register_modifier(function(obj, damage, reason)
local invul = obj:get_meta():get_int("mcl_damage:invulnerable")
if invul > 0 then
return 0
else
obj:get_meta():set_int("mcl_damage:invulnerable", 1)
minetest.after(0.5, function()
obj:get_meta():set_int("mcl_damage:invulnerable", 0)
end)
return damage
end
end, -1000)
minetest.register_on_respawnplayer(function(player)
local pos = player:get_pos()
minetest.add_particlespawner({