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

User avatar
qwrwed
Member
 
Posts: 323
Joined: Sun Jul 22, 2012 20:56
In-game: qwrwed or Nitro

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

by qwrwed » Fri Oct 12, 2012 18:47

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?
Last edited by qwrwed on Sat Oct 13, 2012 09:33, edited 1 time in total.
 

User avatar
xyz
Member
 
Posts: 449
Joined: Thu Nov 10, 2011 14:25

by xyz » Fri Oct 12, 2012 19:21

Copy param2 from old node to new one.
 

User avatar
qwrwed
Member
 
Posts: 323
Joined: Sun Jul 22, 2012 20:56
In-game: qwrwed or Nitro

by qwrwed » Fri Oct 12, 2012 20:30

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)
})
 

User avatar
xyz
Member
 
Posts: 449
Joined: Thu Nov 10, 2011 14:25

by xyz » Fri Oct 12, 2012 20:56

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})
 

User avatar
qwrwed
Member
 
Posts: 323
Joined: Sun Jul 22, 2012 20:56
In-game: qwrwed or Nitro

by qwrwed » Sat Oct 13, 2012 09:32

Thanks!
 


Return to Minetest Problems

Who is online

Users browsing this forum: No registered users and 19 guests

cron