CraigyDavi wrote:You have set it to tile invisible.png and that file does not seem to exist.
Topywo wrote:The 'automatic' placement of the node always places it in one specific direction. To put the curtain on another spot, you can use the param2 option.
Example:
minetest.add_node(pos, {name = "curtains:red_open", param2=20})
Then you'll still have the trouble how to place the curtain in the right spot.
For the seamod I use this:
elseif node.name == "stairsshine:stair_seaglass_white" and node.param2 == 21 then
minetest.add_node(pos, {name="stairs:stair_seaglassoff_white", param2 = 21})
nodeupdate(pos)
elseif node.name == "stairs:stair_seaglassoff_white" and node.param2 == 21 then
minetest.add_node(pos, {name="stairsshine:stair_seaglass_white", param2 = 21})
nodeupdate(pos)
elseif node.name == "stairsshine:stair_seaglass_white" and node.param2 == 22 then
minetest.add_node(pos, {name="stairs:stair_seaglassoff_white", param2 = 22})
nodeupdate(pos)
elseif node.name == "stairs:stair_seaglassoff_white" and node.param2 == 22 then
minetest.add_node(pos, {name="stairsshine:stair_seaglass_white", param2 = 22})
nodeupdate(pos)
Though it's possible you need to find/use other numbers than 21 and 22.
For invisible you might consider making a node curtains: red_close. For texture you could copy the 'invisible' part of the default glass texture (at least I do it like that).
Good luck!
Rhys wrote:I don't know where to put that code Topywo, could you help me find the place?
minetest.register_node("curtains:red_closed", {
description = "Red Curtain",
tiles = {"wool_red.png"},
paramtype = "light",
paramtype2 = "wallmounted",
selection_box = {
type = "wallmounted",
--wall_top = = <default>
--wall_bottom = = <default>
--wall_side = = <default>
},
drawtype = "signlike",
walkable = false,
groups = {oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_leaves_defaults(),
on_punch = function(pos, node, clicker)
playername = clicker:get_player_name()
if minetest.is_protected(pos, playername) then
minetest.record_protection_violation(pos, playername)
return
end
if node.name == "curtains:red_closed" and node.param2 == 2 then
minetest.add_node(pos, {name="curtains:red_open", param2 = 2})
elseif node.name == "curtains:red_closed" and node.param2 == 3 then
minetest.add_node(pos, {name="curtains:red_open", param2 = 3})
elseif node.name == "curtains:red_closed" and node.param2 == 4 then
minetest.add_node(pos, {name="curtains:red_open", param2 = 4})
elseif node.name == "curtains:red_closed" and node.param2 == 5 then
minetest.add_node(pos, {name="curtains:red_open", param2 = 5})
end
end
})
minetest.register_node("curtains:red_open", {
description = "Red Curtain",
tiles = {"invisible.png"},
paramtype = "light",
paramtype2 = "wallmounted",
selection_box = {
type = "wallmounted",
--wall_top = = <default>
--wall_bottom = = <default>
--wall_side = = <default>
},
drawtype = "signlike",
drop = "curtains:red_closed",
walkable = false,
groups = {oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_leaves_defaults(),
on_punch = function(pos, node, clicker)
playername = clicker:get_player_name()
if minetest.is_protected(pos, playername) then
minetest.record_protection_violation(pos, playername)
return
end
if node.name == "curtains:red_open" and node.param2 == 2 then
minetest.add_node(pos, {name="curtains:red_closed", param2 = 2})
elseif node.name == "curtains:red_open" and node.param2 == 3 then
minetest.add_node(pos, {name="curtains:red_closed", param2 = 3})
elseif node.name == "curtains:red_open" and node.param2 == 4 then
minetest.add_node(pos, {name="curtains:red_closed", param2 = 4})
elseif node.name == "curtains:red_open" and node.param2 == 5 then
minetest.add_node(pos, {name="curtains:red_closed", param2 = 5})
end
end
})
Topywo wrote:Rhys wrote:I don't know where to put that code Topywo, could you help me find the place?
I tried it out, the numbers are right, this should do the trick for the placement of the curtains:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_node("curtains:red_closed", {
description = "Red Curtain",
tiles = {"wool_red.png"},
paramtype = "light",
paramtype2 = "wallmounted",
selection_box = {
type = "wallmounted",
--wall_top = = <default>
--wall_bottom = = <default>
--wall_side = = <default>
},
drawtype = "signlike",
walkable = false,
groups = {oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_leaves_defaults(),
on_punch = function(pos, node, clicker)
playername = clicker:get_player_name()
if minetest.is_protected(pos, playername) then
minetest.record_protection_violation(pos, playername)
return
end
if node.name == "curtains:red_closed" and node.param2 == 2 then
minetest.add_node(pos, {name="curtains:red_open", param2 = 2})
elseif node.name == "curtains:red_closed" and node.param2 == 3 then
minetest.add_node(pos, {name="curtains:red_open", param2 = 3})
elseif node.name == "curtains:red_closed" and node.param2 == 4 then
minetest.add_node(pos, {name="curtains:red_open", param2 = 4})
elseif node.name == "curtains:red_closed" and node.param2 == 5 then
minetest.add_node(pos, {name="curtains:red_open", param2 = 5})
end
end
})
minetest.register_node("curtains:red_open", {
description = "Red Curtain",
tiles = {"invisible.png"},
paramtype = "light",
paramtype2 = "wallmounted",
selection_box = {
type = "wallmounted",
--wall_top = = <default>
--wall_bottom = = <default>
--wall_side = = <default>
},
drawtype = "signlike",
drop = "curtains:red_closed",
walkable = false,
groups = {oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_leaves_defaults(),
on_punch = function(pos, node, clicker)
playername = clicker:get_player_name()
if minetest.is_protected(pos, playername) then
minetest.record_protection_violation(pos, playername)
return
end
if node.name == "curtains:red_open" and node.param2 == 2 then
minetest.add_node(pos, {name="curtains:red_closed", param2 = 2})
elseif node.name == "curtains:red_open" and node.param2 == 3 then
minetest.add_node(pos, {name="curtains:red_closed", param2 = 3})
elseif node.name == "curtains:red_open" and node.param2 == 4 then
minetest.add_node(pos, {name="curtains:red_closed", param2 = 4})
elseif node.name == "curtains:red_open" and node.param2 == 5 then
minetest.add_node(pos, {name="curtains:red_closed", param2 = 5})
end
end
})
Probably it is also possible to use tabels where you put the colors of your curtains in, that are iterated (if I'm right something like for a = 1, 7 do) into some base code. But tabels, functions and well, coding in general, are not my strongest point, so I write and try everything out until I find some code that is easy to copy and use ;-)
local node = minetest.get_node(pos)
node.name = "curtains:red_closed"
minetest.set_node(pos, node)
ShadowNinja wrote:You have to restore the param2 (and param1) value when you use set_node. You can get your current param1 and param2 values with get_node. You should NOT use a hardcoded param2 value. So, for example.Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local node = minetest.get_node(pos)
node.name = "curtains:red_closed"
minetest.set_node(pos, node)
Rhys wrote:ShadowNinja wrote:You have to restore the param2 (and param1) value when you use set_node. You can get your current param1 and param2 values with get_node. You should NOT use a hardcoded param2 value. So, for example.Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local node = minetest.get_node(pos)
node.name = "curtains:red_closed"
minetest.set_node(pos, node)
I've already finished the mod with the code Topywo gave me. I'm glad we have Copy and Paste. xD
Users browsing this forum: No registered users and 9 guests