grass.lua 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. local slope_cbox = {
  2. type = "fixed",
  3. fixed = {
  4. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  5. {-0.5, -0.25, -0.25, 0.5, 0, 0.5},
  6. {-0.5, 0, 0, 0.5, 0.25, 0.5},
  7. {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5}
  8. }
  9. }
  10. local slope_cbox_long = {
  11. type = "fixed",
  12. fixed = {
  13. {-0.5, -0.5, -1.5, 0.5, -0.375, 0.5}, -- NodeBox1
  14. {-0.5, -0.375, -1.25, 0.5, -0.25, 0.5}, -- NodeBox2
  15. {-0.5, -0.25, -1, 0.5, -0.125, 0.5}, -- NodeBox3
  16. {-0.5, -0.125, -0.75, 0.5, 0, 0.5}, -- NodeBox4
  17. {-0.5, 0, -0.5, 0.5, 0.125, 0.5}, -- NodeBox5
  18. {-0.5, 0.125, -0.25, 0.5, 0.25, 0.5}, -- NodeBox6
  19. {-0.5, 0.25, 0, 0.5, 0.375, 0.5}, -- NodeBox7
  20. {-0.5, 0.375, 0.25, 0.5, 0.5, 0.5}, -- NodeBox8
  21. }
  22. }
  23. local icorner_cbox = {
  24. type = "fixed",
  25. fixed = {
  26. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, -- NodeBox5
  27. {-0.5, -0.5, -0.25, 0.5, 0, 0.5}, -- NodeBox6
  28. {-0.5, -0.5, -0.5, 0.25, 0, 0.5}, -- NodeBox7
  29. {-0.5, 0, -0.5, 0, 0.25, 0.5}, -- NodeBox8
  30. {-0.5, 0, 0, 0.5, 0.25, 0.5}, -- NodeBox9
  31. {-0.5, 0.25, 0.25, 0.5, 0.5, 0.5}, -- NodeBox10
  32. {-0.5, 0.25, -0.5, -0.25, 0.5, 0.5}, -- NodeBox11
  33. }
  34. }
  35. local ocorner_cbox = {
  36. type = "fixed",
  37. fixed = {
  38. {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
  39. {-0.5, -0.25, -0.25, 0.25, 0, 0.5},
  40. {-0.5, 0, 0, 0, 0.25, 0.5},
  41. {-0.5, 0.25, 0.25, -0.25, 0.5, 0.5}
  42. }
  43. }
  44. local icorner_cbox_long = {
  45. type = "fixed",
  46. fixed = {
  47. {-0.5, -0.5, -1.5, -0.25, 0.5, 0.5},
  48. {-0.5, -0.5, 0.25, 1.5, 0.5, 0.5},
  49. {-0.5, -0.5, 0, 1.5, 0.375, 0.5},
  50. {-0.5, -0.5, -1.5, 0, 0.375, 0.5},
  51. {-0.5, -0.5, -1.5, 0.25, 0.25, 0.5},
  52. {-0.5, -0.5, -1.5, 0.5, 0.125, 0.5},
  53. {-0.5, -0.5, -1.5, 0.75, 0, 0.5},
  54. {-0.5, -0.5, -1.5, 1, -0.125, 0.5},
  55. {-0.5, -0.5, -1.5, 1.25, -0.25, 0.5},
  56. {-0.5, -0.5, -1.5, 1.5, -0.375, 0.5},
  57. {-0.5, -0.5, -0.25, 1.5, 0.25, 0.5},
  58. {-0.5, -0.5, -0.5, 1.5, 0.125, 0.5},
  59. {-0.5, -0.5, -0.75, 1.5, 0, 0.5},
  60. {-0.5, -0.5, -1, 1.5, -0.125, 0.5},
  61. {-0.5, -0.5, -1.25, 1.5, -0.25, 0.5},
  62. }
  63. }
  64. local ocorner_cbox_long = {
  65. type = "fixed",
  66. fixed = {
  67. {-0.5, -0.5, 0.25, -0.25, 0.5, 0.5},
  68. {-0.5, -0.5, 0, 0, 0.375, 0.5},
  69. {-0.5, -0.5, -0.25, 0.25, 0.25, 0.5},
  70. {-0.5, -0.5, -0.5, 0.5, 0.125, 0.5},
  71. {-0.5, -0.5, -0.75, 0.75, 0, 0.5},
  72. {-0.5, -0.5, -1, 1, -0.125, 0.5},
  73. {-0.5, -0.5, -1.25, 1.25, -0.25, 0.5},
  74. {-0.5, -0.5, -1.5, 1.5, -0.375, 0.5},
  75. }
  76. }
  77. --Grass Block
  78. minetest.register_node("mypaths:grass", {
  79. description = "Fake Grass",
  80. tiles = {"default_grass.png"},
  81. drawtype = "normal",
  82. paramtype = "light",
  83. paramtype2 = "facedir",
  84. groups = {crumbly = 2, soil=1},
  85. sounds = default.node_sound_dirt_defaults({
  86. footstep = {name="default_grass_footstep", gain=0.25},
  87. }),
  88. })
  89. --Craft
  90. minetest.register_craft({
  91. output = "mypaths:grass 9",
  92. recipe = {
  93. {"default:dirt", "default:dirt","default:dirt"},
  94. {"default:dirt", "default:dirt","default:dirt"},
  95. {"default:dirt", "default:dirt","default:dirt"},
  96. }
  97. })
  98. minetest.register_node("mypaths:grass_slope", {
  99. description = "Grass slope",
  100. drawtype = "mesh",
  101. mesh = "twelve-twelve.obj",
  102. tiles = {"default_grass.png"},
  103. paramtype = "light",
  104. paramtype2 = "facedir",
  105. groups = {crumbly = 2, soil=1},
  106. sounds = default.node_sound_dirt_defaults({
  107. footstep = {name="default_grass_footstep", gain=0.25},
  108. }),
  109. on_place = minetest.rotate_node,
  110. collision_box = slope_cbox,
  111. selection_box = slope_cbox
  112. })
  113. --Craft
  114. minetest.register_craft({
  115. output = "mypaths:grass_slope 6",
  116. recipe = {
  117. {"", "","mypaths:grass"},
  118. {"", "mypaths:grass","mypaths:grass"},
  119. {"mypaths:grass", "mypaths:grass","mypaths:grass"},
  120. }
  121. })
  122. minetest.register_node("mypaths:grass_slope_long", {
  123. description = "Grass Slope Long",
  124. drawtype = "mesh",
  125. mesh = "six-twelve_slope.obj",
  126. tiles = {"default_grass.png"},
  127. paramtype = "light",
  128. paramtype2 = "facedir",
  129. groups = {crumbly = 2, soil=1},
  130. sounds = default.node_sound_dirt_defaults({
  131. footstep = {name="default_grass_footstep", gain=0.25},
  132. }),
  133. on_place = minetest.rotate_node,
  134. collision_box = slope_cbox_long,
  135. selection_box = slope_cbox_long
  136. })
  137. --Craft
  138. minetest.register_craft({
  139. output = "mypaths:grass_slope_long 1",
  140. recipe = {
  141. {"mypaths:grass_slope", "mypaths:grass_slope",""},
  142. {"", "",""},
  143. {"", "",""},
  144. }
  145. })
  146. minetest.register_node("mypaths:grass_ocorner", {
  147. description = "Grass slope (outer corner)",
  148. drawtype = "mesh",
  149. mesh = "twelve-twelve-oc.obj",
  150. tiles = {"default_grass.png"},
  151. paramtype = "light",
  152. paramtype2 = "facedir",
  153. groups = {crumbly = 2, soil=1},
  154. sounds = default.node_sound_dirt_defaults({
  155. footstep = {name="default_grass_footstep", gain=0.25},
  156. }),
  157. on_place = minetest.rotate_node,
  158. collision_box = ocorner_cbox,
  159. selection_box = ocorner_cbox
  160. })
  161. --Craft
  162. minetest.register_craft({
  163. output = "mypaths:grass_ocorner 4",
  164. recipe = {
  165. {"", "",""},
  166. {"", "mypaths:grass","mypaths:grass"},
  167. {"", "mypaths:grass","mypaths:grass"},
  168. }
  169. })
  170. minetest.register_node("mypaths:grass_icorner", {
  171. description = "Grass slope (inner corner)",
  172. drawtype = "mesh",
  173. mesh = "twelve-twelve-ic.obj",
  174. tiles = {"default_grass.png"},
  175. paramtype = "light",
  176. paramtype2 = "facedir",
  177. groups = {crumbly = 2, soil=1},
  178. sounds = default.node_sound_dirt_defaults({
  179. footstep = {name="default_grass_footstep", gain=0.25},
  180. }),
  181. on_place = minetest.rotate_node,
  182. collision_box = icorner_cbox,
  183. selection_box = icorner_cbox
  184. })
  185. --Craft
  186. minetest.register_craft({
  187. output = "mypaths:grass_icorner 5",
  188. recipe = {
  189. {"mypaths:grass", "mypaths:grass","mypaths:grass"},
  190. {"mypaths:grass", "",""},
  191. {"mypaths:grass", "",""},
  192. }
  193. })
  194. minetest.register_node("mypaths:grass_slope_long_oc", {
  195. description = "Grass Slope Long (Outer Corner)",
  196. drawtype = "mesh",
  197. mesh = "six-twelve_slope-oc.obj",
  198. tiles = {"default_grass.png"},
  199. paramtype = "light",
  200. paramtype2 = "facedir",
  201. groups = {crumbly = 2, soil=1},
  202. sounds = default.node_sound_dirt_defaults({
  203. footstep = {name="default_grass_footstep", gain=0.25},
  204. }),
  205. on_place = minetest.rotate_node,
  206. collision_box = ocorner_cbox_long,
  207. selection_box = ocorner_cbox_long
  208. })
  209. --Craft
  210. minetest.register_craft({
  211. output = "mypaths:grass_slope_long_oc 3",
  212. recipe = {
  213. {"mypaths:grass_slope", "mypaths:grass_slope","mypaths:grass_slope"},
  214. {"mypaths:grass_slope", "mypaths:grass_slope",""},
  215. {"mypaths:grass_slope", "",""},
  216. }
  217. })
  218. minetest.register_node("mypaths:grass_slope_long_ic", {
  219. description = "Grass Slope Long (Inner Corner)",
  220. drawtype = "mesh",
  221. mesh = "six-twelve_slope-ic.obj",
  222. tiles = {"default_grass.png"},
  223. paramtype = "light",
  224. paramtype2 = "facedir",
  225. groups = {crumbly = 2, soil=1},
  226. sounds = default.node_sound_dirt_defaults({
  227. footstep = {name="default_grass_footstep", gain=0.25},
  228. }),
  229. on_place = minetest.rotate_node,
  230. collision_box = icorner_cbox_long,
  231. selection_box = icorner_cbox_long
  232. })
  233. --Craft
  234. minetest.register_craft({
  235. output = "mypaths:grass_slope_long_ic 4",
  236. recipe = {
  237. {"mypaths:grass_slope", "mypaths:grass_slope","mypaths:grass_slope"},
  238. {"mypaths:grass_slope", "mypaths:grass_slope","mypaths:grass_slope"},
  239. {"mypaths:grass_slope", "mypaths:grass_slope",""},
  240. }
  241. })