init.lua 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. stairs = {}
  2. -- Node will be called stairs:stair_<subname>
  3. function stairs.register_stair(subname, recipeitem, groups, images, description)
  4. minetest.register_node("stairs:stair_" .. subname, {
  5. description = description,
  6. drawtype = "nodebox",
  7. tiles = images,
  8. paramtype = "light",
  9. paramtype2 = "facedir",
  10. is_ground_content = true,
  11. groups = groups,
  12. node_box = {
  13. type = "fixed",
  14. fixed = {
  15. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  16. {-0.5, 0, 0, 0.5, 0.5, 0.5},
  17. },
  18. },
  19. })
  20. minetest.register_craft({
  21. output = 'stairs:stair_' .. subname .. ' 4',
  22. recipe = {
  23. {recipeitem, "", ""},
  24. {recipeitem, recipeitem, ""},
  25. {recipeitem, recipeitem, recipeitem},
  26. },
  27. })
  28. end
  29. -- Node will be called stairs:slab_<subname>
  30. function stairs.register_slab(subname, recipeitem, groups, images, description)
  31. minetest.register_node("stairs:slab_" .. subname, {
  32. description = description,
  33. drawtype = "nodebox",
  34. tiles = images,
  35. paramtype = "light",
  36. is_ground_content = true,
  37. groups = groups,
  38. node_box = {
  39. type = "fixed",
  40. fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  41. },
  42. selection_box = {
  43. type = "fixed",
  44. fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  45. },
  46. })
  47. minetest.register_craft({
  48. output = 'stairs:slab_' .. subname .. ' 3',
  49. recipe = {
  50. {recipeitem, recipeitem, recipeitem},
  51. },
  52. })
  53. end
  54. -- Nodes will be called stairs:{stair,slab}_<subname>
  55. function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab)
  56. stairs.register_stair(subname, recipeitem, groups, images, desc_stair)
  57. stairs.register_slab(subname, recipeitem, groups, images, desc_slab)
  58. end
  59. stairs.register_stair_and_slab("wood", "default:wood",
  60. {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  61. {"default_wood.png"},
  62. "Wooden stair",
  63. "Wooden slab")
  64. stairs.register_stair_and_slab("stone", "default:stone",
  65. {cracky=3},
  66. {"default_stone.png"},
  67. "Stone stair",
  68. "Stone slab")
  69. stairs.register_stair_and_slab("cobble", "default:cobble",
  70. {cracky=3},
  71. {"default_cobble.png"},
  72. "Cobble stair",
  73. "Cobble slab")
  74. stairs.register_stair_and_slab("brick", "default:brick",
  75. {cracky=3},
  76. {"default_brick.png"},
  77. "Brick stair",
  78. "Brick slab")
  79. stairs.register_stair_and_slab("sandstone", "default:sandstone",
  80. {crumbly=2,cracky=2},
  81. {"default_sandstone.png"},
  82. "Sandstone stair",
  83. "Sandstone slab")