juice_recipes.lua 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. local S = minetest.get_translator("default")
  2. local recipes = {
  3. {"ethereal:olive 4", tf_recipes.glass,"ethereal:olive_oil",3},
  4. {"farming:pineapple 2", tf_recipes.glass.." 2","farming:pineapple_juice 2",3},
  5. {"farming:corn 6", tf_recipes.glass,"farming:bottle_ethanol",3},
  6. {"farming:onion 5", tf_recipes.bowl,"farming:onion_soup",3},
  7. }
  8. -- generate recipe list out of fruits and available containers
  9. for _,fruit in pairs(tf_recipes.fruits) do
  10. if minetest.registered_items[fruit[4]] then
  11. if tf_recipes.bucket ~= nil then
  12. table.insert(recipes,{fruit[4]..' 16',tf_recipes.bucket,"technic_farming:bucket_must_"..fruit[1],12})
  13. end
  14. if tf_recipes.bottle ~= nil then
  15. table.insert(recipes,{fruit[4]..' 4',tf_recipes.bottle,"technic_farming:bottle_must_"..fruit[1],4})
  16. end
  17. if tf_recipes.glass ~= nil then
  18. table.insert(recipes,{fruit[4]..' 1',tf_recipes.glass,"technic_farming:glas_must_"..fruit[1],1})
  19. end
  20. end
  21. end
  22. -- register recipes
  23. for _, data in pairs(recipes) do
  24. local juice_time = data[4] or 1
  25. local b_registered = true
  26. for i=1,3 do
  27. if data[i] then
  28. local item_name = string.split(data[i],' ')[1]
  29. b_registered = b_registered and (minetest.registered_items[item_name] ~= nil)
  30. else
  31. print(dump(data))
  32. b_registered = false
  33. end
  34. end
  35. if b_registered then
  36. technic_farming.register_juicing_recipe({input = {data[1], data[2]}, output = data[3], time = juice_time})
  37. end
  38. end