Fix mana being subtracted for invalid teleport

master
Wuzzy 2015-02-16 04:04:16 +01:00
parent 5216fb3b83
commit bdf22735c6
1 changed files with 4 additions and 1 deletions

View File

@ -155,8 +155,11 @@ if(minetest.get_modpath("mana") ~= nil) then
on_use = function(itemstack, user, pointed_thing)
local failure = false
if(pointed_thing.type == "node") then
if(mana.subtract(user:get_player_name(), teletool.settings.cost_mana)) then
if(mana.get(user:get_player_name()) >= teletool.settings.cost_mana) then
failure = not teletool.teleport(user, pointed_thing)
if not failure then
failure = mana.subtract(user:get_player_name(), teletool.settings.cost_mana)
end
else
failure = true
end