wheat.lua 5.9 KB

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