diff --git a/init.lua b/init.lua index bcc93c6..825f03a 100644 --- a/init.lua +++ b/init.lua @@ -96,11 +96,11 @@ minetest.register_tool("returnmirror:mirror_active", { on_use = function(itemstack, user, pointed_thing) local dest_string = itemstack:get_metadata() local dest = minetest.string_to_pos(dest_string) + local src = user:getpos() local fail = true if dest ~= nil then if returnmirror.mana_check(user, returnmirror.cost_teleport) then fail = false - local src = user:getpos() minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=src, max_hear_distance=30}) minetest.add_particlespawner({ amount = 50, @@ -133,7 +133,7 @@ minetest.register_tool("returnmirror:mirror_active", { end end if fail then - minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18}) + minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=src, max_hear_distance=18}) end end, on_place = returnmirror.set_position_active,