Page 1 of 1

How to make a nodebox (slab) keep the same orientation? (SOLVED)

PostPosted: Fri Oct 12, 2012 18:47
by qwrwed
In Lights+, I have made a wall slab light that turns on and off when punched. However, although it will keep it's orientation when placed (as in Stairs+) it won't when it is changed to an active wall slab light (by on_punch) How can i stop this?

PostPosted: Fri Oct 12, 2012 19:21
by xyz
Copy param2 from old node to new one.

PostPosted: Fri Oct 12, 2012 20:30
by qwrwed
paramtype2 is facedir on both nodes, but i don't know what to put if i put a param2 field.
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
-- Wall Slab Light
minetest.register_node("lightsplus:slab_light_wall", {
    description = "Wall Slab Light",
    tile_images = {"lightsplus_light.png"},
    paramtype = "light",
    paramtype2 = "facedir",
    drawtype = "nodebox",
    node_box = {
            type = "fixed",
            fixed = {-0.5, -0.5, 0, 0.5, 0.5, 0.5},
    },
        selection_box = {
            type = "fixed",
            fixed = {-0.5, -0.5, 0, 0.5, 0.5, 0.5},
    },
    groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2},
})

minetest.register_node("lightsplus:slab_light_wall_on", {
    description = "Active Slab Light",
    tile_images = {"lightsplus_light.png"},
    paramtype = "light",
    paramtype2 = "facedir",
    drawtype = "nodebox",
    node_box = {
        type = "fixed",
        fixed = {-0.5, -0.5, 0, 0.5, 0.5, 0.5},
    },
    selection_box = {
        type = "fixed",
        fixed = {-0.5, -0.5, 0, 0.5, 0.5, 0.5},
    },
    drop = 'lightsplus:slab_light',
    light_source = 15,
    groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2, not_in_creative_inventory=2},

...

 if node.name == 'lightsplus:slab_light_wall' then
    minetest.env:add_node(pos, {name="lightsplus:slab_light_wall_on"})
    nodeupdate(pos)
  elseif node.name == 'lightsplus:slab_light_wall_on' then
    minetest.env:add_node(pos, {name="lightsplus:slab_light_wall",})
    nodeupdate(pos)
  end
end

print("[Lights+] Loaded!")

minetest.register_on_punchnode(on_light_puncher)
})

PostPosted: Fri Oct 12, 2012 20:56
by xyz
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.env:add_node(pos, {name="lightsplus:slab_light_wall_on", param2=node.param2})

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.env:add_node(pos, {name="lightsplus:slab_light_wall", param2=node.param2})

PostPosted: Sat Oct 13, 2012 09:32
by qwrwed
Thanks!