brown.lua 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. minetest.register_craftitem("lottfarming:brown_mushroom_spore", {
  2. description = "Brown Mushroom Spores",
  3. inventory_image = "lottfarming_brown_mushroom_spore.png",
  4. on_place = function(itemstack, placer, pointed_thing)
  5. return place_spore(itemstack, placer, pointed_thing, "lottfarming:brown_mushroom_1", 9)
  6. end,
  7. })
  8. minetest.register_craftitem("lottfarming:brown_mushroom", {
  9. description = "Brown Mushroom",
  10. tiles = {"lottfarming_brown_mushroom_4.png"},
  11. groups = {mushroom=1, flower=1, color_brown=1},
  12. inventory_image = "lottfarming_brown_mushroom.png",
  13. on_use = minetest.item_eat(1),
  14. })
  15. minetest.register_node("lottfarming:brown_mushroom_1", {
  16. paramtype = "light",
  17. paramtype2 = "meshoptions",
  18. walkable = false,
  19. drawtype = "plantlike",
  20. drop = "",
  21. tiles = {"lottfarming_brown_mushroom_1.png"},
  22. waving = 1,
  23. selection_box = {
  24. type = "fixed",
  25. fixed = {
  26. {-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5}
  27. },
  28. },
  29. groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
  30. sounds = default.node_sound_leaves_defaults(),
  31. })
  32. minetest.register_node("lottfarming:brown_mushroom_2", {
  33. paramtype = "light",
  34. paramtype2 = "meshoptions",
  35. walkable = false,
  36. drawtype = "plantlike",
  37. drop = "",
  38. tiles = {"lottfarming_brown_mushroom_2.png"},
  39. waving = 1,
  40. selection_box = {
  41. type = "fixed",
  42. fixed = {
  43. {-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5}
  44. },
  45. },
  46. groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
  47. sounds = default.node_sound_leaves_defaults(),
  48. })
  49. minetest.register_node("lottfarming:brown_mushroom_3", {
  50. paramtype = "light",
  51. paramtype2 = "meshoptions",
  52. walkable = false,
  53. drawtype = "plantlike",
  54. drop = "",
  55. tiles = {"lottfarming_brown_mushroom_3.png"},
  56. waving = 1,
  57. selection_box = {
  58. type = "fixed",
  59. fixed = {
  60. {-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5}
  61. },
  62. },
  63. groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
  64. sounds = default.node_sound_leaves_defaults(),
  65. })
  66. minetest.register_node("lottfarming:brown_mushroom_4", {
  67. paramtype = "light",
  68. paramtype2 = "meshoptions",
  69. walkable = false,
  70. drawtype = "plantlike",
  71. drop = "",
  72. tiles = {"lottfarming_brown_mushroom_4.png"},
  73. waving = 1,
  74. after_dig_node = function(pos)
  75. end,
  76. drop = {
  77. max_items = 6,
  78. items = {
  79. { items = {'lottfarming:brown_mushroom'} },
  80. { items = {'lottfarming:brown_mushroom'}, rarity = 2},
  81. { items = {'lottfarming:brown_mushroom'}, rarity = 5},
  82. { items = {'lottfarming:brown_mushroom_spore'} },
  83. { items = {'lottfarming:brown_mushroom_spore'}, rarity = 2},
  84. { items = {'lottfarming:brown_mushroom_spore'}, rarity = 5},
  85. }
  86. },
  87. groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
  88. sounds = default.node_sound_leaves_defaults(),
  89. })
  90. chance = 10
  91. interval = 30
  92. whereon = "lottfarming:decay_tree"
  93. wherein = "air"
  94. minetest.register_abm({
  95. nodenames = "lottfarming:brown_mushroom_1",
  96. interval = interval,
  97. chance = chance,
  98. action = function(pos, node)
  99. pos.y = pos.y-1
  100. if minetest.get_node(pos).name ~= "lottfarming:decay_tree" then
  101. return
  102. end
  103. pos.y = pos.y+1
  104. if not minetest.get_node_light(pos) then
  105. return
  106. end
  107. if minetest.get_node_light(pos) > 8 then
  108. return
  109. end
  110. minetest.set_node(pos, {name='lottfarming:brown_mushroom_2', param2 = 9})
  111. end
  112. })
  113. minetest.register_abm({
  114. nodenames = "lottfarming:brown_mushroom_2",
  115. interval = 30,
  116. chance = 10,
  117. action = function(pos, node)
  118. pos.y = pos.y-1
  119. if minetest.get_node(pos).name ~= "lottfarming:decay_tree" then
  120. return
  121. end
  122. pos.y = pos.y+1
  123. if not minetest.get_node_light(pos) then
  124. return
  125. end
  126. if minetest.get_node_light(pos) > 8 then
  127. return
  128. end
  129. minetest.set_node(pos, {name='lottfarming:brown_mushroom_3', param2 = 9})
  130. end
  131. })
  132. minetest.register_abm({
  133. nodenames = "lottfarming:brown_mushroom_3",
  134. interval = interval,
  135. chance = chance,
  136. action = function(pos, node)
  137. pos.y = pos.y-1
  138. if minetest.get_node(pos).name ~= "lottfarming:decay_tree"
  139. and minetest.get_node(pos).name ~= "default:tree" then
  140. return
  141. end
  142. pos.y = pos.y+1
  143. if not minetest.get_node_light(pos) then
  144. return
  145. end
  146. if minetest.get_node_light(pos) > 8 then
  147. return
  148. end
  149. minetest.set_node(pos, {name='lottfarming:brown_mushroom_4', param2 = 9})
  150. end
  151. })
  152. num = PseudoRandom(111)
  153. minetest.register_abm({
  154. nodenames = "lottfarming:brown_mushroom_3",
  155. interval = 30,
  156. chance = 10,
  157. action = function(pos, node)
  158. pos.x = pos.x + num:next(-1, 1)
  159. pos.z = pos.z + num:next(-1, 1)
  160. if minetest.get_node(pos).name=="air" then
  161. pos.y = pos.y-1
  162. name = minetest.get_node(pos).name
  163. if name=="default:tree" then
  164. pos.y=pos.y+1
  165. minetest.set_node(pos, {name='lottfarming:brown_mushroom_3', param2 = 9})
  166. end
  167. if name=="air" then
  168. pos.y=pos.y-1
  169. name = minetest.get_node(pos).name
  170. if name=="default:tree" then
  171. pos.y=pos.y+1
  172. minetest.set_node(pos, {name='lottfarming:brown_mushroom_3', param2 = 9})
  173. end
  174. end
  175. end
  176. pos.y=pos.y+1
  177. if minetest.get_node(pos).name=="air" then
  178. pos.y = pos.y-1
  179. name = minetest.get_node(pos).name
  180. if name=="default:tree" then
  181. pos.y=pos.y+1
  182. minetest.set_node(pos, {name='lottfarming:brown_mushroom_3', param2 = 9})
  183. end
  184. end
  185. end
  186. })