wheat.lua 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. local S = farming.translate
  2. -- wheat seeds
  3. minetest.register_node("farming:seed_wheat", {
  4. description = S("Wheat Seed"),
  5. tiles = {"farming_wheat_seed.png"},
  6. inventory_image = "farming_wheat_seed.png",
  7. wield_image = "farming_wheat_seed.png",
  8. drawtype = "signlike",
  9. groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4, growing = 1},
  10. paramtype = "light",
  11. paramtype2 = "wallmounted",
  12. walkable = false,
  13. sunlight_propagates = true,
  14. selection_box = farming.select,
  15. next_plant = "farming:wheat_1",
  16. on_place = function(itemstack, placer, pointed_thing)
  17. return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_wheat")
  18. end
  19. })
  20. -- harvested wheat
  21. minetest.register_craftitem("farming:wheat", {
  22. description = S("Wheat"),
  23. inventory_image = "farming_wheat.png",
  24. groups = {compostability = 65, food_wheat = 1, flammable = 4}
  25. })
  26. -- straw
  27. minetest.register_node("farming:straw", {
  28. description = S("Straw"),
  29. tiles = {"farming_straw.png"},
  30. is_ground_content = false,
  31. groups = {snappy = 3, flammable = 4, fall_damage_add_percent = -30},
  32. sounds = farming.sounds.node_sound_leaves_defaults()
  33. })
  34. minetest.register_craft({
  35. output = "farming:straw 3",
  36. recipe = {
  37. {"farming:wheat", "farming:wheat", "farming:wheat"},
  38. {"farming:wheat", "farming:wheat", "farming:wheat"},
  39. {"farming:wheat", "farming:wheat", "farming:wheat"}
  40. }
  41. })
  42. minetest.register_craft({
  43. output = "farming:wheat 3",
  44. recipe = {{"farming:straw"}}
  45. })
  46. -- check and register stairs
  47. if minetest.global_exists("stairs") then
  48. if stairs.mod and stairs.mod == "redo" then
  49. stairs.register_all("straw", "farming:straw",
  50. {snappy = 3, flammable = 4},
  51. {"farming_straw.png"},
  52. "Straw",
  53. farming.sounds.node_sound_leaves_defaults())
  54. else
  55. stairs.register_stair_and_slab("straw", "farming:straw",
  56. {snappy = 3, flammable = 4},
  57. {"farming_straw.png"},
  58. "Straw Stair",
  59. "Straw Slab",
  60. farming.sounds.node_sound_leaves_defaults())
  61. end
  62. end
  63. -- flour
  64. minetest.register_craftitem("farming:flour", {
  65. description = S("Flour"),
  66. inventory_image = "farming_flour.png",
  67. groups = {compostability = 65, food_flour = 1, flammable = 1}
  68. })
  69. local tmp = farming.use_utensils and "farming:mortar_pestle" or ""
  70. minetest.register_craft({
  71. output = "farming:flour",
  72. recipe = {
  73. {"farming:wheat", "farming:wheat", "farming:wheat"},
  74. {"farming:wheat", tmp, ""}
  75. },
  76. replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
  77. })
  78. -- bread
  79. minetest.register_craftitem("farming:bread", {
  80. description = S("Bread"),
  81. inventory_image = "farming_bread.png",
  82. on_use = minetest.item_eat(5),
  83. groups = {compostability = 65, food_bread = 1, flammable = 2}
  84. })
  85. minetest.register_craft({
  86. type = "cooking",
  87. cooktime = 15,
  88. output = "farming:bread",
  89. recipe = "farming:flour"
  90. })
  91. -- sliced bread
  92. minetest.register_craftitem("farming:bread_slice", {
  93. description = S("Sliced Bread"),
  94. inventory_image = "farming_bread_slice.png",
  95. on_use = minetest.item_eat(1),
  96. groups = {compostability = 65, food_bread_slice = 1, flammable = 2}
  97. })
  98. tmp = farming.use_utensils and "farming:cutting_board" or ""
  99. minetest.register_craft({
  100. output = "farming:bread_slice 5",
  101. recipe = {{"farming:bread", tmp}},
  102. replacements = {{"group:food_cutting_board", "farming:cutting_board"}}
  103. })
  104. -- toast
  105. minetest.register_craftitem("farming:toast", {
  106. description = S("Toast"),
  107. inventory_image = "farming_toast.png",
  108. on_use = minetest.item_eat(1),
  109. groups = {compostability = 65, food_toast = 1, flammable = 2}
  110. })
  111. minetest.register_craft({
  112. type = "cooking",
  113. cooktime = 3,
  114. output = "farming:toast",
  115. recipe = "farming:bread_slice"
  116. })
  117. -- toast sandwich
  118. minetest.register_craftitem("farming:toast_sandwich", {
  119. description = S("Toast Sandwich"),
  120. inventory_image = "farming_toast_sandwich.png",
  121. on_use = minetest.item_eat(4),
  122. groups = {flammable = 2}
  123. })
  124. minetest.register_craft({
  125. output = "farming:toast_sandwich",
  126. recipe = {
  127. {"farming:bread_slice"},
  128. {"farming:toast"},
  129. {"farming:bread_slice"}
  130. }
  131. })
  132. -- wheat definition
  133. local def = {
  134. drawtype = "plantlike",
  135. tiles = {"farming_wheat_1.png"},
  136. paramtype = "light",
  137. paramtype2 = "meshoptions",
  138. place_param2 = 3,
  139. sunlight_propagates = true,
  140. walkable = false,
  141. buildable_to = true,
  142. drop = "",
  143. waving = 1,
  144. selection_box = farming.select,
  145. groups = {
  146. snappy = 3, flammable = 4, plant = 1, attached_node = 1,
  147. not_in_creative_inventory = 1, growing = 1
  148. },
  149. sounds = farming.sounds.node_sound_leaves_defaults()
  150. }
  151. -- stage 1
  152. minetest.register_node("farming:wheat_1", table.copy(def))
  153. -- stage 2
  154. def.tiles = {"farming_wheat_2.png"}
  155. minetest.register_node("farming:wheat_2", table.copy(def))
  156. -- stage 3
  157. def.tiles = {"farming_wheat_3.png"}
  158. minetest.register_node("farming:wheat_3", table.copy(def))
  159. -- stage 4
  160. def.tiles = {"farming_wheat_4.png"}
  161. minetest.register_node("farming:wheat_4", table.copy(def))
  162. -- stage 5
  163. def.tiles = {"farming_wheat_5.png"}
  164. def.drop = {
  165. items = {
  166. {items = {"farming:wheat"}, rarity = 2},
  167. {items = {"farming:seed_wheat"}, rarity = 2}
  168. }
  169. }
  170. minetest.register_node("farming:wheat_5", table.copy(def))
  171. -- stage 6
  172. def.tiles = {"farming_wheat_6.png"}
  173. def.drop = {
  174. items = {
  175. {items = {"farming:wheat"}, rarity = 2},
  176. {items = {"farming:seed_wheat"}, rarity = 1}
  177. }
  178. }
  179. minetest.register_node("farming:wheat_6", table.copy(def))
  180. -- stage 7
  181. def.tiles = {"farming_wheat_7.png"}
  182. def.drop = {
  183. items = {
  184. {items = {"farming:wheat"}, rarity = 1},
  185. {items = {"farming:wheat"}, rarity = 3},
  186. {items = {"farming:seed_wheat"}, rarity = 1},
  187. {items = {"farming:seed_wheat"}, rarity = 3}
  188. }
  189. }
  190. minetest.register_node("farming:wheat_7", table.copy(def))
  191. -- stage 8 (final)
  192. def.tiles = {"farming_wheat_8.png"}
  193. def.groups.growing = nil
  194. def.selection_box = farming.select_final
  195. def.drop = {
  196. items = {
  197. {items = {"farming:wheat"}, rarity = 1},
  198. {items = {"farming:wheat"}, rarity = 3},
  199. {items = {"farming:seed_wheat"}, rarity = 1},
  200. {items = {"farming:seed_wheat"}, rarity = 3}
  201. }
  202. }
  203. minetest.register_node("farming:wheat_8", table.copy(def))
  204. -- add to registered_plants
  205. farming.registered_plants["farming:wheat"] = {
  206. crop = "farming:wheat",
  207. seed = "farming:seed_wheat",
  208. minlight = farming.min_light,
  209. maxlight = farming.max_light,
  210. steps = 8
  211. }
  212. -- fuels
  213. minetest.register_craft({
  214. type = "fuel",
  215. recipe = "farming:straw",
  216. burntime = 3
  217. })
  218. minetest.register_craft({
  219. type = "fuel",
  220. recipe = "farming:wheat",
  221. burntime = 1
  222. })