Update cooking.lua with food_ groups and easier recipes.

This commit is contained in:
tenplus1 2018-08-12 14:23:13 +00:00
parent 9789d6da3a
commit 60c3664cbb

View File

@ -17,7 +17,7 @@ minetest.register_craftitem(":bushes:sugar", {
description = S("Sugar"), description = S("Sugar"),
inventory_image = "bushes_sugar.png", inventory_image = "bushes_sugar.png",
on_use = minetest.item_eat(1), on_use = minetest.item_eat(1),
groups = {food_sugar=1} groups = {food_sugar=1, flammable = 2}
}) })
minetest.register_craft({ minetest.register_craft({
@ -27,8 +27,33 @@ minetest.register_craft({
}, },
}) })
-- override farming_plus strawberry and add food_ group
if minetest.get_modpath("farming_plus") then
minetest.override_item("farming_plus:strawberry_item", {
groups = {food_strawberry = 1, food_berry = 1, flammable = 2},
})
end
for i, berry in ipairs(bushes_classic.bushes) do for i, berry in ipairs(bushes_classic.bushes) do
local groups = {food_berry = 1, flammable = 2}
if berry ~= "mixed_berry" then
groups["food_" .. berry] = 1
-- Berry
minetest.register_craftitem(":bushes:"..berry, {
description = bushes_classic.bushes_descriptions[i][1],
inventory_image = "bushes_"..berry..".png",
groups = groups,
on_use = minetest.item_eat(1),
})
end
-- Raw pie
minetest.register_craftitem(":bushes:"..berry.."_pie_raw", { minetest.register_craftitem(":bushes:"..berry.."_pie_raw", {
description = bushes_classic.bushes_descriptions[i][2], description = bushes_classic.bushes_descriptions[i][2],
inventory_image = "bushes_"..berry.."_pie_raw.png", inventory_image = "bushes_"..berry.."_pie_raw.png",
@ -37,58 +62,25 @@ for i, berry in ipairs(bushes_classic.bushes) do
if berry ~= "mixed_berry" then if berry ~= "mixed_berry" then
-- Special case for strawberries, blueberries and raspberries
-- when farming_plus or farming redo is in use. Use items
-- from these mods, but redefine there so they has the right
-- groups and does't look so ugly!
if berry == "strawberry" and minetest.registered_nodes["farming_plus:strawberry"] then
minetest.register_craftitem(":farming_plus:strawberry_item", {
description = bushes_classic.bushes_descriptions[i][1],
inventory_image = "bushes_"..berry..".png",
on_use = minetest.item_eat(2),
groups = {berry=1, strawberry=1}
})
minetest.register_alias("bushes:strawberry", "farming_plus:strawberry_item")
elseif berry == "blueberry" and minetest.registered_items["farming:blueberries"] then
minetest.register_craftitem(":farming:blueberries", {
description = bushes_classic.bushes_descriptions[i][1],
inventory_image = "bushes_"..berry..".png",
on_use = minetest.item_eat(1),
groups = {berry=1, blueberry=1}
})
minetest.register_alias("bushes:blueberry", "farming:blueberries")
elseif berry == "raspberry" and minetest.registered_items["farming:raspberries"] then
minetest.register_craftitem(":farming:raspberries", {
description = bushes_classic.bushes_descriptions[i][1],
inventory_image = "bushes_"..berry..".png",
on_use = minetest.item_eat(1),
groups = {berry=1, raspberry=1}
})
minetest.register_alias("bushes:raspberry", "farming:raspberries")
else
minetest.register_craftitem(":bushes:"..berry, {
description = bushes_classic.bushes_descriptions[i][1],
inventory_image = "bushes_"..berry..".png",
groups = {berry = 1, [berry] = 1},
on_use = minetest.item_eat(1),
})
end
minetest.register_craft({ minetest.register_craft({
output = "bushes:"..berry.."_pie_raw 1", output = "bushes:"..berry.."_pie_raw 1",
recipe = { recipe = {
{ "group:food_sugar", "farming:flour", "group:food_sugar" }, { "group:food_sugar", "farming:flour", "group:food_sugar" },
{ "group:"..berry, "group:"..berry, "group:"..berry }, { "group:food_"..berry, "group:food_"..berry, "group:food_"..berry },
},
})
else
minetest.register_craft({
output = "bushes:mixed_berry_pie_raw 2",
recipe = {
{ "group:food_sugar", "farming:flour", "group:food_sugar" },
{ "group:food_berry", "group:food_berry", "group:food_berry" },
{ "group:food_berry", "group:food_berry", "group:food_berry" },
}, },
}) })
end end
-- Cooked pie -- Cooked pie
minetest.register_craftitem(":bushes:"..berry.."_pie_cooked", { minetest.register_craftitem(":bushes:"..berry.."_pie_cooked", {
description = bushes_classic.bushes_descriptions[i][3], description = bushes_classic.bushes_descriptions[i][3],
inventory_image = "bushes_"..berry.."_pie_cooked.png", inventory_image = "bushes_"..berry.."_pie_cooked.png",
@ -102,8 +94,7 @@ for i, berry in ipairs(bushes_classic.bushes) do
cooktime = 30, cooktime = 30,
}) })
-- slice of pie -- Slice of pie
minetest.register_craftitem(":bushes:"..berry.."_pie_slice", { minetest.register_craftitem(":bushes:"..berry.."_pie_slice", {
description = bushes_classic.bushes_descriptions[i][4], description = bushes_classic.bushes_descriptions[i][4],
inventory_image = "bushes_"..berry.."_pie_slice.png", inventory_image = "bushes_"..berry.."_pie_slice.png",
@ -118,7 +109,6 @@ for i, berry in ipairs(bushes_classic.bushes) do
}) })
-- Basket with pies -- Basket with pies
minetest.register_craft({ minetest.register_craft({
output = "bushes:basket_"..berry.." 1", output = "bushes:basket_"..berry.." 1",
recipe = { recipe = {
@ -127,12 +117,3 @@ for i, berry in ipairs(bushes_classic.bushes) do
}, },
}) })
end end
minetest.register_craft({
output = "bushes:mixed_berry_pie_raw 2",
recipe = {
{ "group:food_sugar", "farming:flour", "group:food_sugar" },
{ "group:berry", "group:berry", "group:berry" },
{ "group:berry", "group:berry", "group:berry" },
},
})