blue.lua 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. minetest.register_craftitem("lottfarming:blue_mushroom_spore", {
  2. description = "Blue Mushroom Spores",
  3. inventory_image = "lottfarming_blue_mushroom_spore.png",
  4. on_place = function(itemstack, placer, pointed_thing)
  5. return place_spore(itemstack, placer, pointed_thing, "lottfarming:blue_mushroom_1", 9)
  6. end,
  7. })
  8. minetest.register_node("lottfarming:blue_mushroom", {
  9. description = "Blue Mushroom",
  10. paramtype = "light",
  11. paramtype2 = "meshoptions",
  12. place_parm2 = 9,
  13. light_source = 2,
  14. walkable = false,
  15. drawtype = "plantlike",
  16. drop = "",
  17. light_source = 2,
  18. tiles = {"lottfarming_blue_mushroom_4.png"},
  19. selection_box = {
  20. type = "fixed",
  21. fixed = {
  22. {-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5}
  23. },
  24. },
  25. groups = {snappy=3, flammable=2, mushroom=1, flower=1, color_blue=1},
  26. sounds = default.node_sound_leaves_defaults(),
  27. inventory_image = "lottfarming_blue_mushroom.png",
  28. on_use = minetest.item_eat(2),
  29. })
  30. minetest.register_node("lottfarming:blue_mushroom_1", {
  31. paramtype = "light",
  32. paramtype2 = "meshoptions",
  33. light_source = 2,
  34. walkable = false,
  35. drawtype = "plantlike",
  36. drop = "",
  37. tiles = {"lottfarming_blue_mushroom_1.png"},
  38. selection_box = {
  39. type = "fixed",
  40. fixed = {
  41. {-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5}
  42. },
  43. },
  44. groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
  45. sounds = default.node_sound_leaves_defaults(),
  46. })
  47. minetest.register_node("lottfarming:blue_mushroom_2", {
  48. paramtype = "light",
  49. paramtype2 = "meshoptions",
  50. light_source = 2,
  51. walkable = false,
  52. drawtype = "plantlike",
  53. drop = "",
  54. tiles = {"lottfarming_blue_mushroom_2.png"},
  55. selection_box = {
  56. type = "fixed",
  57. fixed = {
  58. {-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5}
  59. },
  60. },
  61. groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
  62. sounds = default.node_sound_leaves_defaults(),
  63. })
  64. minetest.register_node("lottfarming:blue_mushroom_3", {
  65. paramtype = "light",
  66. paramtype2 = "meshoptions",
  67. light_source = 2,
  68. walkable = false,
  69. drawtype = "plantlike",
  70. drop = "",
  71. tiles = {"lottfarming_blue_mushroom_3.png"},
  72. selection_box = {
  73. type = "fixed",
  74. fixed = {
  75. {-0.5, -0.5, -0.5, 0.5, -0.5+3/16, 0.5}
  76. },
  77. },
  78. groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
  79. sounds = default.node_sound_leaves_defaults(),
  80. })
  81. minetest.register_node("lottfarming:blue_mushroom_4", {
  82. paramtype = "light",
  83. paramtype2 = "meshoptions",
  84. light_source = 2,
  85. walkable = false,
  86. drawtype = "plantlike",
  87. drop = "",
  88. tiles = {"lottfarming_blue_mushroom_4.png"},
  89. after_dig_node = function(pos)
  90. end,
  91. drop = {
  92. max_items = 6,
  93. items = {
  94. { items = {'lottfarming:blue_mushroom'} },
  95. { items = {'lottfarming:blue_mushroom'}, rarity = 2},
  96. { items = {'lottfarming:blue_mushroom'}, rarity = 5},
  97. { items = {'lottfarming:blue_mushroom_spore'} },
  98. { items = {'lottfarming:blue_mushroom_spore'}, rarity = 2},
  99. { items = {'lottfarming:blue_mushroom_spore'}, rarity = 5},
  100. }
  101. },
  102. groups = {snappy=3, flammable=2, not_in_creative_inventory=1},
  103. sounds = default.node_sound_leaves_defaults(),
  104. })
  105. chance = 10
  106. interval = 30
  107. whereon = "lottfarming:decay_tree"
  108. wherein = "air"
  109. minetest.register_abm({
  110. nodenames = "lottfarming:blue_mushroom_1",
  111. interval = interval,
  112. chance = chance,
  113. action = function(pos, node)
  114. pos.y = pos.y-1
  115. if minetest.get_node(pos).name ~= "lottfarming:decay_tree" then
  116. return
  117. end
  118. pos.y = pos.y+1
  119. if not minetest.get_node_light(pos) then
  120. return
  121. end
  122. if minetest.get_node_light(pos) > 8 then
  123. return
  124. end
  125. minetest.set_node(pos, {name='lottfarming:blue_mushroom_2', param2 = 9})
  126. end
  127. })
  128. minetest.register_abm({
  129. nodenames = "lottfarming:blue_mushroom_2",
  130. interval = 30,
  131. chance = 10,
  132. action = function(pos, node)
  133. pos.y = pos.y-1
  134. if minetest.get_node(pos).name ~= "lottfarming:decay_tree" then
  135. return
  136. end
  137. pos.y = pos.y+1
  138. if not minetest.get_node_light(pos) then
  139. return
  140. end
  141. if minetest.get_node_light(pos) > 8 then
  142. return
  143. end
  144. minetest.set_node(pos, {name='lottfarming:blue_mushroom_3', param2 = 9})
  145. end
  146. })
  147. minetest.register_abm({
  148. nodenames = "lottfarming:blue_mushroom_3",
  149. interval = interval,
  150. chance = chance,
  151. action = function(pos, node)
  152. pos.y = pos.y-1
  153. if minetest.get_node(pos).name ~= "lottfarming:decay_tree"
  154. and minetest.get_node(pos).name ~= "default:tree" then
  155. return
  156. end
  157. pos.y = pos.y+1
  158. if not minetest.get_node_light(pos) then
  159. return
  160. end
  161. if minetest.get_node_light(pos) > 8 then
  162. return
  163. end
  164. minetest.set_node(pos, {name='lottfarming:blue_mushroom_4', param2 = 9})
  165. end
  166. })
  167. num = PseudoRandom(111)
  168. minetest.register_abm({
  169. nodenames = "lottfarming:blue_mushroom_3",
  170. interval = 30,
  171. chance = 10,
  172. action = function(pos, node)
  173. pos.x = pos.x + num:next(-1, 1)
  174. pos.z = pos.z + num:next(-1, 1)
  175. if minetest.get_node(pos).name=="air" then
  176. pos.y = pos.y-1
  177. name = minetest.get_node(pos).name
  178. if name=="default:tree" then
  179. pos.y=pos.y+1
  180. minetest.set_node(pos, {name='lottfarming:blue_mushroom_3', param2 = 9})
  181. end
  182. if name=="air" then
  183. pos.y=pos.y-1
  184. name = minetest.get_node(pos).name
  185. if name=="default:tree" then
  186. pos.y=pos.y+1
  187. minetest.set_node(pos, {name='lottfarming:blue_mushroom_3', param2 = 9})
  188. end
  189. end
  190. end
  191. pos.y=pos.y+1
  192. if minetest.get_node(pos).name=="air" then
  193. pos.y = pos.y-1
  194. name = minetest.get_node(pos).name
  195. if name=="default:tree" then
  196. pos.y=pos.y+1
  197. minetest.set_node(pos, {name='lottfarming:blue_mushroom_3', param2 = 9})
  198. end
  199. end
  200. end
  201. })
  202. minetest.register_craftitem("lottfarming:mushroom_soup", {
  203. description = "Cream of Mushroom Soup",
  204. inventory_image = "lottfarming_mushroom_soup.png",
  205. on_use = minetest.item_eat(6),
  206. })
  207. minetest.register_craft({
  208. output = 'lottfarming:mushroom_soup',
  209. recipe = {
  210. {'group:mushroom', 'group:mushroom', 'group:mushroom'},
  211. {'', 'lottfarming:bowl', ''},
  212. }
  213. })