forked from mtcontrib/minetest_returnmirror
Add “inactive” and “active” mirror
To denote which mirror has a destination yet
This commit is contained in:
parent
3d2abd1bb4
commit
f24fc2b04e
27
init.lua
27
init.lua
|
@ -29,11 +29,27 @@ returnmirror.mana_check = function(player, cost)
|
||||||
return allowed
|
return allowed
|
||||||
end
|
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",
|
description = "Mirror of Returning",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
inventory_image = "returnmirror_returnmirror.png",
|
inventory_image = "returnmirror_mirror_active.png",
|
||||||
wield_image = "returnmirror_returnmirror.png",
|
wield_image = "returnmirror_mirror_active.png",
|
||||||
tool_capabilities = {},
|
tool_capabilities = {},
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
local dest_string = itemstack:get_metadata()
|
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})
|
minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12})
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
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 |
Loading…
Reference in New Issue