1
0
mirror of https://codeberg.org/tenplus1/farming.git synced 2024-12-27 03:00:20 +01: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,29 +8,12 @@ local alias = function(orig, new)
minetest.register_alias(orig, new) minetest.register_alias(orig, new)
end end
--= Add {eatable} group to default apple, blueberries and brown mushroom --= Add {eatable} group to default food items if found
local function add_grp(item, hp)
local def = minetest.registered_items[item]
if def then
def.groups.eatable = hp
def.description = def.description .. " (♥" .. hp .. ")"
minetest.override_item(item, {
description = def.description,
groups = def.groups
})
end
end
add_grp("default:apple", 2)
add_grp("default:blueberries", 1)
add_grp("flowers:mushroom_brown", 1)
add_grp("flowers:mushroom_red", -5)
farming.add_eatable("default:apple", 2)
farming.add_eatable("default:blueberries", 1)
farming.add_eatable("flowers:mushroom_brown", 1)
farming.add_eatable("flowers:mushroom_red", -5)
--= Aliases --= Aliases
@ -41,7 +24,7 @@ if eth then
alias("farming_plus:banana", "ethereal:banana") alias("farming_plus:banana", "ethereal:banana")
else else
minetest.register_node(":ethereal:banana", { minetest.register_node(":ethereal:banana", {
description = S("Banana") .. " (♥2)", description = S("Banana"),
drawtype = "torchlike", drawtype = "torchlike",
tiles = {"farming_banana_single.png"}, tiles = {"farming_banana_single.png"},
inventory_image = "farming_banana_single.png", inventory_image = "farming_banana_single.png",
@ -54,13 +37,15 @@ else
fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2} fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2}
}, },
groups = { groups = {
food_banana = 1, fleshy = 3, dig_immediate = 3, flammable = 2, eatable = 2 food_banana = 1, fleshy = 3, dig_immediate = 3
}, },
is_ground_content = false, is_ground_content = false,
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),
sounds = farming.sounds.node_sound_leaves_defaults() sounds = farming.sounds.node_sound_leaves_defaults()
}) })
farming.add_eatable("ethereal:banana", 2)
minetest.register_node(":ethereal:bananaleaves", { minetest.register_node(":ethereal:bananaleaves", {
description = S("Banana Leaves"), description = S("Banana Leaves"),
tiles = {"farming_banana_leaf.png"}, tiles = {"farming_banana_leaf.png"},
@ -103,7 +88,7 @@ if eth then
alias("farming_plus:orange_seed", "ethereal:orange_tree_sapling") alias("farming_plus:orange_seed", "ethereal:orange_tree_sapling")
else else
minetest.register_node(":ethereal:orange", { minetest.register_node(":ethereal:orange", {
description = S("Orange") .. " (♥4)", description = S("Orange"),
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_orange.png"}, tiles = {"farming_orange.png"},
inventory_image = "farming_orange.png", inventory_image = "farming_orange.png",
@ -116,13 +101,15 @@ else
fixed = {-0.2, -0.3, -0.2, 0.2, 0.2, 0.2} fixed = {-0.2, -0.3, -0.2, 0.2, 0.2, 0.2}
}, },
groups = { groups = {
food_orange = 1, fleshy = 3, dig_immediate = 3, flammable = 2, eatable = 4 food_orange = 1, fleshy = 3, dig_immediate = 3, flammable = 2
}, },
is_ground_content = false, is_ground_content = false,
on_use = minetest.item_eat(4), on_use = minetest.item_eat(4),
sounds = farming.sounds.node_sound_leaves_defaults() sounds = farming.sounds.node_sound_leaves_defaults()
}) })
farming.add_eatable("ethereal:orange", 4)
alias("farming_plus:orange_item", "ethereal:orange") alias("farming_plus:orange_item", "ethereal:orange")
alias("farming_plus:orange", "ethereal:orange") alias("farming_plus:orange", "ethereal:orange")
alias("farming_plus:orange_seed", "default:sapling") alias("farming_plus:orange_seed", "default:sapling")

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- item definition -- item definition
minetest.register_craftitem("farming:artichoke", { minetest.register_craftitem("farming:artichoke", {
description = S("Artichoke") .. " (♥4)", description = S("Artichoke"),
inventory_image = "farming_artichoke.png", inventory_image = "farming_artichoke.png",
groups = { groups = {
compostability = 48, seed = 2, food_artichoke = 1, flammable = 2, eatable = 4 compostability = 48, seed = 2, food_artichoke = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:artichoke_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:artichoke_1")
@ -14,6 +14,8 @@ minetest.register_craftitem("farming:artichoke", {
on_use = minetest.item_eat(4) on_use = minetest.item_eat(4)
}) })
farming.add_eatable("farming:artichoke", 4)
-- crop definition -- crop definition
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- asparagus -- asparagus
minetest.register_craftitem("farming:asparagus", { minetest.register_craftitem("farming:asparagus", {
description = S("Asparagus") .. " (♥1)", description = S("Asparagus"),
inventory_image = "farming_asparagus.png", inventory_image = "farming_asparagus.png",
groups = { groups = {
compostability = 48, seed = 2, food_asparagus = 1, flammable = 2, eatable = 1 compostability = 48, seed = 2, food_asparagus = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:asparagus_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:asparagus_1")
@ -14,6 +14,8 @@ minetest.register_craftitem("farming:asparagus", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:asparagus", 1)
-- asparagus definition -- asparagus definition
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",

View File

@ -70,15 +70,17 @@ end
-- beans -- beans
minetest.register_craftitem("farming:beans", { minetest.register_craftitem("farming:beans", {
description = S("Green Beans" .. " (♥1)"), description = S("Green Beans"),
inventory_image = "farming_beans.png", inventory_image = "farming_beans.png",
groups = {compostability = 48, seed = 2, food_beans = 1, flammable = 2, eatable = 1}, groups = {compostability = 48, seed = 2, food_beans = 1, flammable = 2},
on_use = minetest.item_eat(1), on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1") return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1")
end end
}) })
farming.add_eatable("farming:beans", 1)
-- beans can be used for green dye -- beans can be used for green dye
minetest.register_craft({ minetest.register_craft({
output = a.dye_green, output = a.dye_green,

View File

@ -4,10 +4,10 @@ local a = farming.recipe_items
-- beetroot -- beetroot
minetest.register_craftitem("farming:beetroot", { minetest.register_craftitem("farming:beetroot", {
description = S("Beetroot") .. " (♥1)", description = S("Beetroot"),
inventory_image = "farming_beetroot.png", inventory_image = "farming_beetroot.png",
groups = { groups = {
compostability = 48, seed = 2, food_beetroot = 1, flammable = 2, eatable = 1 compostability = 48, seed = 2, food_beetroot = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:beetroot_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:beetroot_1")
@ -15,14 +15,18 @@ minetest.register_craftitem("farming:beetroot", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:beetroot", 1)
-- beetroot soup -- beetroot soup
minetest.register_craftitem("farming:beetroot_soup", { minetest.register_craftitem("farming:beetroot_soup", {
description = S("Beetroot Soup") .. " (♥6)", description = S("Beetroot Soup"),
inventory_image = "farming_beetroot_soup.png", inventory_image = "farming_beetroot_soup.png",
groups = {flammable = 2, eatable = 6}, groups = {flammable = 2},
on_use = minetest.item_eat(6, "farming:bowl") on_use = minetest.item_eat(6, "farming:bowl")
}) })
farming.add_eatable("farming:beetroot_soup", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:beetroot_soup", output = "farming:beetroot_soup",
recipe = { recipe = {

View File

@ -3,11 +3,11 @@ local S = farming.translate
-- blackberries -- blackberries
minetest.register_craftitem("farming:blackberry", { minetest.register_craftitem("farming:blackberry", {
description = S("Blackberries" .. " (♥1)"), description = S("Blackberries"),
inventory_image = "farming_blackberry.png", inventory_image = "farming_blackberry.png",
groups = { groups = {
compostability = 48, seed = 2, food_blackberries = 1, food_blackberry = 1, compostability = 48, seed = 2, food_blackberries = 1, food_blackberry = 1,
food_berry = 1, flammable = 2, eatable = 1 food_berry = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:blackberry_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:blackberry_1")
@ -15,6 +15,8 @@ minetest.register_craftitem("farming:blackberry", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:blackberry", 1)
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_blackberry_1.png"}, tiles = {"farming_blackberry_1.png"},

View File

@ -4,11 +4,11 @@ local a = farming.recipe_items
-- blueberries -- blueberries
minetest.register_craftitem("farming:blueberries", { minetest.register_craftitem("farming:blueberries", {
description = S("Wild Blueberries") .. " (♥1)", description = S("Wild Blueberries"),
inventory_image = "farming_blueberries.png", inventory_image = "farming_blueberries.png",
groups = { groups = {
compostability = 48,seed = 2, food_blueberries = 1, food_blueberry = 1, compostability = 48,seed = 2, food_blueberries = 1, food_blueberry = 1,
food_berry = 1, flammable = 2, eatable = 1 food_berry = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1")
@ -16,14 +16,18 @@ minetest.register_craftitem("farming:blueberries", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:blueberries", 1)
-- blueberry muffin (thanks to sosogirl123 @ deviantart.com for muffin image) -- blueberry muffin (thanks to sosogirl123 @ deviantart.com for muffin image)
minetest.register_craftitem("farming:muffin_blueberry", { minetest.register_craftitem("farming:muffin_blueberry", {
description = S("Blueberry Muffin") .. " (♥2)", description = S("Blueberry Muffin"),
inventory_image = "farming_blueberry_muffin.png", inventory_image = "farming_blueberry_muffin.png",
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),
groups = {compostability = 65, eatable = 2} groups = {compostability = 65}
}) })
farming.add_eatable("farming:muffin_blueberry", 2)
minetest.register_craft({ minetest.register_craft({
output = "farming:muffin_blueberry 2", output = "farming:muffin_blueberry 2",
recipe = { recipe = {
@ -33,12 +37,14 @@ minetest.register_craft({
-- Blueberry Pie -- Blueberry Pie
minetest.register_craftitem("farming:blueberry_pie", { minetest.register_craftitem("farming:blueberry_pie", {
description = S("Blueberry Pie") .. " (♥6)", description = S("Blueberry Pie"),
inventory_image = "farming_blueberry_pie.png", inventory_image = "farming_blueberry_pie.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
groups = {compostability = 75, eatable = 6} groups = {compostability = 75}
}) })
farming.add_eatable("farming:blueberry_pie", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:blueberry_pie", output = "farming:blueberry_pie",
recipe = { recipe = {

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- cabbage -- cabbage
minetest.register_craftitem("farming:cabbage", { minetest.register_craftitem("farming:cabbage", {
description = S("Cabbage") .. " (♥1)", description = S("Cabbage"),
inventory_image = "farming_cabbage.png", inventory_image = "farming_cabbage.png",
groups = { groups = {
compostability = 48, seed = 2, food_cabbage = 1, flammable = 2, eatable = 1 compostability = 48, seed = 2, food_cabbage = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cabbage_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:cabbage_1")
@ -14,6 +14,8 @@ minetest.register_craftitem("farming:cabbage", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:cabbage", 1)
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_cabbage_1.png"}, tiles = {"farming_cabbage_1.png"},

View File

@ -9,10 +9,10 @@ local a = farming.recipe_items
-- carrot -- carrot
minetest.register_craftitem("farming:carrot", { minetest.register_craftitem("farming:carrot", {
description = S("Carrot") .. " (♥4)", description = S("Carrot"),
inventory_image = "farming_carrot.png", inventory_image = "farming_carrot.png",
groups = { groups = {
compostability = 48, seed = 2, food_carrot = 1, flammable = 2, eatable = 4 compostability = 48, seed = 2, food_carrot = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1")
@ -20,14 +20,18 @@ minetest.register_craftitem("farming:carrot", {
on_use = minetest.item_eat(4) on_use = minetest.item_eat(4)
}) })
farming.add_eatable("farming:carrot", 4)
-- carrot juice -- carrot juice
minetest.register_craftitem("farming:carrot_juice", { minetest.register_craftitem("farming:carrot_juice", {
description = S("Carrot Juice") .. " (♥4)", description = S("Carrot Juice"),
inventory_image = "farming_carrot_juice.png", inventory_image = "farming_carrot_juice.png",
on_use = minetest.item_eat(4, "vessels:drinking_glass"), on_use = minetest.item_eat(4, "vessels:drinking_glass"),
groups = {vessel = 1, drink = 1, eatable = 4} groups = {vessel = 1, drink = 1}
}) })
farming.add_eatable("farming:carrot_juice", 4)
minetest.register_craft({ minetest.register_craft({
output = "farming:carrot_juice", output = "farming:carrot_juice",
recipe = { recipe = {
@ -42,12 +46,14 @@ minetest.register_craft({
-- golden carrot -- golden carrot
minetest.register_craftitem("farming:carrot_gold", { minetest.register_craftitem("farming:carrot_gold", {
description = S("Golden Carrot") .. " (♥10)", description = S("Golden Carrot"),
inventory_image = "farming_carrot_gold.png", inventory_image = "farming_carrot_gold.png",
on_use = minetest.item_eat(10), on_use = minetest.item_eat(10),
groups = {eatable = 10} groups = {flammable = 2}
}) })
farming.add_eatable("farming:carrot_gold", 10)
minetest.register_craft({ minetest.register_craft({
output = "farming:carrot_gold", output = "farming:carrot_gold",
recipe = {{"group:food_carrot", "default:gold_lump"}} recipe = {{"group:food_carrot", "default:gold_lump"}}

View File

@ -4,10 +4,10 @@ local a = farming.recipe_items
-- chili pepper -- chili pepper
minetest.register_craftitem("farming:chili_pepper", { minetest.register_craftitem("farming:chili_pepper", {
description = S("Chili Pepper") .. " (♥2)", description = S("Chili Pepper"),
inventory_image = "farming_chili_pepper.png", inventory_image = "farming_chili_pepper.png",
groups = { groups = {
compostability = 48, seed = 2, food_chili_pepper = 1, flammable = 4, eatable = 2 compostability = 48, seed = 2, food_chili_pepper = 1, flammable = 4
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:chili_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:chili_1")
@ -15,14 +15,18 @@ minetest.register_craftitem("farming:chili_pepper", {
on_use = minetest.item_eat(2) on_use = minetest.item_eat(2)
}) })
farming.add_eatable("farming:chili_pepper", 2)
-- bowl of chili -- bowl of chili
minetest.register_craftitem("farming:chili_bowl", { minetest.register_craftitem("farming:chili_bowl", {
description = S("Bowl of Chili") .. " (♥8)", description = S("Bowl of Chili"),
inventory_image = "farming_chili_bowl.png", inventory_image = "farming_chili_bowl.png",
on_use = minetest.item_eat(8, a.bowl), on_use = minetest.item_eat(8, a.bowl),
groups = {compostability = 65, eatable = 8} groups = {compostability = 65}
}) })
farming.add_eatable("farming:chili_bowl", 8)
minetest.register_craft({ minetest.register_craft({
output = "farming:chili_bowl", output = "farming:chili_bowl",
recipe = { recipe = {

View File

@ -94,12 +94,14 @@ minetest.register_craft( {
-- chocolate cookie -- chocolate cookie
minetest.register_craftitem("farming:cookie", { minetest.register_craftitem("farming:cookie", {
description = S("Cookie") .. " (♥2)", description = S("Cookie"),
inventory_image = "farming_cookie.png", inventory_image = "farming_cookie.png",
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),
groups = {eatable = 2} groups = {flammable = 2}
}) })
farming.add_eatable("farming:cookie", 2)
minetest.register_craft( { minetest.register_craft( {
output = "farming:cookie 8", output = "farming:cookie 8",
recipe = { recipe = {
@ -109,12 +111,14 @@ minetest.register_craft( {
-- bar of dark chocolate (thanks to Ice Pandora for her deviantart.com chocolate tutorial) -- bar of dark chocolate (thanks to Ice Pandora for her deviantart.com chocolate tutorial)
minetest.register_craftitem("farming:chocolate_dark", { minetest.register_craftitem("farming:chocolate_dark", {
description = S("Bar of Dark Chocolate") .. " (♥3)", description = S("Bar of Dark Chocolate"),
inventory_image = "farming_chocolate_dark.png", inventory_image = "farming_chocolate_dark.png",
on_use = minetest.item_eat(3), on_use = minetest.item_eat(3),
groups = {eatable = 3} groups = {flammable = 2}
}) })
farming.add_eatable("farming:chocolate_dark", 3)
minetest.register_craft( { minetest.register_craft( {
output = "farming:chocolate_dark", output = "farming:chocolate_dark",
recipe = { recipe = {

View File

@ -14,7 +14,7 @@ minetest.register_craftitem("farming:coffee_beans", {
-- cup of coffee -- cup of coffee
minetest.register_node("farming:coffee_cup", { minetest.register_node("farming:coffee_cup", {
description = S("Cup of Coffee") .. " (♥2)", description = S("Cup of Coffee"),
drawtype = "torchlike", drawtype = "torchlike",
tiles = {"farming_coffee_cup.png"}, tiles = {"farming_coffee_cup.png"},
inventory_image = "farming_coffee_cup.png", inventory_image = "farming_coffee_cup.png",
@ -25,12 +25,14 @@ minetest.register_node("farming:coffee_cup", {
type = "fixed", type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25} fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
}, },
groups = {vessel = 1, dig_immediate = 3, attached_node = 1, drink = 1, eatable = 2}, groups = {vessel = 1, dig_immediate = 3, attached_node = 1, drink = 1},
is_ground_content = false, is_ground_content = false,
on_use = minetest.item_eat(2, "vessels:drinking_glass"), on_use = minetest.item_eat(2, "vessels:drinking_glass"),
sounds = farming.sounds.node_sound_glass_defaults() sounds = farming.sounds.node_sound_glass_defaults()
}) })
farming.add_eatable("farming:coffee_cup", 2)
minetest.register_alias("farming:coffee_cup_hot", "farming:coffee_cup") minetest.register_alias("farming:coffee_cup_hot", "farming:coffee_cup")
minetest.register_alias("farming:drinking_cup", "vessels:drinking_glass") minetest.register_alias("farming:drinking_cup", "vessels:drinking_glass")

View File

@ -9,10 +9,10 @@ local a = farming.recipe_items
-- corn -- corn
minetest.register_craftitem("farming:corn", { minetest.register_craftitem("farming:corn", {
description = S("Corn") .. " (♥3)", description = S("Corn"),
inventory_image = "farming_corn.png", inventory_image = "farming_corn.png",
groups = { groups = {
compostability = 45, seed = 2, food_corn = 1, flammable = 2, eatable = 3 compostability = 45, seed = 2, food_corn = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1")
@ -20,14 +20,18 @@ minetest.register_craftitem("farming:corn", {
on_use = minetest.item_eat(3) on_use = minetest.item_eat(3)
}) })
farming.add_eatable("farming:corn", 3)
-- corn on the cob (texture by TenPlus1) -- corn on the cob (texture by TenPlus1)
minetest.register_craftitem("farming:corn_cob", { minetest.register_craftitem("farming:corn_cob", {
description = S("Corn on the Cob") .. " (♥5)", description = S("Corn on the Cob"),
inventory_image = "farming_corn_cob.png", inventory_image = "farming_corn_cob.png",
groups = {compostability = 65, food_corn_cooked = 1, flammable = 2, eatable = 5}, groups = {compostability = 65, food_corn_cooked = 1, flammable = 2},
on_use = minetest.item_eat(5) on_use = minetest.item_eat(5)
}) })
farming.add_eatable("farming:corn_cob", 5)
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
cooktime = 10, cooktime = 10,
@ -37,12 +41,14 @@ minetest.register_craft({
-- popcorn -- popcorn
minetest.register_craftitem("farming:popcorn", { minetest.register_craftitem("farming:popcorn", {
description = S("Popcorn") .. " (♥4)", description = S("Popcorn"),
inventory_image = "farming_popcorn.png", inventory_image = "farming_popcorn.png",
groups = {compostability = 55, food_popcorn = 1, flammable = 2, eatable = 4}, groups = {compostability = 55, food_popcorn = 1, flammable = 2},
on_use = minetest.item_eat(4) on_use = minetest.item_eat(4)
}) })
farming.add_eatable("farming:popcorn", 4)
minetest.register_craft({ minetest.register_craft({
output = "farming:popcorn", output = "farming:popcorn",
recipe = { recipe = {

View File

@ -8,10 +8,10 @@ local S = farming.translate
-- cucumber -- cucumber
minetest.register_craftitem("farming:cucumber", { minetest.register_craftitem("farming:cucumber", {
description = S("Cucumber") .. " (♥4)", description = S("Cucumber"),
inventory_image = "farming_cucumber.png", inventory_image = "farming_cucumber.png",
groups = { groups = {
compostability = 48, seed = 2, food_cucumber = 1, flammable = 2, eatable = 4 compostability = 48, seed = 2, food_cucumber = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1")
@ -19,6 +19,8 @@ minetest.register_craftitem("farming:cucumber", {
on_use = minetest.item_eat(4) on_use = minetest.item_eat(4)
}) })
farming.add_eatable("farming:cucumber", 4)
-- cucumber definition -- cucumber definition
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- eggplant -- eggplant
minetest.register_craftitem("farming:eggplant", { minetest.register_craftitem("farming:eggplant", {
description = S("Eggplant") .. " (♥3)", description = S("Eggplant"),
inventory_image = "farming_eggplant.png", inventory_image = "farming_eggplant.png",
groups = { groups = {
compostability = 48, seed = 2, food_eggplant = 1, flammable = 2, eatable = 3 compostability = 48, seed = 2, food_eggplant = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:eggplant_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:eggplant_1")
@ -14,6 +14,8 @@ minetest.register_craftitem("farming:eggplant", {
on_use = minetest.item_eat(3) on_use = minetest.item_eat(3)
}) })
farming.add_eatable("farming:eggplant", 3)
-- definition -- definition
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",

View File

@ -13,12 +13,14 @@ minetest.register_craftitem("farming:garlic_clove", {
-- garlic bulb -- garlic bulb
minetest.register_craftitem("farming:garlic", { minetest.register_craftitem("farming:garlic", {
description = S("Garlic") .. " (♥1)", description = S("Garlic"),
inventory_image = "crops_garlic.png", inventory_image = "crops_garlic.png",
on_use = minetest.item_eat(1), on_use = minetest.item_eat(1),
groups = {food_garlic = 1, flammable = 3, compostability = 55, eatable = 1} groups = {food_garlic = 1, flammable = 3, compostability = 55}
}) })
farming.add_eatable("farming:garlic", 1)
minetest.register_craft({ minetest.register_craft({
output = "farming:garlic_clove 8", output = "farming:garlic_clove 8",
recipe = {{"farming:garlic"}} recipe = {{"farming:garlic"}}

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- ginger -- ginger
minetest.register_craftitem("farming:ginger", { minetest.register_craftitem("farming:ginger", {
description = S("Ginger") .. " (♥1)", description = S("Ginger"),
inventory_image = "farming_ginger.png", inventory_image = "farming_ginger.png",
groups = { groups = {
compostability = 48, seed = 2, food_ginger = 1, flammable = 2, eatable = 1 compostability = 48, seed = 2, food_ginger = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:ginger_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:ginger_1")
@ -14,6 +14,8 @@ minetest.register_craftitem("farming:ginger", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:ginger", 1)
-- ginger definition -- ginger definition
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",

View File

@ -65,17 +65,19 @@ end
-- grapes -- grapes
minetest.register_craftitem("farming:grapes", { minetest.register_craftitem("farming:grapes", {
description = S("Grapes") .. " (♥2)", description = S("Grapes"),
inventory_image = "farming_grapes.png", inventory_image = "farming_grapes.png",
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),
groups = { groups = {
compostability = 48, seed = 2, food_grapes = 1, flammable = 3, eatable = 2 compostability = 48, seed = 2, food_grapes = 1, flammable = 3
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1") return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1")
end end
}) })
farming.add_eatable("farming:grapes", 2)
-- grapes can be used for violet dye -- grapes can be used for violet dye
minetest.register_craft({ minetest.register_craft({
output = a.dye_violet, output = a.dye_violet,

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- lettuce -- lettuce
minetest.register_craftitem("farming:lettuce", { minetest.register_craftitem("farming:lettuce", {
description = S("Lettuce") .. " (♥2)", description = S("Lettuce"),
inventory_image = "farming_lettuce.png", inventory_image = "farming_lettuce.png",
groups = { groups = {
compostability = 48, seed = 2, food_lettuce = 1, flammable = 2, eatable = 2 compostability = 48, seed = 2, food_lettuce = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:lettuce_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:lettuce_1")
@ -14,6 +14,8 @@ minetest.register_craftitem("farming:lettuce", {
on_use = minetest.item_eat(2) on_use = minetest.item_eat(2)
}) })
farming.add_eatable("farming:lettuce", 2)
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_lettuce_1.png"}, tiles = {"farming_lettuce_1.png"},

View File

@ -4,10 +4,10 @@ local a = farming.recipe_items
-- melon -- melon
minetest.register_craftitem("farming:melon_slice", { minetest.register_craftitem("farming:melon_slice", {
description = S("Melon Slice") .. " (♥2)", description = S("Melon Slice"),
inventory_image = "farming_melon_slice.png", inventory_image = "farming_melon_slice.png",
groups = { groups = {
compostability = 48, seed = 2, food_melon_slice = 1, flammable = 3, eatable = 2 compostability = 48, seed = 2, food_melon_slice = 1, flammable = 3
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1")
@ -15,6 +15,8 @@ minetest.register_craftitem("farming:melon_slice", {
on_use = minetest.item_eat(2) on_use = minetest.item_eat(2)
}) })
farming.add_eatable("farming:melon_slice", 2)
minetest.register_craft({ minetest.register_craft({
output = "farming:melon_8", output = "farming:melon_8",
recipe = { recipe = {

View File

@ -38,12 +38,14 @@ minetest.register_craftitem("farming:mint_leaf", {
-- mint tea -- mint tea
minetest.register_craftitem("farming:mint_tea", { minetest.register_craftitem("farming:mint_tea", {
description = S("Mint Tea") .. " (♥2)", description = S("Mint Tea"),
inventory_image = "farming_mint_tea.png", inventory_image = "farming_mint_tea.png",
on_use = minetest.item_eat(2, a.drinking_glass), on_use = minetest.item_eat(2, a.drinking_glass),
groups = {flammable = 4, eatable = 2} groups = {flammable = 4}
}) })
farming.add_eatable("farming:mint_tea", 2)
minetest.register_craft({ minetest.register_craft({
output = "farming:mint_tea", output = "farming:mint_tea",
recipe = { recipe = {

View File

@ -10,10 +10,10 @@ local a = farming.recipe_items
-- onion -- onion
minetest.register_craftitem("farming:onion", { minetest.register_craftitem("farming:onion", {
description = S("Onion") .. " (♥1)", description = S("Onion"),
inventory_image = "crops_onion.png", inventory_image = "crops_onion.png",
groups = { groups = {
compostability = 48, seed = 2, food_onion = 1, flammable = 3, eatable = 1 compostability = 48, seed = 2, food_onion = 1, flammable = 3
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1")
@ -21,14 +21,18 @@ minetest.register_craftitem("farming:onion", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:onion", 1)
-- onion soup -- onion soup
minetest.register_craftitem("farming:onion_soup", { minetest.register_craftitem("farming:onion_soup", {
description = S("Onion Soup") .. " (♥6)", description = S("Onion Soup"),
inventory_image = "farming_onion_soup.png", inventory_image = "farming_onion_soup.png",
groups = {flammable = 2, compostability = 65, eatable = 6}, groups = {flammable = 2, compostability = 65},
on_use = minetest.item_eat(6, a.bowl) on_use = minetest.item_eat(6, a.bowl)
}) })
farming.add_eatable("farming:onion_soup", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:onion_soup", output = "farming:onion_soup",
recipe = { recipe = {

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- item definition -- item definition
minetest.register_craftitem("farming:parsley", { minetest.register_craftitem("farming:parsley", {
description = S("Parsley") .. " (♥1)", description = S("Parsley"),
inventory_image = "farming_parsley.png", inventory_image = "farming_parsley.png",
groups = { groups = {
compostability = 48, seed = 2, food_parsley = 1, flammable = 2, eatable = 1 compostability = 48, seed = 2, food_parsley = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:parsley_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:parsley_1")
@ -14,6 +14,8 @@ minetest.register_craftitem("farming:parsley", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:parsley", 1)
-- crop definition -- crop definition
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",

View File

@ -6,11 +6,10 @@ local a = farming.recipe_items
-- pea pod -- pea pod
minetest.register_craftitem("farming:pea_pod", { minetest.register_craftitem("farming:pea_pod", {
description = S("Pea Pod") .. " (♥1)", description = S("Pea Pod"),
inventory_image = "farming_pea_pod.png", inventory_image = "farming_pea_pod.png",
groups = { groups = {
compostability = 48, seed = 2, food_peas = 1, food_pea_pod = 1, flammable = 2, compostability = 48, seed = 2, food_peas = 1, food_pea_pod = 1, flammable = 2
eatable = 1
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1")
@ -18,17 +17,21 @@ minetest.register_craftitem("farming:pea_pod", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:pea_pod", 1)
-- replacement for separate peas item that was removed -- replacement for separate peas item that was removed
minetest.register_alias("farming:peas", "farming:pea_pod") minetest.register_alias("farming:peas", "farming:pea_pod")
-- pea soup -- pea soup
minetest.register_craftitem("farming:pea_soup", { minetest.register_craftitem("farming:pea_soup", {
description = S("Pea Soup") .. " (♥4)", description = S("Pea Soup"),
inventory_image = "farming_pea_soup.png", inventory_image = "farming_pea_soup.png",
groups = {flammable = 2, compostability = 65, eatable = 4}, groups = {flammable = 2, compostability = 65},
on_use = minetest.item_eat(4, a.bowl) on_use = minetest.item_eat(4, a.bowl)
}) })
farming.add_eatable("farming:pea_soup", 4)
minetest.register_craft({ minetest.register_craft({
output = "farming:pea_soup", output = "farming:pea_soup",
recipe = { recipe = {

View File

@ -20,28 +20,34 @@ minetest.register_craftitem("farming:peppercorn", {
-- green pepper -- green pepper
minetest.register_craftitem("farming:pepper", { minetest.register_craftitem("farming:pepper", {
description = S("Green Pepper") .. " (♥2)", description = S("Green Pepper"),
inventory_image = "crops_pepper.png", inventory_image = "crops_pepper.png",
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),
groups = {food_pepper = 1, flammable = 3, compostability = 55, eatable = 2} groups = {food_pepper = 1, flammable = 3, compostability = 55}
}) })
farming.add_eatable("farming:pepper", 2)
-- yellow pepper -- yellow pepper
minetest.register_craftitem("farming:pepper_yellow", { minetest.register_craftitem("farming:pepper_yellow", {
description = S("Yellow Pepper") .. " (♥3)", description = S("Yellow Pepper"),
inventory_image = "crops_pepper_yellow.png", inventory_image = "crops_pepper_yellow.png",
on_use = minetest.item_eat(3), on_use = minetest.item_eat(3),
groups = {food_pepper = 1, flammable = 3, compostability = 55, eatable = 3} groups = {food_pepper = 1, flammable = 3, compostability = 55}
}) })
farming.add_eatable("farming:pepper_yellow", 3)
-- red pepper -- red pepper
minetest.register_craftitem("farming:pepper_red", { minetest.register_craftitem("farming:pepper_red", {
description = S("Red Pepper") .. " (♥3)", description = S("Red Pepper"),
inventory_image = "crops_pepper_red.png", inventory_image = "crops_pepper_red.png",
on_use = minetest.item_eat(4), on_use = minetest.item_eat(4),
groups = {food_pepper = 1, flammable = 3, compostability = 55, eatable = 3} groups = {food_pepper = 1, flammable = 3, compostability = 55}
}) })
farming.add_eatable("farming:pepper_red", 3)
minetest.register_craft({ minetest.register_craft({
output = "farming:peppercorn", output = "farming:peppercorn",
recipe = {{"group:food_pepper"}} recipe = {{"group:food_pepper"}}

View File

@ -36,12 +36,14 @@ minetest.register_node("farming:pineapple", {
-- pineapple -- pineapple
minetest.register_craftitem("farming:pineapple_ring", { minetest.register_craftitem("farming:pineapple_ring", {
description = S("Pineapple Ring") .. " (♥1)", description = S("Pineapple Ring"),
inventory_image = "farming_pineapple_ring.png", inventory_image = "farming_pineapple_ring.png",
groups = {food_pineapple_ring = 1, flammable = 2, compostability = 45, eatable = 1}, groups = {food_pineapple_ring = 1, flammable = 2, compostability = 45},
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:pineapple_ring", 1)
minetest.register_craft( { minetest.register_craft( {
output = "farming:pineapple_ring 5", output = "farming:pineapple_ring 5",
recipe = {{"group:food_pineapple"}}, recipe = {{"group:food_pineapple"}},
@ -50,12 +52,14 @@ minetest.register_craft( {
-- pineapple juice -- pineapple juice
minetest.register_craftitem("farming:pineapple_juice", { minetest.register_craftitem("farming:pineapple_juice", {
description = S("Pineapple Juice") .. " (♥4)", description = S("Pineapple Juice"),
inventory_image = "farming_pineapple_juice.png", inventory_image = "farming_pineapple_juice.png",
on_use = minetest.item_eat(4, "vessels:drinking_glass"), on_use = minetest.item_eat(4, "vessels:drinking_glass"),
groups = {vessel = 1, drink = 1, compostability = 35, eatable = 4} groups = {vessel = 1, drink = 1, compostability = 35}
}) })
farming.add_eatable("farming:pineapple_juice", 4)
minetest.register_craft({ minetest.register_craft({
output = "farming:pineapple_juice", output = "farming:pineapple_juice",
recipe = { recipe = {

View File

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

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- pumpkin slice -- pumpkin slice
minetest.register_craftitem("farming:pumpkin_slice", { minetest.register_craftitem("farming:pumpkin_slice", {
description = S("Pumpkin Slice") .. " (♥2)", description = S("Pumpkin Slice"),
inventory_image = "farming_pumpkin_slice.png", inventory_image = "farming_pumpkin_slice.png",
groups = { groups = {
compostability = 48, seed = 2, food_pumpkin_slice = 1, flammable = 2, eatable = 2 compostability = 48, seed = 2, food_pumpkin_slice = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1")
@ -14,6 +14,8 @@ minetest.register_craftitem("farming:pumpkin_slice", {
on_use = minetest.item_eat(2) on_use = minetest.item_eat(2)
}) })
farming.add_eatable("farming:pumpkin_slice", 2)
minetest.register_craft({ minetest.register_craft({
output = "farming:pumpkin", output = "farming:pumpkin",
recipe = { recipe = {
@ -125,12 +127,14 @@ minetest.register_craft({
-- pumpkin bread -- pumpkin bread
minetest.register_craftitem("farming:pumpkin_bread", { minetest.register_craftitem("farming:pumpkin_bread", {
description = S("Pumpkin Bread") .. " (♥8)", description = S("Pumpkin Bread"),
inventory_image = "farming_pumpkin_bread.png", inventory_image = "farming_pumpkin_bread.png",
on_use = minetest.item_eat(8), on_use = minetest.item_eat(8),
groups = {food_bread = 1, flammable = 2, eatable = 8} groups = {food_bread = 1, flammable = 2}
}) })
farming.add_eatable("farming:pumpkin_bread", 8)
minetest.register_craftitem("farming:pumpkin_dough", { minetest.register_craftitem("farming:pumpkin_dough", {
description = S("Pumpkin Dough"), description = S("Pumpkin Dough"),
inventory_image = "farming_pumpkin_dough.png" inventory_image = "farming_pumpkin_dough.png"

View File

@ -4,11 +4,11 @@ local a = farming.recipe_items
-- raspberries -- raspberries
minetest.register_craftitem("farming:raspberries", { minetest.register_craftitem("farming:raspberries", {
description = S("Raspberries") .. " (♥1)", description = S("Raspberries"),
inventory_image = "farming_raspberries.png", inventory_image = "farming_raspberries.png",
groups = { groups = {
compostability = 48, seed = 2, food_raspberries = 1, food_raspberry = 1, compostability = 48, seed = 2, food_raspberries = 1, food_raspberry = 1,
food_berry = 1, flammable = 2, eatable = 1 food_berry = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1")
@ -16,14 +16,18 @@ minetest.register_craftitem("farming:raspberries", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:raspberries", 1)
-- raspberry smoothie -- raspberry smoothie
minetest.register_craftitem("farming:smoothie_raspberry", { minetest.register_craftitem("farming:smoothie_raspberry", {
description = S("Raspberry Smoothie") .. " (♥2)", description = S("Raspberry Smoothie"),
inventory_image = "farming_raspberry_smoothie.png", inventory_image = "farming_raspberry_smoothie.png",
on_use = minetest.item_eat(2, "vessels:drinking_glass"), on_use = minetest.item_eat(2, "vessels:drinking_glass"),
groups = {vessel = 1, drink = 1, compostability = 65, eatable = 2} groups = {vessel = 1, drink = 1, compostability = 65}
}) })
farming.add_eatable("farming:smoothie_raspberry", 2)
minetest.register_craft({ minetest.register_craft({
output = "farming:smoothie_raspberry", output = "farming:smoothie_raspberry",
recipe = { recipe = {

View File

@ -4,10 +4,10 @@ local a = farming.recipe_items
-- rhubarb -- rhubarb
minetest.register_craftitem("farming:rhubarb", { minetest.register_craftitem("farming:rhubarb", {
description = S("Rhubarb") .. " (♥1)", description = S("Rhubarb"),
inventory_image = "farming_rhubarb.png", inventory_image = "farming_rhubarb.png",
groups = { groups = {
compostability = 48, seed = 2, food_rhubarb = 1, flammable = 2, eatable = 1 compostability = 48, seed = 2, food_rhubarb = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1")
@ -15,14 +15,18 @@ minetest.register_craftitem("farming:rhubarb", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:rhubarb", 1)
-- rhubarb pie -- rhubarb pie
minetest.register_craftitem("farming:rhubarb_pie", { minetest.register_craftitem("farming:rhubarb_pie", {
description = S("Rhubarb Pie") .. " (♥6)", description = S("Rhubarb Pie"),
inventory_image = "farming_rhubarb_pie.png", inventory_image = "farming_rhubarb_pie.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
groups = {compostability = 65, eatable = 6} groups = {compostability = 65, flammable = 2}
}) })
farming.add_eatable("farming:rhubarb_pie", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:rhubarb_pie", output = "farming:rhubarb_pie",
recipe = { recipe = {

View File

@ -46,12 +46,14 @@ minetest.register_craft({
-- rice flour and bread -- rice flour and bread
minetest.register_craftitem("farming:rice_bread", { minetest.register_craftitem("farming:rice_bread", {
description = S("Rice Bread") .. " (♥5)", description = S("Rice Bread"),
inventory_image = "farming_rice_bread.png", inventory_image = "farming_rice_bread.png",
on_use = minetest.item_eat(5), on_use = minetest.item_eat(5),
groups = {food_rice_bread = 1, flammable = 2, compostability = 65, eatable = 5} groups = {food_rice_bread = 1, flammable = 2, compostability = 65}
}) })
farming.add_eatable("farming:rice_bread", 5)
minetest.register_craftitem("farming:rice_flour", { minetest.register_craftitem("farming:rice_flour", {
description = S("Rice Flour"), description = S("Rice Flour"),
inventory_image = "farming_rice_flour.png", inventory_image = "farming_rice_flour.png",

View File

@ -81,12 +81,14 @@ minetest.register_craft({
-- Multigrain bread -- Multigrain bread
minetest.register_craftitem("farming:bread_multigrain", { minetest.register_craftitem("farming:bread_multigrain", {
description = S("Multigrain Bread") .. " (♥7)", description = S("Multigrain Bread"),
inventory_image = "farming_bread_multigrain.png", inventory_image = "farming_bread_multigrain.png",
on_use = minetest.item_eat(7), on_use = minetest.item_eat(7),
groups = {food_bread = 1, flammable = 2, compostability = 65, eatable = 7} groups = {food_bread = 1, flammable = 2, compostability = 65}
}) })
farming.add_eatable("farming:bread_multigrain", 7)
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
cooktime = 15, cooktime = 15,

View File

@ -51,7 +51,7 @@ minetest.register_craft( {
-- soy milk -- soy milk
minetest.register_node("farming:soy_milk", { minetest.register_node("farming:soy_milk", {
description = S("Soy Milk") .. " (♥2)", description = S("Soy Milk"),
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"farming_soy_milk_glass.png"}, tiles = {"farming_soy_milk_glass.png"},
inventory_image = "farming_soy_milk_glass.png", inventory_image = "farming_soy_milk_glass.png",
@ -64,13 +64,15 @@ minetest.register_node("farming:soy_milk", {
}, },
on_use = minetest.item_eat(2, "vessels:drinking_glass"), on_use = minetest.item_eat(2, "vessels:drinking_glass"),
groups = { groups = {
vessel = 1, food_milk_glass = 1, dig_immediate = 3, eatable = 2, vessel = 1, food_milk_glass = 1, dig_immediate = 3,
attached_node = 1, drink = 1, compostability = 65 attached_node = 1, drink = 1, compostability = 65
}, },
is_ground_content = false, is_ground_content = false,
sounds = farming.sounds.node_sound_glass_defaults() sounds = farming.sounds.node_sound_glass_defaults()
}) })
farming.add_eatable("farming:soy_milk", 2)
minetest.register_craft( { minetest.register_craft( {
output = "farming:soy_milk", output = "farming:soy_milk",
recipe = { recipe = {
@ -85,14 +87,16 @@ minetest.register_craft( {
-- tofu -- tofu
minetest.register_craftitem("farming:tofu", { minetest.register_craftitem("farming:tofu", {
description = S("Tofu") .. " (♥3)", description = S("Tofu"),
inventory_image = "farming_tofu.png", inventory_image = "farming_tofu.png",
groups = { groups = {
food_tofu = 1, food_meat_raw = 1, flammable = 2, compostability = 65, eatable = 3 food_tofu = 1, food_meat_raw = 1, flammable = 2, compostability = 65,
}, },
on_use = minetest.item_eat(3) on_use = minetest.item_eat(3)
}) })
farming.add_eatable("farming:tofu", 3)
minetest.register_craft({ minetest.register_craft({
output = "farming:tofu", output = "farming:tofu",
recipe = { recipe = {
@ -104,12 +108,14 @@ minetest.register_craft({
-- cooked tofu -- cooked tofu
minetest.register_craftitem("farming:tofu_cooked", { minetest.register_craftitem("farming:tofu_cooked", {
description = S("Cooked Tofu") .. " (♥6)", description = S("Cooked Tofu"),
inventory_image = "farming_tofu_cooked.png", inventory_image = "farming_tofu_cooked.png",
groups = {food_meat = 1, flammable = 2, compostability = 65, eatable = 6}, groups = {food_meat = 1, flammable = 2, compostability = 65},
on_use = minetest.item_eat(6) on_use = minetest.item_eat(6)
}) })
farming.add_eatable("farming:tofu_cooked", 6)
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "farming:tofu_cooked", output = "farming:tofu_cooked",

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- spinach -- spinach
minetest.register_craftitem("farming:spinach", { minetest.register_craftitem("farming:spinach", {
description = S("Spinach") .. " (♥1)", description = S("Spinach"),
inventory_image = "farming_spinach.png", inventory_image = "farming_spinach.png",
groups = { groups = {
compostability = 48, seed = 2, food_spinach = 1, flammable = 2, eatable = 1 compostability = 48, seed = 2, food_spinach = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:spinach_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:spinach_1")
@ -14,6 +14,8 @@ minetest.register_craftitem("farming:spinach", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:spinach", 1)
-- definition -- definition
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",

View File

@ -3,11 +3,10 @@ local S = farming.translate
-- Strawberry (can also be planted as seed) -- Strawberry (can also be planted as seed)
minetest.register_craftitem(":ethereal:strawberry", { minetest.register_craftitem(":ethereal:strawberry", {
description = S("Strawberry") .. " (♥1)", description = S("Strawberry"),
inventory_image = "ethereal_strawberry.png", inventory_image = "ethereal_strawberry.png",
groups = { groups = {
compostability = 48, seed = 2, food_strawberry = 1, food_berry = 1, compostability = 48, seed = 2, food_strawberry = 1, food_berry = 1, flammable = 2
flammable = 2, eatable = 1
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "ethereal:strawberry_1") return farming.place_seed(itemstack, placer, pointed_thing, "ethereal:strawberry_1")
@ -15,6 +14,8 @@ minetest.register_craftitem(":ethereal:strawberry", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("ethereal:strawberry", 1)
-- Define Strawberry Bush growth stages -- Define Strawberry Bush growth stages
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",

View File

@ -45,14 +45,16 @@ minetest.register_craft({
-- sunflower seeds (toasted) -- sunflower seeds (toasted)
minetest.register_craftitem("farming:sunflower_seeds_toasted", { minetest.register_craftitem("farming:sunflower_seeds_toasted", {
description = S("Toasted Sunflower Seeds") .. " (♥1)", description = S("Toasted Sunflower Seeds"),
inventory_image = "farming_sunflower_seeds_toasted.png", inventory_image = "farming_sunflower_seeds_toasted.png",
groups = { groups = {
food_sunflower_seeds_toasted = 1, flammable = 2, compostability = 65, eatable = 1 food_sunflower_seeds_toasted = 1, flammable = 2, compostability = 65
}, },
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:sunflower_seeds_toasted", 1)
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
cooktime = 10, cooktime = 10,
@ -99,12 +101,14 @@ minetest.register_craft({
-- sunflower seed bread -- sunflower seed bread
minetest.register_craftitem("farming:sunflower_bread", { minetest.register_craftitem("farming:sunflower_bread", {
description = S("Sunflower Seed Bread") .. " (♥8)", description = S("Sunflower Seed Bread"),
inventory_image = "farming_sunflower_bread.png", inventory_image = "farming_sunflower_bread.png",
on_use = minetest.item_eat(8), on_use = minetest.item_eat(8),
groups = {food_bread = 1, flammable = 2, eatable = 8} groups = {food_bread = 1, flammable = 2}
}) })
farming.add_eatable("farming:sunflower_bread", 8)
minetest.register_craft({ minetest.register_craft({
output = "farming:sunflower_bread", output = "farming:sunflower_bread",
recipe = { recipe = {

View File

@ -8,23 +8,27 @@ local S = farming.translate
-- tomato -- tomato
minetest.register_craftitem("farming:tomato", { minetest.register_craftitem("farming:tomato", {
description = S("Tomato") .. " (♥4)", description = S("Tomato"),
inventory_image = "farming_tomato.png", inventory_image = "farming_tomato.png",
groups = {compostability = 45, seed = 2, food_tomato = 1, flammable = 2, eatable = 4}, groups = {compostability = 45, seed = 2, food_tomato = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1")
end, end,
on_use = minetest.item_eat(4) on_use = minetest.item_eat(4)
}) })
farming.add_eatable("farming:tomato", 4)
-- tomato soup -- tomato soup
minetest.register_craftitem("farming:tomato_soup", { minetest.register_craftitem("farming:tomato_soup", {
description = S("Tomato Soup") .. " (♥8)", description = S("Tomato Soup"),
inventory_image = "farming_tomato_soup.png", inventory_image = "farming_tomato_soup.png",
groups = {flammable = 2, compostability = 65, eatable = 8}, groups = {flammable = 2, compostability = 65},
on_use = minetest.item_eat(8, "farming:bowl") on_use = minetest.item_eat(8, "farming:bowl")
}) })
farming.add_eatable("farming:tomato_soup", 8)
minetest.register_craft({ minetest.register_craft({
output = "farming:tomato_soup", output = "farming:tomato_soup",
recipe = { recipe = {

View File

@ -4,10 +4,10 @@ local a = farming.recipe_items
-- vanilla -- vanilla
minetest.register_craftitem("farming:vanilla", { minetest.register_craftitem("farming:vanilla", {
description = S("Vanilla") .. " (♥1)", description = S("Vanilla"),
inventory_image = "farming_vanilla.png", inventory_image = "farming_vanilla.png",
groups = { groups = {
compostability = 48, seed = 2, food_vanilla = 1, flammable = 2, eatable = 1 compostability = 48, seed = 2, food_vanilla = 1, flammable = 2
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:vanilla_1") return farming.place_seed(itemstack, placer, pointed_thing, "farming:vanilla_1")
@ -15,6 +15,8 @@ minetest.register_craftitem("farming:vanilla", {
on_use = minetest.item_eat(1) on_use = minetest.item_eat(1)
}) })
farming.add_eatable("farming:vanilla", 1)
-- crop definition -- crop definition
local def = { local def = {
drawtype = "plantlike", drawtype = "plantlike",

View File

@ -99,12 +99,14 @@ minetest.register_craft({
-- bread -- bread
minetest.register_craftitem("farming:bread", { minetest.register_craftitem("farming:bread", {
description = S("Bread") .. " (♥5)", description = S("Bread"),
inventory_image = "farming_bread.png", inventory_image = "farming_bread.png",
on_use = minetest.item_eat(5), on_use = minetest.item_eat(5),
groups = {food_bread = 1, flammable = 2, eatable = 5} groups = {food_bread = 1, flammable = 2}
}) })
farming.add_eatable("farming:bread", 5)
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
cooktime = 15, cooktime = 15,

162
food.lua
View File

@ -5,12 +5,14 @@ local a = farming.recipe_items
-- sliced bread -- sliced bread
minetest.register_craftitem("farming:bread_slice", { minetest.register_craftitem("farming:bread_slice", {
description = S("Sliced Bread") .. " (♥1)", description = S("Sliced Bread"),
inventory_image = "farming_bread_slice.png", inventory_image = "farming_bread_slice.png",
on_use = minetest.item_eat(1), on_use = minetest.item_eat(1),
groups = {food_bread_slice = 1, flammable = 2, compostability = 65, eatable = 1} groups = {food_bread_slice = 1, compostability = 65}
}) })
farming.add_eatable("farming:bread_slice", 1)
minetest.register_craft({ minetest.register_craft({
output = "farming:bread_slice 5", output = "farming:bread_slice 5",
recipe = {{"group:food_bread", a.cutting_board}}, recipe = {{"group:food_bread", a.cutting_board}},
@ -20,12 +22,14 @@ minetest.register_craft({
-- toast -- toast
minetest.register_craftitem("farming:toast", { minetest.register_craftitem("farming:toast", {
description = S("Toast") .. " (♥1)", description = S("Toast"),
inventory_image = "farming_toast.png", inventory_image = "farming_toast.png",
on_use = minetest.item_eat(1), on_use = minetest.item_eat(1),
groups = {food_toast = 1, flammable = 2, compostability = 65, eatable = 1} groups = {food_toast = 1, compostability = 65}
}) })
farming.add_eatable("farming:toast", 1)
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
cooktime = 3, cooktime = 3,
@ -36,12 +40,14 @@ minetest.register_craft({
-- toast sandwich -- toast sandwich
minetest.register_craftitem("farming:toast_sandwich", { minetest.register_craftitem("farming:toast_sandwich", {
description = S("Toast Sandwich") .. " (♥4)", description = S("Toast Sandwich"),
inventory_image = "farming_toast_sandwich.png", inventory_image = "farming_toast_sandwich.png",
on_use = minetest.item_eat(4), on_use = minetest.item_eat(4),
groups = {flammable = 2, compostability = 85, eatable = 4} groups = {compostability = 85}
}) })
farming.add_eatable("farming:toast_sandwich", 4)
minetest.register_craft({ minetest.register_craft({
output = "farming:toast_sandwich", output = "farming:toast_sandwich",
recipe = { recipe = {
@ -348,12 +354,14 @@ minetest.register_craft({
-- Turkish Delight -- Turkish Delight
minetest.register_craftitem("farming:turkish_delight", { minetest.register_craftitem("farming:turkish_delight", {
description = S("Turkish Delight") .. " (♥2)", description = S("Turkish Delight"),
inventory_image = "farming_turkish_delight.png", inventory_image = "farming_turkish_delight.png",
groups = {flammable = 3, compostability = 85, eatable = 2}, groups = {compostability = 85},
on_use = minetest.item_eat(2) on_use = minetest.item_eat(2)
}) })
farming.add_eatable("farming:turkish_delight", 2)
minetest.register_craft({ minetest.register_craft({
output = "farming:turkish_delight 4", output = "farming:turkish_delight 4",
recipe = { recipe = {
@ -371,12 +379,14 @@ minetest.register_craft({
-- Garlic Bread -- Garlic Bread
minetest.register_craftitem("farming:garlic_bread", { minetest.register_craftitem("farming:garlic_bread", {
description = S("Garlic Bread") .. " (♥2)", description = S("Garlic Bread"),
inventory_image = "farming_garlic_bread.png", inventory_image = "farming_garlic_bread.png",
groups = {flammable = 3, compostability = 65, eatable = 2}, groups = {compostability = 65},
on_use = minetest.item_eat(2) on_use = minetest.item_eat(2)
}) })
farming.add_eatable("farming:garlic_bread", 2)
minetest.register_craft({ minetest.register_craft({
output = "farming:garlic_bread", output = "farming:garlic_bread",
recipe = { recipe = {
@ -387,12 +397,14 @@ minetest.register_craft({
-- Donuts (thanks to Bockwurst for making the donut images) -- Donuts (thanks to Bockwurst for making the donut images)
minetest.register_craftitem("farming:donut", { minetest.register_craftitem("farming:donut", {
description = S("Donut") .. " (♥4)", description = S("Donut"),
inventory_image = "farming_donut.png", inventory_image = "farming_donut.png",
on_use = minetest.item_eat(4), on_use = minetest.item_eat(4),
groups = {compostability = 65, eatable = 4} groups = {compostability = 65}
}) })
farming.add_eatable("farming:donut", 4)
minetest.register_craft({ minetest.register_craft({
output = "farming:donut 3", output = "farming:donut 3",
recipe = { recipe = {
@ -403,12 +415,14 @@ minetest.register_craft({
}) })
minetest.register_craftitem("farming:donut_chocolate", { minetest.register_craftitem("farming:donut_chocolate", {
description = S("Chocolate Donut") .. " (♥6)", description = S("Chocolate Donut"),
inventory_image = "farming_donut_chocolate.png", inventory_image = "farming_donut_chocolate.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
groups = {compostability = 65, eatable = 6} groups = {compostability = 65}
}) })
farming.add_eatable("farming:donut_chocolate", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:donut_chocolate", output = "farming:donut_chocolate",
recipe = { recipe = {
@ -418,12 +432,14 @@ minetest.register_craft({
}) })
minetest.register_craftitem("farming:donut_apple", { minetest.register_craftitem("farming:donut_apple", {
description = S("Apple Donut") .. " (♥6)", description = S("Apple Donut"),
inventory_image = "farming_donut_apple.png", inventory_image = "farming_donut_apple.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
groups = {compostability = 65, eatable = 6} groups = {compostability = 65}
}) })
farming.add_eatable("farming:donut_apple", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:donut_apple", output = "farming:donut_apple",
recipe = { recipe = {
@ -435,12 +451,14 @@ minetest.register_craft({
-- Porridge Oats -- Porridge Oats
minetest.register_craftitem("farming:porridge", { minetest.register_craftitem("farming:porridge", {
description = S("Porridge") .. " (♥6)", description = S("Porridge"),
inventory_image = "farming_porridge.png", inventory_image = "farming_porridge.png",
on_use = minetest.item_eat(6, a.bowl), on_use = minetest.item_eat(6, a.bowl),
groups = {compostability = 65, eatable = 6} groups = {compostability = 65}
}) })
farming.add_eatable("farming:porridge", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:porridge", output = "farming:porridge",
recipe = { recipe = {
@ -456,12 +474,14 @@ minetest.register_craft({
-- Jaffa Cake -- Jaffa Cake
minetest.register_craftitem("farming:jaffa_cake", { minetest.register_craftitem("farming:jaffa_cake", {
description = S("Jaffa Cake") .. " (♥6)", description = S("Jaffa Cake"),
inventory_image = "farming_jaffa_cake.png", inventory_image = "farming_jaffa_cake.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
groups = {compostability = 65, eatable = 6} groups = {compostability = 65}
}) })
farming.add_eatable("farming:jaffa_cake", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:jaffa_cake 3", output = "farming:jaffa_cake 3",
recipe = { recipe = {
@ -480,12 +500,14 @@ minetest.register_craft({
-- Apple Pie -- Apple Pie
minetest.register_craftitem("farming:apple_pie", { minetest.register_craftitem("farming:apple_pie", {
description = S("Apple Pie") .. " (♥6)", description = S("Apple Pie"),
inventory_image = "farming_apple_pie.png", inventory_image = "farming_apple_pie.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
groups = {compostability = 75, eatable = 6} groups = {compostability = 75}
}) })
farming.add_eatable("farming:apple_pie", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:apple_pie", output = "farming:apple_pie",
recipe = { recipe = {
@ -498,9 +520,9 @@ minetest.register_craft({
-- Cactus Juice -- Cactus Juice
minetest.register_craftitem("farming:cactus_juice", { minetest.register_craftitem("farming:cactus_juice", {
description = S("Cactus Juice") .. " (♥1)", description = S("Cactus Juice"),
inventory_image = "farming_cactus_juice.png", inventory_image = "farming_cactus_juice.png",
groups = {vessel = 1, drink = 1, compostability = 55, eatable = 1}, groups = {vessel = 1, drink = 1, compostability = 55},
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
@ -514,6 +536,8 @@ minetest.register_craftitem("farming:cactus_juice", {
end end
}) })
farming.add_eatable("farming:cactus_juice", 1)
minetest.register_craft({ minetest.register_craft({
output = "farming:cactus_juice", output = "farming:cactus_juice",
recipe = { recipe = {
@ -556,12 +580,14 @@ minetest.register_craft({
-- Mac & Cheese -- Mac & Cheese
minetest.register_craftitem("farming:mac_and_cheese", { minetest.register_craftitem("farming:mac_and_cheese", {
description = S("Mac & Cheese") .. " (♥6)", description = S("Mac & Cheese"),
inventory_image = "farming_mac_and_cheese.png", inventory_image = "farming_mac_and_cheese.png",
on_use = minetest.item_eat(6, a.bowl), on_use = minetest.item_eat(6, a.bowl),
groups = {compostability = 65, eatable = 6} groups = {compostability = 65}
}) })
farming.add_eatable("farming:mac_and_cheese", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:mac_and_cheese", output = "farming:mac_and_cheese",
recipe = { recipe = {
@ -572,12 +598,14 @@ minetest.register_craft({
-- Spaghetti -- Spaghetti
minetest.register_craftitem("farming:spaghetti", { minetest.register_craftitem("farming:spaghetti", {
description = S("Spaghetti") .. " (♥8)", description = S("Spaghetti"),
inventory_image = "farming_spaghetti.png", inventory_image = "farming_spaghetti.png",
on_use = minetest.item_eat(8), on_use = minetest.item_eat(8),
groups = {compostability = 65, eatable = 8} groups = {compostability = 65}
}) })
farming.add_eatable("farming:spaghetti", 8)
minetest.register_craft({ minetest.register_craft({
output = "farming:spaghetti", output = "farming:spaghetti",
recipe = { recipe = {
@ -590,12 +618,14 @@ minetest.register_craft({
-- Korean Bibimbap -- Korean Bibimbap
minetest.register_craftitem("farming:bibimbap", { minetest.register_craftitem("farming:bibimbap", {
description = S("Bibimbap") .. " (♥8)", description = S("Bibimbap"),
inventory_image = "farming_bibimbap.png", inventory_image = "farming_bibimbap.png",
on_use = minetest.item_eat(8, a.bowl), on_use = minetest.item_eat(8, a.bowl),
groups = {compostability = 65, eatable = 8} groups = {compostability = 65}
}) })
farming.add_eatable("farming:bibimbap", 8)
minetest.register_craft({ minetest.register_craft({
output = "farming:bibimbap", output = "farming:bibimbap",
recipe = { recipe = {
@ -620,12 +650,14 @@ minetest.register_craft({
-- Burger -- Burger
minetest.register_craftitem("farming:burger", { minetest.register_craftitem("farming:burger", {
description = S("Burger") .. " (♥16)", description = S("Burger"),
inventory_image = "farming_burger.png", inventory_image = "farming_burger.png",
on_use = minetest.item_eat(16), on_use = minetest.item_eat(16),
groups = {compostability = 95, eatable = 16} groups = {compostability = 95}
}) })
farming.add_eatable("farming:burger", 16)
minetest.register_craft({ minetest.register_craft({
output = "farming:burger", output = "farming:burger",
recipe = { recipe = {
@ -638,12 +670,14 @@ minetest.register_craft({
-- Salad -- Salad
minetest.register_craftitem("farming:salad", { minetest.register_craftitem("farming:salad", {
description = S("Salad") .. " (♥8)", description = S("Salad"),
inventory_image = "farming_salad.png", inventory_image = "farming_salad.png",
on_use = minetest.item_eat(8, a.bowl), on_use = minetest.item_eat(8, a.bowl),
groups = {compostability = 45, eatable = 8} groups = {compostability = 45}
}) })
farming.add_eatable("farming:salad", 8)
minetest.register_craft({ minetest.register_craft({
output = "farming:salad", output = "farming:salad",
type = "shapeless", type = "shapeless",
@ -656,12 +690,14 @@ minetest.register_craft({
-- Triple Berry Smoothie -- Triple Berry Smoothie
minetest.register_craftitem("farming:smoothie_berry", { minetest.register_craftitem("farming:smoothie_berry", {
description = S("Triple Berry Smoothie") .. " (♥6)", description = S("Triple Berry Smoothie"),
inventory_image = "farming_berry_smoothie.png", inventory_image = "farming_berry_smoothie.png",
on_use = minetest.item_eat(6, "vessels:drinking_glass"), on_use = minetest.item_eat(6, "vessels:drinking_glass"),
groups = {vessel = 1, drink = 1, compostability = 65, eatable = 6} groups = {vessel = 1, drink = 1, compostability = 65}
}) })
farming.add_eatable("farming:smoothie_berry", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:smoothie_berry", output = "farming:smoothie_berry",
type = "shapeless", type = "shapeless",
@ -675,12 +711,14 @@ minetest.register_craft({
-- Patatas a la importancia -- Patatas a la importancia
minetest.register_craftitem("farming:spanish_potatoes", { minetest.register_craftitem("farming:spanish_potatoes", {
description = S("Spanish Potatoes") .. " (♥8)", description = S("Spanish Potatoes"),
inventory_image = "farming_spanish_potatoes.png", inventory_image = "farming_spanish_potatoes.png",
on_use = minetest.item_eat(8, a.bowl), on_use = minetest.item_eat(8, a.bowl),
groups = {compostability = 65, eatable = 8} groups = {compostability = 65}
}) })
farming.add_eatable("farming:spanish_potatoes", 8)
minetest.register_craft({ minetest.register_craft({
output = "farming:spanish_potatoes", output = "farming:spanish_potatoes",
recipe = { recipe = {
@ -694,12 +732,14 @@ minetest.register_craft({
-- Potato omelet -- Potato omelet
minetest.register_craftitem("farming:potato_omelet", { minetest.register_craftitem("farming:potato_omelet", {
description = S("Potato omelet") .. " (♥6)", description = S("Potato omelette"),
inventory_image = "farming_potato_omelet.png", inventory_image = "farming_potato_omelet.png",
on_use = minetest.item_eat(6, a.bowl), on_use = minetest.item_eat(6, a.bowl),
groups = {compostability = 65, eatable = 6} groups = {compostability = 65}
}) })
farming.add_eatable("farming:potato_omelet", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:potato_omelet", output = "farming:potato_omelet",
recipe = { recipe = {
@ -712,12 +752,14 @@ minetest.register_craft({
-- Paella -- Paella
minetest.register_craftitem("farming:paella", { minetest.register_craftitem("farming:paella", {
description = S("Paella") .. " (♥8)", description = S("Paella"),
inventory_image = "farming_paella.png", inventory_image = "farming_paella.png",
on_use = minetest.item_eat(8, a.bowl), on_use = minetest.item_eat(8, a.bowl),
groups = {compostability = 65, eatable = 8} groups = {compostability = 65}
}) })
farming.add_eatable("farming:paella", 8)
minetest.register_craft({ minetest.register_craft({
output = "farming:paella", output = "farming:paella",
recipe = { recipe = {
@ -731,12 +773,14 @@ minetest.register_craft({
-- Flan -- Flan
minetest.register_craftitem("farming:flan", { minetest.register_craftitem("farming:flan", {
description = S("Vanilla Flan") .. " (♥8)", description = S("Vanilla Flan"),
inventory_image = "farming_vanilla_flan.png", inventory_image = "farming_vanilla_flan.png",
on_use = minetest.item_eat(6), on_use = minetest.item_eat(6),
groups = {compostability = 65, eatable = 6} groups = {compostability = 65}
}) })
farming.add_eatable("farming:flan", 6)
minetest.register_craft({ minetest.register_craft({
output = "farming:flan", output = "farming:flan",
recipe = { recipe = {
@ -754,12 +798,14 @@ minetest.register_craft({
-- Vegan Cheese -- Vegan Cheese
minetest.register_craftitem("farming:cheese_vegan", { minetest.register_craftitem("farming:cheese_vegan", {
description = S("Vegan Cheese") .. " (♥2)", description = S("Vegan Cheese"),
inventory_image = "farming_cheese_vegan.png", inventory_image = "farming_cheese_vegan.png",
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),
groups = {compostability = 65, food_cheese = 1, flammable = 2, eatable = 2} groups = {compostability = 65, food_cheese = 1}
}) })
farming.add_eatable("farming:cheese_vegan", 2)
minetest.register_craft({ minetest.register_craft({
output = "farming:cheese_vegan", output = "farming:cheese_vegan",
recipe = { recipe = {
@ -790,12 +836,14 @@ minetest.register_craft({
-- Onigiri -- Onigiri
minetest.register_craftitem("farming:onigiri", { minetest.register_craftitem("farming:onigiri", {
description = S("Onigiri") .. " (♥2)", description = S("Onigiri"),
inventory_image = "farming_onigiri.png", inventory_image = "farming_onigiri.png",
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),
groups = {flammable = 2, compostability = 65, eatable = 2} groups = {compostability = 65}
}) })
farming.add_eatable("farming:onigiri", 2)
minetest.register_craft({ minetest.register_craft({
output = "farming:onigiri", output = "farming:onigiri",
recipe = { recipe = {
@ -807,12 +855,14 @@ minetest.register_craft({
-- Gyoza -- Gyoza
minetest.register_craftitem("farming:gyoza", { minetest.register_craftitem("farming:gyoza", {
description = S("Gyoza") .. " (♥4)", description = S("Gyoza"),
inventory_image = "farming_gyoza.png", inventory_image = "farming_gyoza.png",
on_use = minetest.item_eat(4), on_use = minetest.item_eat(4),
groups = {flammable = 2, compostability = 65, eatable = 4} groups = {compostability = 65}
}) })
farming.add_eatable("farming:gyoza", 4)
minetest.register_craft({ minetest.register_craft({
output = "farming:gyoza 4", output = "farming:gyoza 4",
recipe = { recipe = {
@ -829,12 +879,14 @@ minetest.register_craft({
-- Mochi -- Mochi
minetest.register_craftitem("farming:mochi", { minetest.register_craftitem("farming:mochi", {
description = S("Mochi") .. " (♥4)", description = S("Mochi"),
inventory_image = "farming_mochi.png", inventory_image = "farming_mochi.png",
on_use = minetest.item_eat(3), on_use = minetest.item_eat(3),
groups = {flammable = 2, compostability = 65, eatable = 3} groups = {compostability = 65}
}) })
farming.add_eatable("farming:mochi", 3)
minetest.register_craft({ minetest.register_craft({
output = "farming:mochi", output = "farming:mochi",
recipe = { recipe = {
@ -851,12 +903,14 @@ minetest.register_craft({
-- Gingerbread Man -- Gingerbread Man
minetest.register_craftitem("farming:gingerbread_man", { minetest.register_craftitem("farming:gingerbread_man", {
description = S("Gingerbread Man") .. " (♥2)", description = S("Gingerbread Man"),
inventory_image = "farming_gingerbread_man.png", inventory_image = "farming_gingerbread_man.png",
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),
groups = {compostability = 85, eatable = 2} groups = {compostability = 85}
}) })
farming.add_eatable("farming:gingerbread_man", 2)
minetest.register_craft({ minetest.register_craft({
output = "farming:gingerbread_man 3", output = "farming:gingerbread_man 3",
recipe = { recipe = {

View File

@ -7,7 +7,7 @@
farming = { farming = {
mod = "redo", mod = "redo",
version = "20240625", version = "20240726",
path = minetest.get_modpath("farming"), path = minetest.get_modpath("farming"),
select = { select = {
type = "fixed", type = "fixed",
@ -767,6 +767,27 @@ if input then
input:close() input:close()
end end
-- helper function to add {eatable} group to food items
local mod_tt_base = minetest.get_modpath("tt_base") -- mod does similar to infotext
function farming.add_eatable(item, hp)
local def = minetest.registered_items[item]
if def then
local grps = def.groups or {}
grps.eatable = hp ; grps.flammable = 2
if mod_tt_base == nil then
def.description = def.description .. " (♥" .. hp .. ")"
end
minetest.override_item(item, {description = def.description, groups = grps})
end
end
-- recipe items -- recipe items
dofile(farming.path .. "/items.lua") dofile(farming.path .. "/items.lua")