Page 1 of 1

question with creating a wall attached node

PostPosted: Fri Sep 26, 2014 18:36
by rubberduck
i have a question with creating a wall attached node
i made two lamp models with the node box editor, one is standing, the other has to be attached on a wall.

i added both now into the game to see how they look, but i want them to be one node in game.

if i place the lamp on the ground, i want to have the standing version and when i place it on the wall, i want the wall version. how can i do that?

i also want to align the wall-node with the right side on the wall and i want to rotate the top texture without rotating the image.

here i have the code used at the moment

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("gold_and_gem:ruby_lamp", {
description = "Ruby Lamp",
drawtype = "nodebox",
   node_box = {
      type = "fixed",
      fixed = {
         {-0.125, -0.5, -0.25, 0.125, -0.4375, 0.25}, -- NodeBox1
         {-0.25, -0.5, -0.125, 0.25, -0.4375, 0.125}, -- NodeBox2
         {-0.1875, -0.5, -0.1875, 0.1875, -0.4375, 0.1875}, -- NodeBox3
         {-0.125, -0.4375, -0.1875, 0.125, -0.375, 0.1875}, -- NodeBox4
         {-0.1875, -0.4375, -0.125, 0.1875, -0.375, 0.125}, -- NodeBox5
         {-0.0625, -0.375, -0.0625, 0.0625, -0.0625, 0.0625}, -- NodeBox6
         {-0.125, -0.0625, -0.125, 0.125, 0.0625, 0.125}, -- NodeBox7
         {-0.25, 0.0625, -0.25, 0.25, 0.25, 0.25}, -- NodeBox8
         {-0.125, 0.0625, -0.3125, 0.125, 0.25, 0.3125}, -- NodeBox9
         {-0.3125, 0.0625, -0.125, 0.3125, 0.25, 0.125}, -- NodeBox10
         {-0.125, 0.25, 0.25, 0.125, 0.5, 0.375}, -- NodeBox11
         {-0.375, 0.25, -0.125, -0.25, 0.5, 0.125}, -- NodeBox12
         {-0.125, 0.25, -0.375, 0.125, 0.5, -0.25}, -- NodeBox13
         {0.25, 0.25, -0.125, 0.375, 0.5, 0.125}, -- NodeBox14
         {0.125, 0.25, -0.3125, 0.25, 0.5, -0.1875}, -- NodeBox15
         {0.1875, 0.25, -0.25, 0.3125, 0.5, -0.125}, -- NodeBox16
         {-0.25, 0.25, -0.3125, -0.125, 0.5, -0.1875}, -- NodeBox17
         {-0.3125, 0.25, -0.25, -0.1875, 0.5, -0.125}, -- NodeBox18
         {-0.3125, 0.25, 0.125, -0.1875, 0.5, 0.25}, -- NodeBox19
         {-0.25, 0.25, 0.1875, -0.125, 0.5, 0.3125}, -- NodeBox20
         {0.1875, 0.25, 0.125, 0.3125, 0.5, 0.25}, -- NodeBox21
         {0.125, 0.25, 0.1875, 0.25, 0.5, 0.3125}, -- NodeBox22
      }
   },

selection_box = {
         type = "fixed",
         fixed = { -0.4, -0.5, -0.4, 0.4, 0.5, 0.4 },
      },
tiles = {
{name="goldgem_ruby_lamp_top_anim.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}},
{name="goldgem_ruby_lamp_bottom_anim.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}},
{name="goldgem_ruby_lamp_side_anim.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}
},
inventory_image = "tex_placeholder.png",
wield_image = "tex_placeholder.png",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
walkable = false,
light_source = 10,
groups = {choppy=2,dig_immediate=3},
--legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
})

minetest.register_node("gold_and_gem:ruby_lamp_wall", {
description = "Ruby Lamp Wall",
drawtype = "nodebox",
   node_box = {
      type = "fixed",
      fixed = {
         {-0.0625, -0.1875, -0.0625, 0.0625, -0.0625, 0.0625}, -- NodeBox6
         {-0.125, -0.0625, -0.125, 0.125, 0.0625, 0.125}, -- NodeBox7
         {-0.25, 0.0625, -0.25, 0.25, 0.25, 0.25}, -- NodeBox8
         {-0.125, 0.0625, -0.3125, 0.125, 0.25, 0.3125}, -- NodeBox9
         {-0.3125, 0.0625, -0.125, 0.3125, 0.25, 0.125}, -- NodeBox10
         {-0.125, 0.25, 0.25, 0.125, 0.5, 0.375}, -- NodeBox11
         {-0.375, 0.25, -0.125, -0.25, 0.5, 0.125}, -- NodeBox12
         {-0.125, 0.25, -0.375, 0.125, 0.5, -0.25}, -- NodeBox13
         {0.25, 0.25, -0.125, 0.375, 0.5, 0.125}, -- NodeBox14
         {0.125, 0.25, -0.3125, 0.25, 0.5, -0.1875}, -- NodeBox15
         {0.1875, 0.25, -0.25, 0.3125, 0.5, -0.125}, -- NodeBox16
         {-0.25, 0.25, -0.3125, -0.125, 0.5, -0.1875}, -- NodeBox17
         {-0.3125, 0.25, -0.25, -0.1875, 0.5, -0.125}, -- NodeBox18
         {-0.3125, 0.25, 0.125, -0.1875, 0.5, 0.25}, -- NodeBox19
         {-0.25, 0.25, 0.1875, -0.125, 0.5, 0.3125}, -- NodeBox20
         {0.1875, 0.25, 0.125, 0.3125, 0.5, 0.25}, -- NodeBox21
         {0.125, 0.25, 0.1875, 0.25, 0.5, 0.3125}, -- NodeBox22
         {-0.0625, -0.25, -0.125, 0.0625, -0.125, 0}, -- NodeBox24
         {-0.0625, -0.3125, -0.25, 0.0625, -0.1875, -0.0625}, -- NodeBox25
         {-0.0625, -0.375, -0.375, 0.0625, -0.25, -0.1875}, -- NodeBox26
         {-0.125, -0.4375, -0.5, 0.125, -0.1875, -0.375}, -- NodeBox27
         {-0.125, -0.5, -0.5, 0.125, -0.125, -0.4375}, -- NodeBox28
         {-0.1875, -0.4375, -0.5, 0.1875, -0.1875, -0.4375}, -- NodeBox29
      }
   },

selection_box = {
         type = "fixed",
         fixed = { -0.4, -0.5, -0.4, 0.4, 0.5, 0.4 },
      },
tiles = {
{name="goldgem_ruby_lamp_top_anim.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}},
{name="goldgem_ruby_lamp_wall_bottom_anim.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}},
{name="goldgem_ruby_lamp_side_anim.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}
},
inventory_image = "tex_placeholder.png",
wield_image = "tex_placeholder.png",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
walkable = false,
light_source = 10,
groups = {choppy=2,dig_immediate=3},
--legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
})


edit: forgot to post it in the mod questions topic

Re: question with creating a wall attached node

PostPosted: Fri Sep 26, 2014 20:51
by Calinou

Re: question with creating a wall attached node

PostPosted: Sat Sep 27, 2014 04:46
by LionsDen
Well, you can create two nodes and just have it change between them based on facedir. Maybe use the on_place or on_construct or something like those.

Re: question with creating a wall attached node

PostPosted: Sat Sep 27, 2014 06:15
by addi