soy.lua 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. local S = farming.translate
  2. -- soy pod
  3. minetest.register_craftitem("farming:soy_pod", {
  4. description = S("Soy Pod"),
  5. inventory_image = "farming_soy_pod.png",
  6. groups = {compostability = 48, seed = 2, food_soy = 1, food_soy_pod = 1, flammable = 2},
  7. on_place = function(itemstack, placer, pointed_thing)
  8. return farming.place_seed(itemstack, placer, pointed_thing, "farming:soy_1")
  9. end
  10. })
  11. -- replacement for soy beans that was removed
  12. minetest.register_alias("farming:soy_beans", "farming:soy_pod")
  13. -- soy sauce
  14. minetest.register_node("farming:soy_sauce", {
  15. description = S("Soy Sauce"),
  16. drawtype = "plantlike",
  17. tiles = {"farming_soy_sauce.png"},
  18. inventory_image = "farming_soy_sauce.png",
  19. wield_image = "farming_soy_sauce.png",
  20. paramtype = "light",
  21. walkable = false,
  22. selection_box = {
  23. type = "fixed",
  24. fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
  25. },
  26. groups = {
  27. vessel = 1, compostability = 65, food_soy_sauce = 1, dig_immediate = 3, attached_node = 1
  28. },
  29. sounds = farming.sounds.node_sound_glass_defaults()
  30. })
  31. local tmp = farming.use_utensils and "farming:juicer" or ""
  32. -- soy sauce recipe
  33. minetest.register_craft( {
  34. output = "farming:soy_sauce",
  35. recipe = {
  36. {"group:food_soy", "group:food_salt", "group:food_soy"},
  37. {tmp, "bucket:bucket_water", "vessels:glass_bottle"}
  38. },
  39. replacements = {
  40. {"bucket:bucket_water", "bucket:bucket_empty"},
  41. {"group:food_juicer", "farming:juicer"}
  42. }
  43. })
  44. -- soy milk
  45. minetest.register_node("farming:soy_milk", {
  46. description = S("Soy Milk"),
  47. drawtype = "plantlike",
  48. tiles = {"farming_soy_milk_glass.png"},
  49. inventory_image = "farming_soy_milk_glass.png",
  50. wield_image = "farming_soy_milk_glass.png",
  51. paramtype = "light",
  52. walkable = false,
  53. selection_box = {
  54. type = "fixed",
  55. fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
  56. },
  57. on_use = minetest.item_eat(2, "vessels:drinking_glass"),
  58. groups = {
  59. vessel = 1, compostability = 65, food_milk_glass = 1, dig_immediate = 3,
  60. attached_node = 1, drink = 1
  61. },
  62. sounds = farming.sounds.node_sound_glass_defaults()
  63. })
  64. minetest.register_craft( {
  65. output = "farming:soy_milk",
  66. recipe = {
  67. {"group:food_soy", "group:food_soy", "group:food_soy"},
  68. {"farming:vanilla_extract", "bucket:bucket_water", "vessels:drinking_glass"}
  69. },
  70. replacements = {
  71. {"bucket:bucket_water", "bucket:bucket_empty"},
  72. {"farming:vanilla_extract", "vessels:glass_bottle"}
  73. }
  74. })
  75. -- tofu
  76. minetest.register_craftitem("farming:tofu", {
  77. description = S("Tofu"),
  78. inventory_image = "farming_tofu.png",
  79. groups = {compostability = 65, food_tofu = 1, food_meat_raw = 1, flammable = 2},
  80. on_use = minetest.item_eat(3)
  81. })
  82. tmp = farming.use_utensils and "farming:baking_tray" or ""
  83. minetest.register_craft({
  84. output = "farming:tofu",
  85. recipe = {
  86. {"group:food_soy", "group:food_soy", "group:food_soy"},
  87. {"group:food_soy", "group:food_soy", tmp}
  88. },
  89. replacements = {{"farming:baking_tray", "farming:baking_tray"}}
  90. })
  91. -- cooked tofu
  92. minetest.register_craftitem("farming:tofu_cooked", {
  93. description = S("Cooked Tofu"),
  94. inventory_image = "farming_tofu_cooked.png",
  95. groups = {compostability = 65, food_meat = 1, flammable = 2},
  96. on_use = minetest.item_eat(6)
  97. })
  98. minetest.register_craft({
  99. type = "cooking",
  100. output = "farming:tofu_cooked",
  101. recipe = "farming:tofu",
  102. cooktime = 5
  103. })
  104. -- crop definition
  105. local def = {
  106. drawtype = "plantlike",
  107. tiles = {"farming_soy_1.png"},
  108. paramtype = "light",
  109. paramtype2 = "meshoptions",
  110. place_param2 = 3,
  111. sunlight_propagates = true,
  112. waving = 1,
  113. walkable = false,
  114. buildable_to = true,
  115. drop = "",
  116. selection_box = farming.select,
  117. groups = {
  118. handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  119. not_in_creative_inventory = 1, growing = 1
  120. },
  121. sounds = farming.sounds.node_sound_leaves_defaults()
  122. }
  123. -- stage 1
  124. minetest.register_node("farming:soy_1", table.copy(def))
  125. -- stage 2
  126. def.tiles = {"farming_soy_2.png"}
  127. minetest.register_node("farming:soy_2", table.copy(def))
  128. -- stage 3
  129. def.tiles = {"farming_soy_3.png"}
  130. minetest.register_node("farming:soy_3", table.copy(def))
  131. -- stage 4
  132. def.tiles = {"farming_soy_4.png"}
  133. minetest.register_node("farming:soy_4", table.copy(def))
  134. -- stage 5
  135. def.tiles = {"farming_soy_5.png"}
  136. def.drop = {
  137. max_items = 1, items = {
  138. {items = {"farming:soy_pod"}, rarity = 1},
  139. }
  140. }
  141. minetest.register_node("farming:soy_5", table.copy(def))
  142. -- stage 6
  143. def.tiles = {"farming_soy_6.png"}
  144. def.drop = {
  145. max_items = 3, items = {
  146. {items = {"farming:soy_pod"}, rarity = 1},
  147. {items = {"farming:soy_pod"}, rarity = 2},
  148. {items = {"farming:soy_pod"}, rarity = 3}
  149. }
  150. }
  151. minetest.register_node("farming:soy_6", table.copy(def))
  152. -- stage 7
  153. def.tiles = {"farming_soy_7.png"}
  154. def.groups.growing = nil
  155. def.selection_box = farming.select_final
  156. def.drop = {
  157. max_items = 5, items = {
  158. {items = {"farming:soy_pod"}, rarity = 1},
  159. {items = {"farming:soy_pod"}, rarity = 2},
  160. {items = {"farming:soy_pod"}, rarity = 3},
  161. {items = {"farming:soy_pod"}, rarity = 4},
  162. {items = {"farming:soy_pod"}, rarity = 5}
  163. }
  164. }
  165. minetest.register_node("farming:soy_7", table.copy(def))
  166. -- add to registered_plants
  167. farming.registered_plants["farming:soy_pod"] = {
  168. crop = "farming:soy",
  169. seed = "farming:soy_pod",
  170. minlight = farming.min_light,
  171. maxlight = farming.max_light,
  172. steps = 7
  173. }
  174. -- mapgen
  175. local mg = farming.mapgen == "v6"
  176. def = {
  177. spawn_on = mg and {"default:dirt_with_grass"} or {"default:dirt_with_dry_grass",
  178. "default:dirt_with_rainforest_litter", "default:dry_dirt_with_dry_grass"}
  179. }
  180. minetest.register_decoration({
  181. deco_type = "simple",
  182. place_on = def.spawn_on,
  183. sidelen = 16,
  184. noise_params = {
  185. offset = 0,
  186. scale = farming.soy,
  187. spread = {x = 100, y = 100, z = 100},
  188. seed = 809,
  189. octaves = 3,
  190. persist = 0.6
  191. },
  192. y_min = 20,
  193. y_max = 50,
  194. decoration = "farming:soy_6"
  195. })