1
0
mirror of https://repo.or.cz/minetest_returnmirror.git synced 2024-11-15 04:40:17 +01:00
minetest_returnmirror/init.lua
2015-02-13 23:07:54 +01:00

24 lines
699 B
Lua

returnmirror = {}
returnmirror.cost = 100
minetest.register_tool("returnmirror:returnmirror", {
description = "Mirror of Returning",
stack_max = 1,
inventory_image = "returnmirror_returnmirror.png",
wield_image = "returnmirror_returnmirror.png",
tool_capabilities = {},
on_use = function(itemstack, user, pointed_thing)
local pos_string = itemstack:get_metadata()
local pos = minetest.string_to_pos(pos_string)
if pos ~= nil then
if mana.subtract(user:get_player_name(), returnmirror.cost) then
user:setpos(pos)
end
end
end,
on_place = function(itemstack, placer, pointed_thing)
itemstack:set_metadata(minetest.pos_to_string(placer:getpos()))
return itemstack
end
})