Fix hpregen whilst dead
This commit is contained in:
parent
c7c95a757e
commit
f6176e6357
1 changed files with 7 additions and 4 deletions
|
@ -9,12 +9,15 @@ end
|
||||||
|
|
||||||
local function regen_all()
|
local function regen_all()
|
||||||
for _, player in pairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
local newhp = player:get_hp() + regen_amount
|
local oldhp = player:get_hp()
|
||||||
|
if oldhp > 0 then
|
||||||
|
local newhp = oldhp + regen_amount
|
||||||
if newhp > 20 then
|
if newhp > 20 then
|
||||||
newhp = 20
|
newhp = 20
|
||||||
end
|
end
|
||||||
player:set_hp(newhp)
|
player:set_hp(newhp)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
minetest.after(regen_interval, regen_all)
|
minetest.after(regen_interval, regen_all)
|
||||||
end
|
end
|
||||||
minetest.after(regen_interval, regen_all)
|
minetest.after(regen_interval, regen_all)
|
||||||
|
|
Loading…
Reference in a new issue