1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-13 14:00:32 +01:00

[runes] Undo amulets' mana bonus upon leaveplayer

- Runes: Remove the amulets' mana bonus when a player leaves so that
   mana's maxmana value saved for the player (future basemana) doesn't
   already include an amulet bonus
This commit is contained in:
LeMagnesium 2017-04-24 13:30:31 +02:00
parent 8d2683b94b
commit 9ff9dfd76a
No known key found for this signature in database
GPG Key ID: A54DDB5272C51E8B

View File

@ -74,7 +74,7 @@ loop = function()
for name, manadiff in pairs(runes.datas.amulets) do
if itemname == "runes:" .. name .. "_amulet" then
addons = addons + (manadiff * itemcount)
print("Detected " .. name)
--print("Detected " .. name)
end
end
end
@ -85,3 +85,10 @@ loop = function()
end
minetest.after(0, loop)
minetest.register_on_leaveplayer(function(player)
local pname = player:get_player_name()
mana.setmax(pname, mana.getmax(pname) - tmpdata[pname]) -- Reset
tmpdata[pname] = nil
mana.save_to_file(pname) -- Double class since we aren't sure mana hasn't already saved (it probably did)
end)