Add ability to place a sign directly onto a brass/wrought iron fencepost

rather than crafting a sign-on-fencepost from one of each, how about just
placing a sign directly onto a fencepost instead?  This commit adds this.
Place a brass or wrought iron fencepost, then attempt to place a sign against
it.  The fencepost will be replaced with one bearing the sign - in the same
node.  Dig to get the two pieces back as separate items, right click the placed
sign to edit the text thereon.

Note that as of this commit, there is a bug in minetest/builtin/item.lua that
causes signs not to be deducted from your inventory on placement.
This commit is contained in:
Vanessa Ezekowitz 2013-02-09 17:59:35 -05:00
parent 6d00d9dd5a
commit 323e230d49
2 changed files with 41 additions and 22 deletions

View File

@ -1321,27 +1321,6 @@ minetest.register_craft( {
}, },
}) })
-- the version of brass/wrought iron fences with signs attached
minetest.register_craft( {
type = "shapeless",
output = 'homedecor:fence_brass_with_sign',
recipe = {
'homedecor:fence_brass',
'default:sign_wall',
},
})
minetest.register_craft( {
type = "shapeless",
output = 'homedecor:fence_wrought_iron_with_sign',
recipe = {
'homedecor:fence_wrought_iron',
'default:sign_wall',
},
})
-- other types of fences/gates -- other types of fences/gates
minetest.register_craft( { minetest.register_craft( {

View File

@ -14,8 +14,27 @@ minetest.register_node("homedecor:fence_brass", {
groups = {snappy=3}, groups = {snappy=3},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
}) on_rightclick = function(pos, node, clicker)
local fdir = minetest.dir_to_facedir(clicker:get_look_dir())
local itemstack = clicker:get_wielded_item()
if itemstack:get_name() == "default:sign_wall" then
minetest.env:add_node(pos, {name = "homedecor:fence_brass_with_sign", param2 = fdir})
itemstack:take_item()
return itemstack
else
print("want to simply place the wielded item like usual.")
-- What goes here if I want to just place the wielded node (dirt, cobble, etc) normally?
end
end,
on_place = function(itemstack, placer, pointed_thing)
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.env:add_node(pointed_thing.above, {name = "homedecor:fence_brass", param2 = fdir})
itemstack:take_item()
placer:set_wielded_item(itemstack)
return itemstack
end
})
minetest.register_node("homedecor:fence_wrought_iron", { minetest.register_node("homedecor:fence_wrought_iron", {
description = "Wrought Iron Fence/railing", description = "Wrought Iron Fence/railing",
@ -31,6 +50,27 @@ minetest.register_node("homedecor:fence_wrought_iron", {
groups = {snappy=3}, groups = {snappy=3},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
on_rightclick = function(pos, node, clicker)
local fdir = minetest.dir_to_facedir(clicker:get_look_dir())
local itemstack = clicker:get_wielded_item()
if itemstack:get_name() == "default:sign_wall" then
minetest.env:add_node(pos, {name = "homedecor:fence_wrought_iron_with_sign", param2 = fdir})
itemstack:take_item()
clicker:set_wielded_item(itemstack)
return itemstack
else
print("want to simply place the wielded item like usual.")
-- What goes here if I want to just place the wielded node (dirt, cobble, etc) normally?
end
end,
on_place = function(itemstack, placer, pointed_thing)
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.env:add_node(pointed_thing.above, {name = "homedecor:fence_wrought_iron", param2 = fdir})
itemstack:take_item()
placer:set_wielded_item(itemstack)
return itemstack
end
}) })
-- brass/wrought iron with signs: -- brass/wrought iron with signs: