soy.lua 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. type = "shapeless",
  19. output = "farming:soy_beans",
  20. recipe = {"farming:soy_pod"}
  21. })
  22. -- soy milk
  23. minetest.register_node("farming:soy_milk", {
  24. description = S("Soy Milk"),
  25. drawtype = "plantlike",
  26. tiles = {"farming_soy_milk_glass.png"},
  27. inventory_image = "farming_soy_milk_glass.png",
  28. wield_image = "farming_soy_milk_glass.png",
  29. paramtype = "light",
  30. walkable = false,
  31. selection_box = {
  32. type = "fixed",
  33. fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
  34. },
  35. on_use = minetest.item_eat(2, "vessels:drinking_glass"),
  36. groups = {
  37. vessel = 1, food_milk_glass = 1, dig_immediate = 3,
  38. attached_node = 1, drink = 1
  39. },
  40. sounds = default.node_sound_glass_defaults()
  41. })
  42. minetest.register_craft( {
  43. type = "shapeless",
  44. output = "farming:soy_milk",
  45. recipe = {
  46. "group:food_soy", "group:food_soy", "group:food_soy",
  47. "farming:vanilla_extract", "bucket:bucket_water", "vessels:drinking_glass"
  48. },
  49. replacements = {
  50. {"bucket:bucket_water", "bucket:bucket_empty"},
  51. {"farming:vanilla_extract", "vessels:glass_bottle"}
  52. }
  53. })
  54. -- tofu
  55. minetest.register_craftitem("farming:tofu", {
  56. description = S("Tofu"),
  57. inventory_image = "farming_tofu.png",
  58. groups = {food_tofu = 1, food_meat_raw = 1, flammable = 2},
  59. on_use = minetest.item_eat(3)
  60. })
  61. minetest.register_craft({
  62. output = "farming:tofu",
  63. type = "shapeless",
  64. recipe = {
  65. "farming:baking_tray", "group:food_soy", "group:food_soy",
  66. "group:food_soy", "group:food_soy", "group:food_soy",
  67. },
  68. replacements = {{"farming:baking_tray", "farming:baking_tray"}}
  69. })
  70. -- cooked tofu
  71. minetest.register_craftitem("farming:tofu_cooked", {
  72. description = S("Cooked Tofu"),
  73. inventory_image = "farming_tofu_cooked.png",
  74. groups = {food_meat = 1, flammable = 2},
  75. on_use = minetest.item_eat(6)
  76. })
  77. minetest.register_craft({
  78. type = "cooking",
  79. output = "farming:tofu_cooked",
  80. recipe = "farming:tofu",
  81. cooktime = 5
  82. })
  83. -- crop definition
  84. local def = {
  85. drawtype = "plantlike",
  86. tiles = {"farming_soy_1.png"},
  87. paramtype = "light",
  88. paramtype2 = "meshoptions",
  89. place_param2 = 3,
  90. sunlight_propagates = true,
  91. waving = 1,
  92. walkable = false,
  93. buildable_to = true,
  94. drop = "",
  95. selection_box = farming.select,
  96. groups = {
  97. snappy = 3, flammable = 2, plant = 1, attached_node = 1,
  98. not_in_creative_inventory = 1, growing = 1
  99. },
  100. sounds = default.node_sound_leaves_defaults()
  101. }
  102. -- stage 1
  103. minetest.register_node("farming:soy_1", table.copy(def))
  104. -- stage 2
  105. def.tiles = {"farming_soy_2.png"}
  106. minetest.register_node("farming:soy_2", table.copy(def))
  107. -- stage 3
  108. def.tiles = {"farming_soy_3.png"}
  109. minetest.register_node("farming:soy_3", table.copy(def))
  110. -- stage 4
  111. def.tiles = {"farming_soy_4.png"}
  112. minetest.register_node("farming:soy_4", table.copy(def))
  113. -- stage 5
  114. def.tiles = {"farming_soy_5.png"}
  115. def.drop = {
  116. max_items = 1, items = {
  117. {items = {'farming:soy_pod'}, rarity = 1},
  118. }
  119. }
  120. minetest.register_node("farming:soy_5", table.copy(def))
  121. -- stage 6
  122. def.tiles = {"farming_soy_6.png"}
  123. def.drop = {
  124. max_items = 3, items = {
  125. {items = {'farming:soy_pod'}, rarity = 1},
  126. {items = {'farming:soy_pod'}, rarity = 2},
  127. {items = {'farming:soy_pod'}, rarity = 3},
  128. }
  129. }
  130. minetest.register_node("farming:soy_6", table.copy(def))
  131. -- stage 7
  132. def.tiles = {"farming_soy_7.png"}
  133. def.groups.growing = nil
  134. def.drop = {
  135. max_items = 5, items = {
  136. {items = {'farming:soy_pod'}, rarity = 1},
  137. {items = {'farming:soy_pod'}, rarity = 2},
  138. {items = {'farming:soy_pod'}, rarity = 3},
  139. {items = {'farming:soy_pod'}, rarity = 4},
  140. {items = {'farming:soy_pod'}, rarity = 5}
  141. }
  142. }
  143. minetest.register_node("farming:soy_7", table.copy(def))
  144. -- add to registered_plants
  145. farming.registered_plants["farming:soy_pod"] = {
  146. crop = "farming:soy",
  147. seed = "farming:soy_pod",
  148. minlight = farming.min_light,
  149. maxlight = farming.max_light,
  150. steps = 7
  151. }