1
0
mirror of https://codeberg.org/tenplus1/farming.git synced 2025-06-29 23:01:00 +02:00

add helper function to add {eatable}

This commit is contained in:
tenplus1
2024-07-26 16:30:53 +01:00
parent 648bae7517
commit 75e3f9fb42
41 changed files with 387 additions and 205 deletions

View File

@ -8,9 +8,9 @@ local S = farming.translate
-- potato
minetest.register_craftitem("farming:potato", {
description = S("Potato") .. " (♥1)",
description = S("Potato"),
inventory_image = "farming_potato.png",
groups = {compostability = 48, seed = 2, food_potato = 1, flammable = 2, eatable = 1},
groups = {compostability = 48, seed = 2, food_potato = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1")
end,
@ -26,14 +26,18 @@ minetest.register_craftitem("farming:potato", {
end
})
farming.add_eatable("farming:potato", 1)
-- baked potato
minetest.register_craftitem("farming:baked_potato", {
description = S("Baked Potato") .. " (♥6)",
description = S("Baked Potato"),
inventory_image = "farming_baked_potato.png",
on_use = minetest.item_eat(6),
groups = {eatable = 6}
groups = {flammable = 2}
})
farming.add_eatable("farming:baked_potato", 6)
minetest.register_craft({
type = "cooking",
cooktime = 10,
@ -43,12 +47,14 @@ minetest.register_craft({
-- Potato and cucumber Salad
minetest.register_craftitem("farming:potato_salad", {
description = S("Cucumber and Potato Salad") .. " (♥10)",
description = S("Cucumber and Potato Salad"),
inventory_image = "farming_potato_salad.png",
on_use = minetest.item_eat(10, "farming:bowl"),
groups = {eatable = 10}
groups = {flammable = 2}
})
farming.add_eatable("farming:potato_salad", 10)
minetest.register_craft({
output = "farming:potato_salad",
recipe = {