Added open/close curtains functions.

This commit is contained in:
kilbith 2014-08-11 08:23:26 +02:00 committed by Vanessa Ezekowitz
parent 256029f259
commit 8e76593982
2 changed files with 17 additions and 15 deletions

View File

@ -994,22 +994,8 @@ for c in ipairs(curtaincolors) do
{ "wool:"..color, "", ""}, { "wool:"..color, "", ""},
}, },
}) })
minetest.register_craft( {
output = "homedecor:curtain_open_"..color,
recipe = {
{ "homedecor:curtain_"..color },
},
})
minetest.register_craft( {
output = "homedecor:curtain_"..color,
recipe = {
{ "homedecor:curtain_open_"..color },
},
})
end end
local mats = { local mats = {
{ "brass", "homedecor:pole_brass" }, { "brass", "homedecor:pole_brass" },
{ "wrought_iron", "homedecor:pole_wrought_iron" }, { "wrought_iron", "homedecor:pole_wrought_iron" },

View File

@ -221,6 +221,14 @@ for c in ipairs(curtaincolors) do
selection_box = { selection_box = {
type = "wallmounted", type = "wallmounted",
}, },
-- Open the curtains
on_rightclick = function(pos, node, clicker, itemstack)
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_open_"..color, param2 = fdir })
end
end
}) })
minetest.register_node("homedecor:curtain_open_"..color, { minetest.register_node("homedecor:curtain_open_"..color, {
@ -240,6 +248,14 @@ for c in ipairs(curtaincolors) do
selection_box = { selection_box = {
type = "wallmounted", type = "wallmounted",
}, },
-- Close the curtains
on_rightclick = function(pos, node, clicker, itemstack)
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_"..color, param2 = fdir })
end
end
}) })
end end