plants.lua 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. --
  2. -- Weed
  3. --
  4. minetest.register_node("farming:weed", {
  5. description = "Weed",
  6. paramtype = "light",
  7. sunlight_propagates = true,
  8. waving = 1,
  9. walkable = false,
  10. buildable_to = true,
  11. drawtype = "plantlike",
  12. tiles = {"farming_weed.png"},
  13. inventory_image = "farming_weed.png",
  14. selection_box = {
  15. type = "fixed",
  16. fixed = {
  17. {-0.5, -0.5, -0.5, 0.5, -0.5+4/16, 0.5}
  18. },
  19. },
  20. drop = {
  21. max_items = 1,
  22. items = {
  23. { items = {'farming:wheat'}, rarity = 8 },
  24. { items = {'farming:cotton'}, rarity = 13 },
  25. }
  26. },
  27. groups = {snappy=3, flammable=2, sickle=1, falling_node=1},
  28. sounds = default.node_sound_leaves_defaults()
  29. })
  30. minetest.register_abm({
  31. nodenames = {"farming:soil_wet", "farming:soil"},
  32. interval = 23,
  33. chance = 23,
  34. action = function(pos, node)
  35. pos.y = pos.y+1
  36. if minetest.get_node(pos).name == "air" then
  37. node.name = "farming:weed"
  38. minetest.set_node(pos, node)
  39. end
  40. end
  41. })
  42. minetest.register_craft({
  43. type = "fuel",
  44. recipe = "farming:weed",
  45. burntime = 1
  46. })
  47. --
  48. -- Wheat
  49. --
  50. minetest.register_craftitem("farming:wheat", {
  51. description = "Wheat",
  52. inventory_image = "farming_wheat.png",
  53. on_place = function(itemstack, placer, pointed_thing)
  54. return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
  55. end
  56. })
  57. local max_stage = 4
  58. local stages = farming.register_stages(max_stage, "farming:wheat")
  59. minetest.override_item("farming:wheat_"..max_stage.."", {
  60. drop = {
  61. max_items = 4,
  62. items = {
  63. { items = {"farming:wheat 2"} },
  64. { items = {"farming:wheat"}, rarity = 2},
  65. { items = {"farming:wheat"}, rarity = 4},
  66. }
  67. }
  68. })
  69. -- Use different names for textures
  70. -- To be compatible with texturepacks expecting 8 stages.
  71. minetest.override_item("farming:wheat_1", {
  72. tiles = {"farming_wheat_2.png"},
  73. })
  74. minetest.override_item("farming:wheat_2", {
  75. tiles = {"farming_wheat_4.png"},
  76. })
  77. minetest.override_item("farming:wheat_3", {
  78. tiles = {"farming_wheat_6.png"},
  79. })
  80. minetest.override_item("farming:wheat_4", {
  81. tiles = {"farming_wheat_8.png"},
  82. })
  83. farming.register_growing(max_stage, stages, 57, 10, 10)
  84. minetest.register_craft({
  85. output = "farming:dough",
  86. type = "shapeless",
  87. recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"},
  88. })
  89. minetest.register_craftitem("farming:dough", {
  90. description = "Dough",
  91. inventory_image = "farming_dough.png",
  92. })
  93. minetest.register_craft({
  94. type = "cooking",
  95. output = "farming:bread",
  96. recipe = "farming:dough",
  97. cooktime = 10
  98. })
  99. minetest.register_craftitem("farming:bread", {
  100. description = "Bread",
  101. inventory_image = "farming_bread.png",
  102. on_use = minetest.item_eat(4)
  103. })
  104. minetest.register_node("farming:straw", {
  105. description = "Straw",
  106. tiles = {"farming_straw.png"},
  107. drop = "farming:wheat 9",
  108. groups = {snappy=3, fall_damage_add_percent=default.COUSHION, flammable=2},
  109. sounds = default.node_sound_leaves_defaults(),
  110. })
  111. minetest.register_alias("darkage:straw", "farming:straw")
  112. minetest.register_craft({
  113. output = "farming:straw",
  114. recipe = {
  115. {"farming:wheat", "farming:wheat", "farming:wheat"},
  116. {"farming:wheat", "farming:wheat", "farming:wheat"},
  117. {"farming:wheat", "farming:wheat", "farming:wheat"},
  118. },
  119. })
  120. minetest.register_craft({
  121. output = 'farming:wheat 9',
  122. recipe = {
  123. {'farming:straw'},
  124. }
  125. })
  126. minetest.register_craft({
  127. type = "fuel",
  128. recipe = "farming:wheat",
  129. burntime = 1
  130. })
  131. minetest.register_craft({
  132. type = "fuel",
  133. recipe = "farming:straw",
  134. burntime = 10
  135. })
  136. --
  137. -- Cotton
  138. --
  139. minetest.register_craftitem("farming:cotton", {
  140. description = "Cotton",
  141. inventory_image = "farming_cotton.png",
  142. wield_image = "farming_cotton.png",
  143. on_place = function(itemstack, placer, pointed_thing)
  144. return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1")
  145. end
  146. })
  147. local max_stage = 3
  148. local stages = {}
  149. local stages = farming.register_stages(max_stage, "farming:cotton")
  150. minetest.override_item("farming:cotton_"..max_stage.."", {
  151. after_dig_node = function(pos, node, clicker, itemstack)
  152. minetest.add_node(pos, {name="farming:cotton_1"})
  153. end
  154. })
  155. minetest.override_item("farming:cotton_"..max_stage.."", {
  156. drop = {
  157. max_items = 3,
  158. items = {
  159. { items = {"farming:cotton"} },
  160. { items = {"farming:cotton"}, rarity = 2},
  161. { items = {"farming:cotton"}, rarity = 4},
  162. }
  163. }
  164. })
  165. -- Use different names for textures
  166. -- To be compatible with texturepacks expecting 8 stages.
  167. minetest.override_item("farming:cotton_1", {
  168. tiles = {"farming_cotton_2.png"},
  169. })
  170. minetest.override_item("farming:cotton_2", {
  171. tiles = {"farming_cotton_4.png"},
  172. })
  173. minetest.override_item("farming:cotton_3", {
  174. tiles = {"farming_cotton_8.png"},
  175. })
  176. farming.register_growing(max_stage, stages, 57, 15, 10)
  177. minetest.register_craftitem("farming:string", {
  178. description = "String",
  179. inventory_image = "farming_string.png",
  180. })
  181. minetest.register_craft({
  182. output = "farming:string 2",
  183. recipe = {
  184. {"farming:cotton", "farming:cotton"},
  185. }
  186. })
  187. minetest.register_craft({
  188. output = "wool:white",
  189. recipe = {
  190. {"farming:cotton", "farming:cotton"},
  191. {"farming:cotton", "farming:cotton"}
  192. }
  193. })
  194. minetest.register_craft({
  195. type = "fuel",
  196. recipe = "farming:string",
  197. burntime = 1
  198. })
  199. minetest.register_craft({
  200. type = "fuel",
  201. recipe = "farming:cotton",
  202. burntime = 1
  203. })