1
0
Fork 0

Added player damage invulnerability

This commit is contained in:
the-real-herowl 2023-11-28 04:28:05 +01:00 committed by the-real-herowl
parent 24ffd64cad
commit cca6645524
1 changed files with 14 additions and 0 deletions

View File

@ -721,6 +721,20 @@ mcl_damage.register_modifier(function(obj, damage, reason)
end end
end, -200) 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) minetest.register_on_respawnplayer(function(player)
local pos = player:get_pos() local pos = player:get_pos()
minetest.add_particlespawner({ minetest.add_particlespawner({