wheat.lua 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. local S = farming.intllib
  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},
  10. paramtype = "light",
  11. paramtype2 = "wallmounted",
  12. walkable = false,
  13. sunlight_propagates = true,
  14. selection_box = farming.select,
  15. on_place = function(itemstack, placer, pointed_thing)
  16. return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
  17. end
  18. })
  19. -- harvested wheat
  20. minetest.register_craftitem("farming:wheat", {
  21. description = S("Wheat"),
  22. inventory_image = "farming_wheat.png",
  23. groups = {food_wheat = 1, flammable = 4}
  24. })
  25. -- straw
  26. minetest.register_node("farming:straw", {
  27. description = S("Straw"),
  28. tiles = {"farming_straw.png"},
  29. is_ground_content = false,
  30. groups = {snappy = 3, flammable = 4, fall_damage_add_percent = -30},
  31. sounds = default.node_sound_leaves_defaults()
  32. })
  33. minetest.register_craft({
  34. output = "farming:straw 3",
  35. recipe = {
  36. {"farming:wheat", "farming:wheat", "farming:wheat"},
  37. {"farming:wheat", "farming:wheat", "farming:wheat"},
  38. {"farming:wheat", "farming:wheat", "farming:wheat"}
  39. }
  40. })
  41. minetest.register_craft({
  42. output = "farming:wheat 3",
  43. recipe = {
  44. {"farming:straw"}
  45. }
  46. })
  47. -- check and register stairs
  48. if minetest.global_exists("stairs") then
  49. if stairs.mod and stairs.mod == "redo" then
  50. stairs.register_all("straw", "farming:straw",
  51. {snappy = 3, flammable = 4},
  52. {"farming_straw.png"},
  53. "Straw",
  54. default.node_sound_leaves_defaults())
  55. else
  56. stairs.register_stair_and_slab("straw", "farming:straw",
  57. {snappy = 3, flammable = 4},
  58. {"farming_straw.png"},
  59. "Straw Stair",
  60. "Straw Slab",
  61. default.node_sound_leaves_defaults())
  62. end
  63. end
  64. -- flour
  65. minetest.register_craftitem("farming:flour", {
  66. description = S("Flour"),
  67. inventory_image = "farming_flour.png",
  68. groups = {food_flour = 1, flammable = 1}
  69. })
  70. minetest.register_craft({
  71. type = "shapeless",
  72. output = "farming:flour",
  73. recipe = {
  74. "farming:wheat", "farming:wheat", "farming:wheat",
  75. "farming:wheat", "farming:mortar_pestle"
  76. },
  77. replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
  78. })
  79. -- bread
  80. minetest.register_craftitem("farming:bread", {
  81. description = S("Bread"),
  82. inventory_image = "farming_bread.png",
  83. on_use = minetest.item_eat(5),
  84. groups = {food_bread = 1, flammable = 2}
  85. })
  86. minetest.register_craft({
  87. type = "cooking",
  88. cooktime = 15,
  89. output = "farming:bread",
  90. recipe = "farming:flour"
  91. })
  92. -- sliced bread
  93. minetest.register_craftitem("farming:bread_slice", {
  94. description = S("Sliced Bread"),
  95. inventory_image = "farming_bread_slice.png",
  96. on_use = minetest.item_eat(1),
  97. groups = {food_bread_slice = 1, flammable = 2}
  98. })
  99. minetest.register_craft({
  100. type = "shapeless",
  101. output = "farming:bread_slice 5",
  102. recipe = {"farming:bread", "group:food_cutting_board"},
  103. replacements = {{"group:food_cutting_board", "farming:cutting_board"}}
  104. })
  105. -- toast
  106. minetest.register_craftitem("farming:toast", {
  107. description = S("Toast"),
  108. inventory_image = "farming_toast.png",
  109. on_use = minetest.item_eat(1),
  110. groups = {food_toast = 1, flammable = 2}
  111. })
  112. minetest.register_craft({
  113. type = "cooking",
  114. cooktime = 3,
  115. output = "farming:toast",
  116. recipe = "farming:bread_slice"
  117. })
  118. -- toast sandwich
  119. minetest.register_craftitem("farming:toast_sandwich", {
  120. description = S("Toast Sandwich"),
  121. inventory_image = "farming_toast_sandwich.png",
  122. on_use = minetest.item_eat(4),
  123. groups = {flammable = 2}
  124. })
  125. minetest.register_craft({
  126. output = "farming:toast_sandwich",
  127. recipe = {
  128. {"farming:bread_slice"},
  129. {"farming:toast"},
  130. {"farming:bread_slice"}
  131. }
  132. })
  133. -- wheat definition
  134. local def = {
  135. drawtype = "plantlike",
  136. tiles = {"farming_wheat_1.png"},
  137. paramtype = "light",
  138. paramtype2 = "meshoptions",
  139. place_param2 = 3,
  140. sunlight_propagates = true,
  141. walkable = false,
  142. buildable_to = true,
  143. drop = "",
  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 = default.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.drop = {
  195. items = {
  196. {items = {"farming:wheat"}, rarity = 1},
  197. {items = {"farming:wheat"}, rarity = 3},
  198. {items = {"farming:seed_wheat"}, rarity = 1},
  199. {items = {"farming:seed_wheat"}, rarity = 3}
  200. }
  201. }
  202. minetest.register_node("farming:wheat_8", table.copy(def))
  203. -- add to registered_plants
  204. farming.registered_plants["farming:wheat"] = {
  205. crop = "farming:wheat",
  206. seed = "farming:seed_wheat",
  207. minlight = farming.min_light,
  208. maxlight = farming.max_light,
  209. steps = 8
  210. }
  211. -- fuels
  212. minetest.register_craft({
  213. type = "fuel",
  214. recipe = "farming:straw",
  215. burntime = 3
  216. })
  217. minetest.register_craft({
  218. type = "fuel",
  219. recipe = "farming:wheat",
  220. burntime = 1
  221. })