diff --git a/depends.txt b/depends.txt index d06ef53..309189f 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1 @@ -mana +mana? diff --git a/init.lua b/init.lua index a2487b4..b2fd1cc 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,12 @@ returnmirror = {} returnmirror.cost = 100 +if minetest.get_modpath("mana") ~= nil then + returnmirror.mana = true +else + returnmirror.mana = false +end + minetest.register_tool("returnmirror:returnmirror", { description = "Mirror of Returning", stack_max = 1, @@ -11,7 +17,17 @@ minetest.register_tool("returnmirror:returnmirror", { local dest_string = itemstack:get_metadata() local dest = minetest.string_to_pos(dest_string) if dest ~= nil then - if mana.subtract(user:get_player_name(), returnmirror.cost) then + local allowed + if returnmirror.mana then + if mana.subtract(user:get_player_name(), returnmirror.cost) then + allowed = true + else + allowed = false + end + else + allowed = true + end + if allowed then local src = user:getpos() minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=src, max_hear_distance=30}) minetest.add_particlespawner({