cooking.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. -- support for i18n
  2. local S = minetest.get_translator("bushes_classic")
  3. -- Basket
  4. minetest.register_craft({
  5. output = "bushes:basket_empty",
  6. recipe = {
  7. { "default:stick", "default:stick", "default:stick" },
  8. { "", "default:stick", "" },
  9. },
  10. })
  11. -- Sugar
  12. if not minetest.registered_items["farming:sugar"] then
  13. minetest.register_craftitem(":bushes:sugar", {
  14. description = S("Sugar"),
  15. inventory_image = "bushes_sugar.png",
  16. on_use = minetest.item_eat(1),
  17. groups = {food_sugar=1, flammable = 2}
  18. })
  19. minetest.register_craft({
  20. output = "bushes:sugar 1",
  21. recipe = {
  22. { "default:papyrus", "default:papyrus" },
  23. },
  24. })
  25. else
  26. minetest.register_alias("bushes:sugar", "farming:sugar")
  27. end
  28. -- override farming_plus strawberry and add food_ group
  29. if minetest.get_modpath("farming_plus") then
  30. minetest.override_item("farming_plus:strawberry_item", {
  31. groups = {food_strawberry = 1, food_berry = 1, flammable = 2},
  32. })
  33. end
  34. for i, berry in ipairs(bushes_classic.bushes) do
  35. local groups = {food_berry = 1, flammable = 2}
  36. if berry ~= "mixed_berry" then
  37. groups["food_" .. berry] = 1
  38. -- Berry
  39. minetest.register_craftitem(":bushes:"..berry, {
  40. description = bushes_classic.bushes_descriptions[i][1],
  41. inventory_image = "bushes_"..berry..".png",
  42. groups = groups,
  43. on_use = minetest.item_eat(1),
  44. })
  45. end
  46. -- Raw pie
  47. minetest.register_craftitem(":bushes:"..berry.."_pie_raw", {
  48. description = bushes_classic.bushes_descriptions[i][2],
  49. inventory_image = "bushes_"..berry.."_pie_raw.png",
  50. on_use = minetest.item_eat(4),
  51. })
  52. if berry ~= "mixed_berry" then
  53. minetest.register_craft({
  54. output = "bushes:"..berry.."_pie_raw 1",
  55. recipe = {
  56. { "group:food_sugar", "farming:flour", "group:food_sugar" },
  57. { "group:food_"..berry, "group:food_"..berry, "group:food_"..berry },
  58. },
  59. })
  60. else
  61. minetest.register_craft({
  62. output = "bushes:mixed_berry_pie_raw 2",
  63. recipe = {
  64. { "group:food_sugar", "farming:flour", "group:food_sugar" },
  65. { "group:food_berry", "group:food_berry", "group:food_berry" },
  66. { "group:food_berry", "group:food_berry", "group:food_berry" },
  67. },
  68. })
  69. end
  70. -- Cooked pie
  71. minetest.register_craftitem(":bushes:"..berry.."_pie_cooked", {
  72. description = bushes_classic.bushes_descriptions[i][3],
  73. inventory_image = "bushes_"..berry.."_pie_cooked.png",
  74. on_use = minetest.item_eat(6),
  75. })
  76. minetest.register_craft({
  77. type = "cooking",
  78. output = "bushes:"..berry.."_pie_cooked",
  79. recipe = "bushes:"..berry.."_pie_raw",
  80. cooktime = 30,
  81. })
  82. -- Slice of pie
  83. minetest.register_craftitem(":bushes:"..berry.."_pie_slice", {
  84. description = bushes_classic.bushes_descriptions[i][4],
  85. inventory_image = "bushes_"..berry.."_pie_slice.png",
  86. on_use = minetest.item_eat(1),
  87. })
  88. minetest.register_craft({
  89. output = "bushes:"..berry.."_pie_slice 6",
  90. recipe = {
  91. { "bushes:"..berry.."_pie_cooked" },
  92. },
  93. })
  94. -- Basket with pies
  95. minetest.register_craft({
  96. output = "bushes:basket_"..berry.." 1",
  97. recipe = {
  98. { "bushes:"..berry.."_pie_cooked", "bushes:"..berry.."_pie_cooked", "bushes:"..berry.."_pie_cooked" },
  99. { "", "bushes:basket_empty", "" },
  100. },
  101. })
  102. end