Disable healing for 4 seconds after injury.
This is another de-nerfing of physical damage to make getting caught in a fire and other damage-over-time situations more damaging.
This commit is contained in:
parent
78e4008aac
commit
3e5e8e4524
@ -9,6 +9,7 @@ minetest.register_on_player_hpchange(function(player, hp)
|
|||||||
return orig
|
return orig
|
||||||
end
|
end
|
||||||
if hp < 0 then
|
if hp < 0 then
|
||||||
|
player:get_meta():set_float("hurttime", nodecore.gametime)
|
||||||
minetest.after(0, function()
|
minetest.after(0, function()
|
||||||
local now = player:get_hp()
|
local now = player:get_hp()
|
||||||
if now >= orig then return end
|
if now >= orig then return end
|
||||||
@ -32,10 +33,15 @@ minetest.register_on_dieplayer(function(player)
|
|||||||
player:get_meta():set_float("dhp", -1)
|
player:get_meta():set_float("dhp", -1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
local function heal(player, dtime)
|
||||||
|
if player:get_hp() <= 0 then return end
|
||||||
|
if player:get_breath() <= 0 then return end
|
||||||
|
local hurt = player:get_meta():get_float("hurttime")
|
||||||
|
if hurt >= nodecore.gametime - 4 then return end
|
||||||
|
nodecore.addphealth(player, dtime * 2)
|
||||||
|
end
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
for _, p in pairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
if p:get_hp() > 0 and p:get_breath() > 10 then
|
heal(player, dtime)
|
||||||
nodecore.addphealth(p, dtime)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user