Don't kill players that are already dead.

This commit is contained in:
Auke Kok 2019-09-18 21:31:31 -07:00
parent 661e7ebe5c
commit 27448a62ea

View File

@ -107,13 +107,13 @@ end
-- heal players slowly, or kill them if they fell in the abyss
local function player_health_adjust()
for _, player in pairs(minetest.get_connected_players()) do
if player:getpos().y < -50 then
player:set_hp(player:get_hp() - 100)
local hp = player:get_hp()
if player:getpos().y < -50 and hp > 0 then
player:set_hp(hp - 100)
else
local hp = player:get_hp()
local breath = player:get_breath()
if hp > 0 and hp < 20 and breath > 0 then
player:set_hp(player:get_hp() + 1)
player:set_hp(hp + 1)
end
end
end