misc.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. minetest.register_node('furniture:railing_straight', {
  2. description = 'Straight Railing',
  3. drawtype = 'mesh',
  4. mesh = 'furniture_railing_straight.obj',
  5. tiles = {'furniture_railing.png'},
  6. paramtype = 'light',
  7. paramtype2 = 'facedir',
  8. selection_box = {
  9. type = 'fixed',
  10. fixed = {-.5, -.5, .4375, .5, .4375, .5625},
  11. },
  12. collision_box = {
  13. type = 'fixed',
  14. fixed = {-.5, -.5, .4375, .5, 1, .5625},
  15. },
  16. groups = {oddly_breakable_by_hand = 2, choppy=3},
  17. after_place_node = function(pos, placer)
  18. if placer:get_player_control().sneak then
  19. local node = minetest.get_node(pos)
  20. local new_pos = {x = pos.x, y = pos.y+1, z = pos.z}
  21. minetest.remove_node(pos)
  22. minetest.add_node(new_pos, {name = 'furniture:railing_straight', param2 = node.param2})
  23. end
  24. end,
  25. })
  26. minetest.register_node('furniture:railing_corner', {
  27. description = 'Corner Railing',
  28. drawtype = 'mesh',
  29. mesh = 'furniture_railing_corner.obj',
  30. tiles = {'furniture_railing.png'},
  31. paramtype = 'light',
  32. paramtype2 = 'facedir',
  33. selection_box = {
  34. type = 'fixed',
  35. fixed = {{-.5, -.5, .4375, .5, .4375, .5625},
  36. {.5625, -.5, -.5, .4375, .4375, .5625}}
  37. },
  38. collision_box = {
  39. type = 'fixed',
  40. fixed = {{-.5, -.5, .4375, .5, .4375, .5625},
  41. {.5625, -.5, -.5, .4375, .4375, .5625}}
  42. },
  43. groups = {oddly_breakable_by_hand = 2, choppy=3},
  44. after_place_node = function(pos, placer)
  45. if placer:get_player_control().sneak then
  46. local node = minetest.get_node(pos)
  47. local new_pos = {x = pos.x, y = pos.y+1, z = pos.z}
  48. minetest.remove_node(pos)
  49. minetest.add_node(new_pos, {name = 'furniture:railing_corner', param2 = node.param2})
  50. end
  51. end,
  52. })