1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 00:20:17 +01:00

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, "", ""},
},
})
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
local mats = {
{ "brass", "homedecor:pole_brass" },
{ "wrought_iron", "homedecor:pole_wrought_iron" },

View File

@ -221,6 +221,14 @@ for c in ipairs(curtaincolors) do
selection_box = {
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, {
@ -240,6 +248,14 @@ for c in ipairs(curtaincolors) do
selection_box = {
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