Fix hpregen whilst dead

This commit is contained in:
rubenwardy 2016-01-05 02:57:10 +00:00
parent c7c95a757e
commit f6176e6357

View file

@ -9,11 +9,14 @@ end
local function regen_all()
for _, player in pairs(minetest.get_connected_players()) do
local newhp = player:get_hp() + regen_amount
if newhp > 20 then
newhp = 20
local oldhp = player:get_hp()
if oldhp > 0 then
local newhp = oldhp + regen_amount
if newhp > 20 then
newhp = 20
end
player:set_hp(newhp)
end
player:set_hp(newhp)
end
minetest.after(regen_interval, regen_all)
end