soy.lua 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. local S = farming.intllib
  2. -- soy pod
  3. minetest.register_craftitem("farming:soy_pod", {
  4. description = S("Soy Pod"),
  5. inventory_image = "farming_soy_pod.png",
  6. groups = {seed = 2, 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. minetest.register_craftitem("farming:soy_beans", {
  12. description = S("Soy Beans"),
  13. inventory_image = "farming_soy_beans.png",
  14. groups = {food_soy = 1, flammable = 2},
  15. on_use = minetest.item_eat(1)
  16. })
  17. minetest.register_craft({
  18. output = "farming:soy_beans",
  19. recipe = {{"farming:soy_pod"}}
  20. })
  21. -- soy sauce
  22. minetest.register_node("farming:soy_sauce", {
  23. description = S("Soy Sauce"),
  24. drawtype = "plantlike",
  25. tiles = {"farming_soy_sauce.png"},
  26. inventory_image = "farming_soy_sauce.png",
  27. wield_image = "farming_soy_sauce.png",
  28. paramtype = "light",
  29. walkable = false,
  30. selection_box = {
  31. type = "fixed",
  32. fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
  33. },
  34. groups = {
  35. vessel = 1, food_soy_sauce = 1, dig_immediate = 3, attached_node = 1
  36. },
  37. sounds = default.node_sound_glass_defaults()
  38. })
  39. -- river water availability check
  40. local bucket_water
  41. if minetest.get_mapgen_setting("mgname") == "valleys"
  42. or minetest.get_modpath("ethereal") then
  43. bucket_water = "bucket:bucket_river_water"
  44. else
  45. bucket_water = "bucket:bucket_water"
  46. end
  47. -- soy sauce recipe
  48. minetest.register_craft( {
  49. output = "farming:soy_sauce",
  50. recipe = {
  51. {"group:food_soy", "group:food_salt", "group:food_soy"},
  52. {"", "group:food_juicer", ""},
  53. {"", bucket_water, "vessels:glass_bottle"}
  54. },
  55. replacements = {
  56. {bucket_water, "bucket:bucket_empty"},
  57. {"group:food_juicer", "farming:juicer"}
  58. }
  59. })
  60. -- soy milk
  61. minetest.register_node("farming:soy_milk", {
  62. description = S("Soy Milk"),
  63. drawtype = "plantlike",
  64. tiles = {"farming_soy_milk_glass.png"},
  65. inventory_image = "farming_soy_milk_glass.png",
  66. wield_image = "farming_soy_milk_glass.png",
  67. paramtype = "light",
  68. walkable = false,
  69. selection_box = {
  70. type = "fixed",
  71. fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
  72. },
  73. on_use = minetest.item_eat(2, "vessels:drinking_glass"),
  74. groups = {
  75. vessel = 1, food_milk_glass = 1, dig_immediate = 3,
  76. attached_node = 1, drink = 1
  77. },
  78. sounds = default.node_sound_glass_defaults()
  79. })
  80. minetest.register_craft( {
  81. output = "farming:soy_milk",
  82. recipe = {
  83. {"group:food_soy", "group:food_soy", "group:food_soy"},
  84. {"farming:vanilla_extract", "bucket:bucket_water", "vessels:drinking_glass"}
  85. },
  86. replacements = {
  87. {"bucket:bucket_water", "bucket:bucket_empty"},
  88. {"farming:vanilla_extract", "vessels:glass_bottle"}
  89. }
  90. })
  91. -- tofu
  92. minetest.register_craftitem("farming:tofu", {
  93. description = S("Tofu"),
  94. inventory_image = "farming_tofu.png",
  95. groups = {food_tofu = 1, food_meat_raw = 1, flammable = 2},
  96. on_use = minetest.item_eat(3)
  97. })
  98. minetest.register_craft({
  99. output = "farming:tofu",
  100. recipe = {
  101. {"farming:baking_tray", "group:food_soy", "group:food_soy"},
  102. {"group:food_soy", "group:food_soy", "group:food_soy"}
  103. },
  104. replacements = {{"farming:baking_tray", "farming:baking_tray"}}
  105. })
  106. -- cooked tofu
  107. minetest.register_craftitem("farming:tofu_cooked", {
  108. description = S("Cooked Tofu"),
  109. inventory_image = "farming_tofu_cooked.png",
  110. groups = {food_meat = 1, flammable = 2},
  111. on_use = minetest.item_eat(6)
  112. })
  113. minetest.register_craft({
  114. type = "cooking",
  115. output = "farming:tofu_cooked",
  116. recipe = "farming:tofu",
  117. cooktime = 5
  118. })
  119. -- crop definition
  120. local def = {
  121. drawtype = "plantlike",
  122. tiles = {"farming_soy_1.png"},
  123. paramtype = "light",
  124. paramtype2 = "meshoptions",
  125. place_param2 = 3,
  126. sunlight_propagates = true,
  127. waving = 1,
  128. walkable = false,
  129. buildable_to = true,
  130. drop = "",
  131. selection_box = farming.select,
  132. groups = {
  133. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  134. not_in_creative_inventory = 1, growing = 1
  135. },
  136. sounds = default.node_sound_leaves_defaults()
  137. }
  138. -- stage 1
  139. minetest.register_node("farming:soy_1", table.copy(def))
  140. -- stage 2
  141. def.tiles = {"farming_soy_2.png"}
  142. minetest.register_node("farming:soy_2", table.copy(def))
  143. -- stage 3
  144. def.tiles = {"farming_soy_3.png"}
  145. minetest.register_node("farming:soy_3", table.copy(def))
  146. -- stage 4
  147. def.tiles = {"farming_soy_4.png"}
  148. minetest.register_node("farming:soy_4", table.copy(def))
  149. -- stage 5
  150. def.tiles = {"farming_soy_5.png"}
  151. def.drop = {
  152. max_items = 1, items = {
  153. {items = {"farming:soy_pod"}, rarity = 1},
  154. }
  155. }
  156. minetest.register_node("farming:soy_5", table.copy(def))
  157. -- stage 6
  158. def.tiles = {"farming_soy_6.png"}
  159. def.drop = {
  160. max_items = 3, items = {
  161. {items = {"farming:soy_pod"}, rarity = 1},
  162. {items = {"farming:soy_pod"}, rarity = 2},
  163. {items = {"farming:soy_pod"}, rarity = 3},
  164. }
  165. }
  166. minetest.register_node("farming:soy_6", table.copy(def))
  167. -- stage 7
  168. def.tiles = {"farming_soy_7.png"}
  169. def.groups.growing = nil
  170. def.drop = {
  171. max_items = 5, items = {
  172. {items = {"farming:soy_pod"}, rarity = 1},
  173. {items = {"farming:soy_pod"}, rarity = 2},
  174. {items = {"farming:soy_pod"}, rarity = 3},
  175. {items = {"farming:soy_pod"}, rarity = 4},
  176. {items = {"farming:soy_pod"}, rarity = 5}
  177. }
  178. }
  179. minetest.register_node("farming:soy_7", table.copy(def))
  180. -- add to registered_plants
  181. farming.registered_plants["farming:soy_pod"] = {
  182. crop = "farming:soy",
  183. seed = "farming:soy_pod",
  184. minlight = farming.min_light,
  185. maxlight = farming.max_light,
  186. steps = 7
  187. }