long_slopes.lua 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. local slope_cbox_long = {
  2. type = "fixed",
  3. fixed = {
  4. {-0.5, -0.5, -1.5, 0.5, -0.375, 0.5},
  5. {-0.5, -0.375, -1.25, 0.5, -0.25, 0.5},
  6. {-0.5, -0.25, -1, 0.5, -0.125, 0.5},
  7. {-0.5, -0.125, -0.75, 0.5, 0, 0.5},
  8. {-0.5, 0, -0.5, 0.5, 0.125, 0.5},
  9. {-0.5, 0.125, -0.25, 0.5, 0.25, 0.5},
  10. {-0.5, 0.25, 0, 0.5, 0.375, 0.5},
  11. {-0.5, 0.375, 0.25, 0.5, 0.5, 0.5},
  12. }
  13. }
  14. local icorner_cbox_long = {
  15. type = "fixed",
  16. fixed = {
  17. {-0.5, -0.5, -1.5, -0.25, 0.5, 0.5},
  18. {-0.5, -0.5, 0.25, 1.5, 0.5, 0.5},
  19. {-0.5, -0.5, 0, 1.5, 0.375, 0.5},
  20. {-0.5, -0.5, -1.5, 0, 0.375, 0.5},
  21. {-0.5, -0.5, -1.5, 0.25, 0.25, 0.5},
  22. {-0.5, -0.5, -1.5, 0.5, 0.125, 0.5},
  23. {-0.5, -0.5, -1.5, 0.75, 0, 0.5},
  24. {-0.5, -0.5, -1.5, 1, -0.125, 0.5},
  25. {-0.5, -0.5, -1.5, 1.25, -0.25, 0.5},
  26. {-0.5, -0.5, -1.5, 1.5, -0.375, 0.5},
  27. {-0.5, -0.5, -0.25, 1.5, 0.25, 0.5},
  28. {-0.5, -0.5, -0.5, 1.5, 0.125, 0.5},
  29. {-0.5, -0.5, -0.75, 1.5, 0, 0.5},
  30. {-0.5, -0.5, -1, 1.5, -0.125, 0.5},
  31. {-0.5, -0.5, -1.25, 1.5, -0.25, 0.5},
  32. }
  33. }
  34. local ocorner_cbox_long = {
  35. type = "fixed",
  36. fixed = {
  37. {-0.5, -0.5, 0.25, -0.25, 0.5, 0.5},
  38. {-0.5, -0.5, 0, 0, 0.375, 0.5},
  39. {-0.5, -0.5, -0.25, 0.25, 0.25, 0.5},
  40. {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
  41. {-0.5, -0.5, -0.75, 0.75, 0, 0.5},
  42. {-0.5, -0.5, -1, 1, -0.125, 0.5},
  43. {-0.5, -0.5, -1.25, 1.25, -0.25, 0.5},
  44. {-0.5, -0.5, -1.5, 1.5, -0.375, 0.5},
  45. }
  46. }
  47. local wood_long_slopes = { --Material , Description , Image , Item
  48. { "wood" , "Wood" , "default:wood"},
  49. { "pine_wood" , "Pinewood" , "default:pine_wood"},
  50. { "junglewood" , "Junglewood" , "default:junglewood"},
  51. { "acacia_wood" , "Acacia wood" , "default:acacia_wood"},
  52. { "aspen_wood" , "Aspen wood" , "default:aspen_wood"},
  53. }
  54. for i in ipairs(wood_long_slopes) do
  55. local mat = wood_long_slopes[i][1]
  56. local desc = wood_long_slopes[i][2]
  57. local item = wood_long_slopes[i][3]
  58. --long slope
  59. minetest.register_node("mywoodslopes:"..mat.."_slope_long", {
  60. description = desc.." Slope Long",
  61. drawtype = "mesh",
  62. mesh = "six-twelve_slope.obj",
  63. tiles = {"default_"..mat..".png"},
  64. paramtype = "light",
  65. paramtype2 = "facedir",
  66. groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
  67. sounds = default.node_sound_wood_defaults(),
  68. on_place = minetest.rotate_node,
  69. collision_box = slope_cbox_long,
  70. selection_box = slope_cbox_long
  71. })
  72. --Inside Corner Long
  73. minetest.register_node("mywoodslopes:"..mat.."_long_icorner", {
  74. description = desc.." Long Slope Inside Corner",
  75. drawtype = "mesh",
  76. mesh = "six-twelve_slope-ic.obj",
  77. tiles = {"default_"..mat..".png"},
  78. paramtype = "light",
  79. paramtype2 = "facedir",
  80. groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
  81. sounds = default.node_sound_wood_defaults(),
  82. on_place = minetest.rotate_node,
  83. collision_box = icorner_cbox_long,
  84. selection_box = icorner_cbox_long
  85. })
  86. --Outside Corner Long
  87. minetest.register_node("mywoodslopes:"..mat.."_long_ocorner", {
  88. description = desc.." Long Slope Outside Corner",
  89. drawtype = "mesh",
  90. mesh = "six-twelve_slope-oc.obj",
  91. tiles = {"default_"..mat..".png"},
  92. paramtype = "light",
  93. paramtype2 = "facedir",
  94. groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
  95. sounds = default.node_sound_wood_defaults(),
  96. on_place = minetest.rotate_node,
  97. collision_box = ocorner_cbox_long,
  98. selection_box = ocorner_cbox_long
  99. })
  100. --rotated---------------------------------------------------------------
  101. --long slope
  102. minetest.register_node("mywoodslopes:"..mat.."_slope_long_r", {
  103. description = desc.." Slope Long Rotated",
  104. drawtype = "mesh",
  105. mesh = "six-twelve_slope.obj",
  106. tiles = {"default_"..mat..".png^[transformR90"},
  107. paramtype = "light",
  108. paramtype2 = "facedir",
  109. groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
  110. sounds = default.node_sound_wood_defaults(),
  111. on_place = minetest.rotate_node,
  112. collision_box = slope_cbox_long,
  113. selection_box = slope_cbox_long
  114. })
  115. --Inside Corner Long
  116. minetest.register_node("mywoodslopes:"..mat.."_long_icorner_r", {
  117. description = desc.." Long Slope Inside Corner",
  118. drawtype = "mesh",
  119. mesh = "six-twelve_slope-ic.obj",
  120. tiles = {"default_"..mat..".png^[transformR90"},
  121. paramtype = "light",
  122. paramtype2 = "facedir",
  123. groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
  124. sounds = default.node_sound_wood_defaults(),
  125. on_place = minetest.rotate_node,
  126. collision_box = icorner_cbox_long,
  127. selection_box = icorner_cbox_long
  128. })
  129. --Outside Corner Long
  130. minetest.register_node("mywoodslopes:"..mat.."_long_ocorner_r", {
  131. description = desc.." Long Slope Outside Corner",
  132. drawtype = "mesh",
  133. mesh = "six-twelve_slope-oc.obj",
  134. tiles = {"default_"..mat..".png^[transformR90"},
  135. paramtype = "light",
  136. paramtype2 = "facedir",
  137. groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
  138. sounds = default.node_sound_wood_defaults(),
  139. on_place = minetest.rotate_node,
  140. collision_box = ocorner_cbox_long,
  141. selection_box = ocorner_cbox_long
  142. })
  143. --Crafts--------------------------------------------------------
  144. --slope long
  145. minetest.register_craft({
  146. output = "mywoodslopes:"..mat.."_slope_long 3",
  147. recipe = {
  148. {"", "",""},
  149. {item, "",""},
  150. {item, item,item},
  151. }
  152. })
  153. --slope icorner
  154. minetest.register_craft({
  155. output = "mywoodslopes:"..mat.."_long_icorner 3",
  156. recipe = {
  157. {"", item,""},
  158. {item, item,item},
  159. {item,"", item},
  160. }
  161. })
  162. --slope ocorner
  163. minetest.register_craft({
  164. output = "mywoodslopes:"..mat.."_long_ocorner 3",
  165. recipe = {
  166. {item, "",item},
  167. {item, item,item},
  168. {"", item,""},
  169. }
  170. })
  171. --rotated-----------------------------------------------
  172. --slope long
  173. minetest.register_craft({
  174. output = "mywoodslopes:"..mat.."_slope_long_r 1",
  175. recipe = {
  176. {"", "",""},
  177. {"", "mywoodslopes:"..mat.."_slope_long",""},
  178. {"", "",""},
  179. }
  180. })
  181. --slope icorner
  182. minetest.register_craft({
  183. output = "mywoodslopes:"..mat.."_long_icorner_r 1",
  184. recipe = {
  185. {"", "",""},
  186. {"", "mywoodslopes:"..mat.."_long_icorner",""},
  187. {"", "",""},
  188. }
  189. })
  190. --slope ocorner
  191. minetest.register_craft({
  192. output = "mywoodslopes:"..mat.."_long_ocorner_r 1",
  193. recipe = {
  194. {"", "",""},
  195. {"", "mywoodslopes:"..mat.."_long_ocorner",""},
  196. {"", "",""},
  197. }
  198. })
  199. end