mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 10:31:06 +01:00
Added player damage invulnerability
This commit is contained in:
parent
24ffd64cad
commit
cca6645524
1 changed files with 14 additions and 0 deletions
|
@ -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({
|
||||
|
|
Loading…
Reference in a new issue