forked from mtcontrib/minetest_mana
Stop regenerating when dead, reset mana on respawn
This commit is contained in:
parent
3917a492f8
commit
3fe1e06a42
6
init.lua
6
init.lua
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user