Stop regenerating when dead, reset mana on respawn

This commit is contained in:
Wuzzy 2015-02-14 06:09:31 +01:00
parent 3917a492f8
commit 3fe1e06a42

View File

@ -188,7 +188,7 @@ function mana.save_to_file()
end
minetest.register_on_dieplayer(function(player)
minetest.register_on_respawnplayer(function(player)
local playername = player:get_player_name()
mana.set(playername, 0)
mana.hud_update(playername)
@ -237,7 +237,9 @@ minetest.register_globalstep(function(dtime)
for i=1, #players do
local name = players[i]:get_player_name()
if mana.playerlist[name] ~= nil then
mana.add_up_to(name, mana.playerlist[name].regen)
if players[i]:get_hp() > 0 then
mana.add_up_to(name, mana.playerlist[name].regen)
end
end
end
mana.regen_timer = 0