Add “inactive” and “active” mirror

To denote which mirror has a destination yet
This commit is contained in:
Wuzzy 2015-02-14 06:49:51 +01:00
parent 3d2abd1bb4
commit f24fc2b04e
4 changed files with 23 additions and 4 deletions

View File

@ -29,11 +29,27 @@ returnmirror.mana_check = function(player, cost)
return allowed
end
minetest.register_tool("returnmirror:returnmirror", {
minetest.register_tool("returnmirror:mirror_inactive", {
description = "Mirror of Returning",
inventory_image = "returnmirror_mirror_inactive.png",
wield_image = "returnmirror_mirror_inactive.png",
tool_capabilities = {},
on_place = function(itemstack, placer, pointed_thing)
if returnmirror.mana_check(placer, returnmirror.cost_set) then
local pos = placer:getpos()
local newitem = ItemStack("returnmirror:mirror_active")
newitem:set_metadata(minetest.pos_to_string(pos))
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12})
return newitem
end
end,
})
minetest.register_tool("returnmirror:mirror_active", {
description = "Mirror of Returning",
stack_max = 1,
inventory_image = "returnmirror_returnmirror.png",
wield_image = "returnmirror_returnmirror.png",
inventory_image = "returnmirror_mirror_active.png",
wield_image = "returnmirror_mirror_active.png",
tool_capabilities = {},
on_use = function(itemstack, user, pointed_thing)
local dest_string = itemstack:get_metadata()
@ -80,5 +96,8 @@ minetest.register_tool("returnmirror:returnmirror", {
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12})
return itemstack
end
end
end,
groups = { not_in_creative_inventory = 1 },
})
minetest.register_alias("returnmirror:mirror_inactive", "returnmirror:returnmirror")

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 466 B