Fix hpregen whilst dead
This commit is contained in:
parent
c7c95a757e
commit
f6176e6357
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue