stair.lua 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. -- Node will be called <modname>:stair_<subname>
  2. function stairsplus.register_stair(modname, subname, recipeitem, groups, images, description, drop, sounds, sunlight)
  3. groups.stair = 1
  4. --
  5. -- nodes
  6. --
  7. minetest.register_node(":".. modname .. ":stair_" .. subname, {
  8. description = description,
  9. drawtype = "nodebox",
  10. tiles = images,
  11. paramtype = "light",
  12. paramtype2 = "facedir",
  13. is_ground_content = false,
  14. sunlight_propagates = sunlight,
  15. groups = groups,
  16. drop = modname .. ":stair_" .. drop,
  17. node_box = {
  18. type = "fixed",
  19. fixed = {
  20. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  21. {-0.5, 0, 0, 0.5, 0.5, 0.5},
  22. },
  23. },
  24. sounds = sounds,
  25. })
  26. minetest.register_node(":stairs:stair_" .. subname, {
  27. description = description,
  28. drawtype = "nodebox",
  29. tiles = images,
  30. paramtype = "light",
  31. paramtype2 = "facedir",
  32. is_ground_content = false,
  33. sunlight_propagates = sunlight,
  34. groups = groups,
  35. drop = ":stairs:stair_" .. drop,
  36. node_box = {
  37. type = "fixed",
  38. fixed = {
  39. {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
  40. {-0.5, 0, 0, 0.5, 0.5, 0.5},
  41. },
  42. },
  43. sounds = sounds,
  44. })
  45. minetest.register_node(":".. modname .. ":stair_" .. subname .. "_inverted", {
  46. description = description,
  47. drawtype = "nodebox",
  48. tiles = images,
  49. paramtype = "light",
  50. paramtype2 = "facedir",
  51. is_ground_content = false,
  52. sunlight_propagates = sunlight,
  53. groups = groups,
  54. drop = modname .. ":stair_" .. drop .. "_inverted",
  55. node_box = {
  56. type = "fixed",
  57. fixed = {
  58. {-0.5, 0, -0.5, 0.5, 0.5, 0.5},
  59. {-0.5, -0.5, 0, 0.5, 0, 0.5},
  60. },
  61. },
  62. sounds = sounds,
  63. })
  64. minetest.register_node(":".. modname .. ":stair_" .. subname .. "_half", {
  65. description = description,
  66. drawtype = "nodebox",
  67. tiles = images,
  68. paramtype = "light",
  69. paramtype2 = "facedir",
  70. is_ground_content = false,
  71. sunlight_propagates = sunlight,
  72. groups = groups,
  73. drop = modname .. ":stair_" .. drop .. "_half",
  74. node_box = {
  75. type = "fixed",
  76. fixed = {
  77. {-0.5, -0.5, -0.5, 0, 0, 0.5},
  78. {-0.5, 0, 0, 0, 0.5, 0.5},
  79. },
  80. },
  81. sounds = sounds,
  82. })
  83. minetest.register_node(":".. modname .. ":stair_" .. subname .. "_half_inverted", {
  84. description = description,
  85. drawtype = "nodebox",
  86. tiles = images,
  87. paramtype = "light",
  88. paramtype2 = "facedir",
  89. is_ground_content = false,
  90. sunlight_propagates = sunlight,
  91. groups = groups,
  92. drop = modname .. ":stair_" .. drop .. "_half_inverted",
  93. node_box = {
  94. type = "fixed",
  95. fixed = {
  96. {-0.5, 0, -0.5, 0, 0.5, 0.5},
  97. {-0.5, -0.5, 0, 0, 0, 0.5},
  98. },
  99. },
  100. sounds = default.node_sound_stone_defaults(),
  101. })
  102. minetest.register_node(":".. modname .. ":stair_" .. subname .. "_right_half", {
  103. description = description,
  104. drawtype = "nodebox",
  105. tiles = images,
  106. paramtype = "light",
  107. paramtype2 = "facedir",
  108. is_ground_content = false,
  109. sunlight_propagates = sunlight,
  110. groups = groups,
  111. drop = modname .. ":stair_" .. drop .. "_right_half",
  112. node_box = {
  113. type = "fixed",
  114. fixed = {
  115. {0, -0.5, -0.5, 0.5, 0, 0.5},
  116. {0, 0, 0, 0.5, 0.5, 0.5},
  117. },
  118. },
  119. sounds = sounds,
  120. })
  121. minetest.register_node(":".. modname .. ":stair_" .. subname .. "_right_half_inverted", {
  122. description = description,
  123. drawtype = "nodebox",
  124. tiles = images,
  125. paramtype = "light",
  126. paramtype2 = "facedir",
  127. is_ground_content = false,
  128. sunlight_propagates = sunlight,
  129. groups = groups,
  130. drop = modname .. ":stair_" .. drop .. "_right_half_inverted",
  131. node_box = {
  132. type = "fixed",
  133. fixed = {
  134. {0, 0, -0.5, 0.5, 0.5, 0.5},
  135. {0, -0.5, 0, 0.5, 0, 0.5},
  136. },
  137. },
  138. sounds = sounds,
  139. })
  140. --
  141. -- crafting
  142. --
  143. minetest.register_craft({
  144. output = modname .. ":stair_" .. subname .. " 8",
  145. recipe = {
  146. {recipeitem, "", ""},
  147. {recipeitem, recipeitem, ""},
  148. {recipeitem, recipeitem, recipeitem},
  149. },
  150. })
  151. minetest.register_craft({
  152. output = modname .. ":stair_" .. subname .. " 8",
  153. recipe = {
  154. {"", "", recipeitem},
  155. {"", recipeitem, recipeitem},
  156. {recipeitem, recipeitem, recipeitem},
  157. },
  158. })
  159. minetest.register_craft({
  160. output = modname .. ":stair_" .. subname .. "_inverted",
  161. recipe = {
  162. {modname .. ":stair_" .. subname},
  163. },
  164. })
  165. minetest.register_craft({
  166. output = modname .. ":stair_" .. subname,
  167. recipe = {
  168. {modname .. ":stair_" .. subname .. "_inverted"},
  169. },
  170. })
  171. minetest.register_craft({
  172. output = modname .. ":stair_" .. subname .. "_half 4 ",
  173. recipe = {
  174. {modname .. ":stair_" .. subname, modname .. ":stair_" .. subname},
  175. },
  176. })
  177. minetest.register_craft({
  178. output = modname .. ":stair_" .. subname .. "_half_inverted 4 ",
  179. recipe = {
  180. {modname .. ":stair_" .. subname .. "_inverted", modname .. ":stair_" .. subname .. "_inverted"},
  181. },
  182. })
  183. minetest.register_craft({
  184. output = modname .. ":stair_" .. subname .. "_half_inverted 1",
  185. recipe = {
  186. {modname .. ":stair_" .. subname .. "_half 1"},
  187. },
  188. })
  189. minetest.register_craft({
  190. output = modname .. ":stair_" .. subname .. "_half_inverted 1",
  191. recipe = {
  192. {modname .. ":stair_" .. subname .. "_half 1"},
  193. },
  194. })
  195. minetest.register_craft({
  196. output = modname .. ":stair_" .. subname .. "_half 1",
  197. recipe = {
  198. {modname .. ":stair_" .. subname .. "_half_inverted 1"},
  199. },
  200. })
  201. minetest.register_craft({
  202. output = modname .. ":stair_" .. subname,
  203. recipe = {
  204. {modname .. ":stair_" .. subname .. "_half", modname .. ":stair_" .. subname .. "_half"},
  205. },
  206. })
  207. minetest.register_craft({
  208. output = modname .. ":stair_" .. subname .. "_right_half 2",
  209. recipe = {
  210. {modname .. ":stair_" .. subname .. "_half"},
  211. {modname .. ":stair_" .. subname .. "_half"},
  212. },
  213. })
  214. minetest.register_craft({
  215. output = modname .. ":stair_" .. subname,
  216. recipe = {
  217. {modname .. ":stair_" .. subname .. "_right_half", modname .. ":stair_" .. subname .. "_right_half"},
  218. },
  219. })
  220. minetest.register_craft({
  221. output = modname .. ":stair_" .. subname .. "_half 2",
  222. recipe = {
  223. {modname .. ":stair_" .. subname .. "_right_half"},
  224. {modname .. ":stair_" .. subname .. "_right_half"},
  225. },
  226. })
  227. minetest.register_craft({
  228. output = modname .. ":stair_" .. subname .. "_right_half_inverted 1",
  229. recipe = {
  230. {modname .. ":stair_" .. subname .. "_right_half"},
  231. },
  232. })
  233. minetest.register_craft({
  234. output = modname .. ":stair_" .. subname .. "_right_half 1",
  235. recipe = {
  236. {modname .. ":stair_" .. subname .. "_right_half_inverted"},
  237. },
  238. })
  239. minetest.register_craft({
  240. output = modname .. ":stair_" .. subname .. "_inverted",
  241. recipe = {
  242. {modname .. ":stair_" .. subname .. "_right_half_inverted", modname .. ":stair_" .. subname .. "_right_half_inverted"},
  243. },
  244. })
  245. minetest.register_craft({
  246. output = modname .. ":stair_" .. subname .. "_half_inverted 2",
  247. recipe = {
  248. {modname .. ":stair_" .. subname .. "_right_half_inverted"},
  249. {modname .. ":stair_" .. subname .. "_right_half_inverted"},
  250. },
  251. })
  252. minetest.register_craft({
  253. output = modname .. ":stair_" .. subname .. "_inverted",
  254. recipe = {
  255. {modname .. ":stair_" .. subname .. "_half_inverted", modname .. ":stair_" .. subname .. "_half_inverted"},
  256. },
  257. })
  258. minetest.register_craft({
  259. output = modname .. ":stair_" .. subname .. "_right_half_inverted 2",
  260. recipe = {
  261. {modname .. ":stair_" .. subname .. "_half_inverted"},
  262. {modname .. ":stair_" .. subname .. "_half_inverted"},
  263. },
  264. })
  265. minetest.register_craft({
  266. output = recipeitem.." 3",
  267. recipe = {
  268. {modname .. ":stair_" .. subname, modname .. ":stair_" .. subname},
  269. {modname .. ":stair_" .. subname, modname .. ":stair_" .. subname},
  270. },
  271. })
  272. minetest.register_craft({
  273. output = recipeitem.." 3",
  274. recipe = {
  275. {modname .. ":stair_" .. subname .. "_inverted", modname .. ":stair_" .. subname .. "_inverted"},
  276. {modname .. ":stair_" .. subname .. "_inverted", modname .. ":stair_" .. subname .. "_inverted"},
  277. },
  278. })
  279. --
  280. -- cooking
  281. --
  282. minetest.register_craft({
  283. type = "cooking",
  284. output = modname .. ":stair_stone",
  285. recipe = modname .. ":stair_cobble",
  286. })
  287. minetest.register_craft({
  288. type = "cooking",
  289. output = modname .. ":stair_stone_inverted",
  290. recipe = modname .. ":stair_cobble_inverted",
  291. })
  292. minetest.register_craft({
  293. type = "cooking",
  294. output = modname .. ":stair_stone_half",
  295. recipe = modname .. ":stair_cobble_half",
  296. })
  297. minetest.register_craft({
  298. type = "cooking",
  299. output = modname .. ":stair_stone_half_inverted",
  300. recipe = modname .. ":stair_cobble_half_inverted",
  301. })
  302. minetest.register_craft({
  303. type = "cooking",
  304. output = modname .. ":stair_stone_right_half",
  305. recipe = modname .. ":stair_cobble_right_half",
  306. })
  307. minetest.register_craft({
  308. type = "cooking",
  309. output = modname .. ":stair_stone_half_inverted",
  310. recipe = modname .. ":stair_cobble_half_inverted",
  311. })
  312. end