1
0
mirror of https://codeberg.org/tenplus1/farming.git synced 2024-12-26 10:40: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)
end
--= Add {eatable} group to default apple, blueberries and brown mushroom
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)
--= Add {eatable} group to default food items if found
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
@ -41,7 +24,7 @@ if eth then
alias("farming_plus:banana", "ethereal:banana")
else
minetest.register_node(":ethereal:banana", {
description = S("Banana") .. " (♥2)",
description = S("Banana"),
drawtype = "torchlike",
tiles = {"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}
},
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,
on_use = minetest.item_eat(2),
sounds = farming.sounds.node_sound_leaves_defaults()
})
farming.add_eatable("ethereal:banana", 2)
minetest.register_node(":ethereal:bananaleaves", {
description = S("Banana Leaves"),
tiles = {"farming_banana_leaf.png"},
@ -103,7 +88,7 @@ if eth then
alias("farming_plus:orange_seed", "ethereal:orange_tree_sapling")
else
minetest.register_node(":ethereal:orange", {
description = S("Orange") .. " (♥4)",
description = S("Orange"),
drawtype = "plantlike",
tiles = {"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}
},
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,
on_use = minetest.item_eat(4),
sounds = farming.sounds.node_sound_leaves_defaults()
})
farming.add_eatable("ethereal:orange", 4)
alias("farming_plus:orange_item", "ethereal:orange")
alias("farming_plus:orange", "ethereal:orange")
alias("farming_plus:orange_seed", "default:sapling")

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- item definition
minetest.register_craftitem("farming:artichoke", {
description = S("Artichoke") .. " (♥4)",
description = S("Artichoke"),
inventory_image = "farming_artichoke.png",
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)
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)
})
farming.add_eatable("farming:artichoke", 4)
-- crop definition
local def = {
drawtype = "plantlike",

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- asparagus
minetest.register_craftitem("farming:asparagus", {
description = S("Asparagus") .. " (♥1)",
description = S("Asparagus"),
inventory_image = "farming_asparagus.png",
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)
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)
})
farming.add_eatable("farming:asparagus", 1)
-- asparagus definition
local def = {
drawtype = "plantlike",

View File

@ -70,15 +70,17 @@ end
-- beans
minetest.register_craftitem("farming:beans", {
description = S("Green Beans" .. " (♥1)"),
description = S("Green Beans"),
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_place = function(itemstack, placer, pointed_thing)
return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1")
end
})
farming.add_eatable("farming:beans", 1)
-- beans can be used for green dye
minetest.register_craft({
output = a.dye_green,

View File

@ -4,10 +4,10 @@ local a = farming.recipe_items
-- beetroot
minetest.register_craftitem("farming:beetroot", {
description = S("Beetroot") .. " (♥1)",
description = S("Beetroot"),
inventory_image = "farming_beetroot.png",
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)
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)
})
farming.add_eatable("farming:beetroot", 1)
-- beetroot soup
minetest.register_craftitem("farming:beetroot_soup", {
description = S("Beetroot Soup") .. " (♥6)",
description = S("Beetroot Soup"),
inventory_image = "farming_beetroot_soup.png",
groups = {flammable = 2, eatable = 6},
groups = {flammable = 2},
on_use = minetest.item_eat(6, "farming:bowl")
})
farming.add_eatable("farming:beetroot_soup", 6)
minetest.register_craft({
output = "farming:beetroot_soup",
recipe = {

View File

@ -3,11 +3,11 @@ local S = farming.translate
-- blackberries
minetest.register_craftitem("farming:blackberry", {
description = S("Blackberries" .. " (♥1)"),
description = S("Blackberries"),
inventory_image = "farming_blackberry.png",
groups = {
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)
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)
})
farming.add_eatable("farming:blackberry", 1)
local def = {
drawtype = "plantlike",
tiles = {"farming_blackberry_1.png"},

View File

@ -4,11 +4,11 @@ local a = farming.recipe_items
-- blueberries
minetest.register_craftitem("farming:blueberries", {
description = S("Wild Blueberries") .. " (♥1)",
description = S("Wild Blueberries"),
inventory_image = "farming_blueberries.png",
groups = {
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)
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)
})
farming.add_eatable("farming:blueberries", 1)
-- blueberry muffin (thanks to sosogirl123 @ deviantart.com for muffin image)
minetest.register_craftitem("farming:muffin_blueberry", {
description = S("Blueberry Muffin") .. " (♥2)",
description = S("Blueberry Muffin"),
inventory_image = "farming_blueberry_muffin.png",
on_use = minetest.item_eat(2),
groups = {compostability = 65, eatable = 2}
groups = {compostability = 65}
})
farming.add_eatable("farming:muffin_blueberry", 2)
minetest.register_craft({
output = "farming:muffin_blueberry 2",
recipe = {
@ -33,12 +37,14 @@ minetest.register_craft({
-- Blueberry Pie
minetest.register_craftitem("farming:blueberry_pie", {
description = S("Blueberry Pie") .. " (♥6)",
description = S("Blueberry Pie"),
inventory_image = "farming_blueberry_pie.png",
on_use = minetest.item_eat(6),
groups = {compostability = 75, eatable = 6}
groups = {compostability = 75}
})
farming.add_eatable("farming:blueberry_pie", 6)
minetest.register_craft({
output = "farming:blueberry_pie",
recipe = {

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- cabbage
minetest.register_craftitem("farming:cabbage", {
description = S("Cabbage") .. " (♥1)",
description = S("Cabbage"),
inventory_image = "farming_cabbage.png",
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)
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)
})
farming.add_eatable("farming:cabbage", 1)
local def = {
drawtype = "plantlike",
tiles = {"farming_cabbage_1.png"},

View File

@ -9,10 +9,10 @@ local a = farming.recipe_items
-- carrot
minetest.register_craftitem("farming:carrot", {
description = S("Carrot") .. " (♥4)",
description = S("Carrot"),
inventory_image = "farming_carrot.png",
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)
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)
})
farming.add_eatable("farming:carrot", 4)
-- carrot juice
minetest.register_craftitem("farming:carrot_juice", {
description = S("Carrot Juice") .. " (♥4)",
description = S("Carrot Juice"),
inventory_image = "farming_carrot_juice.png",
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({
output = "farming:carrot_juice",
recipe = {
@ -42,12 +46,14 @@ minetest.register_craft({
-- golden carrot
minetest.register_craftitem("farming:carrot_gold", {
description = S("Golden Carrot") .. " (♥10)",
description = S("Golden Carrot"),
inventory_image = "farming_carrot_gold.png",
on_use = minetest.item_eat(10),
groups = {eatable = 10}
groups = {flammable = 2}
})
farming.add_eatable("farming:carrot_gold", 10)
minetest.register_craft({
output = "farming:carrot_gold",
recipe = {{"group:food_carrot", "default:gold_lump"}}

View File

@ -4,10 +4,10 @@ local a = farming.recipe_items
-- chili pepper
minetest.register_craftitem("farming:chili_pepper", {
description = S("Chili Pepper") .. " (♥2)",
description = S("Chili Pepper"),
inventory_image = "farming_chili_pepper.png",
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)
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)
})
farming.add_eatable("farming:chili_pepper", 2)
-- bowl of chili
minetest.register_craftitem("farming:chili_bowl", {
description = S("Bowl of Chili") .. " (♥8)",
description = S("Bowl of Chili"),
inventory_image = "farming_chili_bowl.png",
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({
output = "farming:chili_bowl",
recipe = {

View File

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

View File

@ -14,7 +14,7 @@ minetest.register_craftitem("farming:coffee_beans", {
-- cup of coffee
minetest.register_node("farming:coffee_cup", {
description = S("Cup of Coffee") .. " (♥2)",
description = S("Cup of Coffee"),
drawtype = "torchlike",
tiles = {"farming_coffee_cup.png"},
inventory_image = "farming_coffee_cup.png",
@ -25,12 +25,14 @@ minetest.register_node("farming:coffee_cup", {
type = "fixed",
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,
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
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:drinking_cup", "vessels:drinking_glass")

View File

@ -9,10 +9,10 @@ local a = farming.recipe_items
-- corn
minetest.register_craftitem("farming:corn", {
description = S("Corn") .. " (♥3)",
description = S("Corn"),
inventory_image = "farming_corn.png",
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)
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)
})
farming.add_eatable("farming:corn", 3)
-- corn on the cob (texture by TenPlus1)
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",
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)
})
farming.add_eatable("farming:corn_cob", 5)
minetest.register_craft({
type = "cooking",
cooktime = 10,
@ -37,12 +41,14 @@ minetest.register_craft({
-- popcorn
minetest.register_craftitem("farming:popcorn", {
description = S("Popcorn") .. " (♥4)",
description = S("Popcorn"),
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)
})
farming.add_eatable("farming:popcorn", 4)
minetest.register_craft({
output = "farming:popcorn",
recipe = {

View File

@ -8,10 +8,10 @@ local S = farming.translate
-- cucumber
minetest.register_craftitem("farming:cucumber", {
description = S("Cucumber") .. " (♥4)",
description = S("Cucumber"),
inventory_image = "farming_cucumber.png",
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)
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)
})
farming.add_eatable("farming:cucumber", 4)
-- cucumber definition
local def = {
drawtype = "plantlike",

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- eggplant
minetest.register_craftitem("farming:eggplant", {
description = S("Eggplant") .. " (♥3)",
description = S("Eggplant"),
inventory_image = "farming_eggplant.png",
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)
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)
})
farming.add_eatable("farming:eggplant", 3)
-- definition
local def = {
drawtype = "plantlike",

View File

@ -13,12 +13,14 @@ minetest.register_craftitem("farming:garlic_clove", {
-- garlic bulb
minetest.register_craftitem("farming:garlic", {
description = S("Garlic") .. " (♥1)",
description = S("Garlic"),
inventory_image = "crops_garlic.png",
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({
output = "farming:garlic_clove 8",
recipe = {{"farming:garlic"}}

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- ginger
minetest.register_craftitem("farming:ginger", {
description = S("Ginger") .. " (♥1)",
description = S("Ginger"),
inventory_image = "farming_ginger.png",
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)
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)
})
farming.add_eatable("farming:ginger", 1)
-- ginger definition
local def = {
drawtype = "plantlike",

View File

@ -65,17 +65,19 @@ end
-- grapes
minetest.register_craftitem("farming:grapes", {
description = S("Grapes") .. " (♥2)",
description = S("Grapes"),
inventory_image = "farming_grapes.png",
on_use = minetest.item_eat(2),
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)
return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1")
end
})
farming.add_eatable("farming:grapes", 2)
-- grapes can be used for violet dye
minetest.register_craft({
output = a.dye_violet,

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- lettuce
minetest.register_craftitem("farming:lettuce", {
description = S("Lettuce") .. " (♥2)",
description = S("Lettuce"),
inventory_image = "farming_lettuce.png",
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)
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)
})
farming.add_eatable("farming:lettuce", 2)
local def = {
drawtype = "plantlike",
tiles = {"farming_lettuce_1.png"},

View File

@ -4,10 +4,10 @@ local a = farming.recipe_items
-- melon
minetest.register_craftitem("farming:melon_slice", {
description = S("Melon Slice") .. " (♥2)",
description = S("Melon Slice"),
inventory_image = "farming_melon_slice.png",
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)
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)
})
farming.add_eatable("farming:melon_slice", 2)
minetest.register_craft({
output = "farming:melon_8",
recipe = {

View File

@ -38,12 +38,14 @@ minetest.register_craftitem("farming:mint_leaf", {
-- mint tea
minetest.register_craftitem("farming:mint_tea", {
description = S("Mint Tea") .. " (♥2)",
description = S("Mint Tea"),
inventory_image = "farming_mint_tea.png",
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({
output = "farming:mint_tea",
recipe = {

View File

@ -10,10 +10,10 @@ local a = farming.recipe_items
-- onion
minetest.register_craftitem("farming:onion", {
description = S("Onion") .. " (♥1)",
description = S("Onion"),
inventory_image = "crops_onion.png",
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)
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)
})
farming.add_eatable("farming:onion", 1)
-- onion soup
minetest.register_craftitem("farming:onion_soup", {
description = S("Onion Soup") .. " (♥6)",
description = S("Onion Soup"),
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)
})
farming.add_eatable("farming:onion_soup", 6)
minetest.register_craft({
output = "farming:onion_soup",
recipe = {

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- item definition
minetest.register_craftitem("farming:parsley", {
description = S("Parsley") .. " (♥1)",
description = S("Parsley"),
inventory_image = "farming_parsley.png",
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)
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)
})
farming.add_eatable("farming:parsley", 1)
-- crop definition
local def = {
drawtype = "plantlike",

View File

@ -6,11 +6,10 @@ local a = farming.recipe_items
-- pea pod
minetest.register_craftitem("farming:pea_pod", {
description = S("Pea Pod") .. " (♥1)",
description = S("Pea Pod"),
inventory_image = "farming_pea_pod.png",
groups = {
compostability = 48, seed = 2, food_peas = 1, food_pea_pod = 1, flammable = 2,
eatable = 1
compostability = 48, seed = 2, food_peas = 1, food_pea_pod = 1, flammable = 2
},
on_place = function(itemstack, placer, pointed_thing)
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)
})
farming.add_eatable("farming:pea_pod", 1)
-- replacement for separate peas item that was removed
minetest.register_alias("farming:peas", "farming:pea_pod")
-- pea soup
minetest.register_craftitem("farming:pea_soup", {
description = S("Pea Soup") .. " (♥4)",
description = S("Pea Soup"),
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)
})
farming.add_eatable("farming:pea_soup", 4)
minetest.register_craft({
output = "farming:pea_soup",
recipe = {

View File

@ -20,28 +20,34 @@ minetest.register_craftitem("farming:peppercorn", {
-- green pepper
minetest.register_craftitem("farming:pepper", {
description = S("Green Pepper") .. " (♥2)",
description = S("Green Pepper"),
inventory_image = "crops_pepper.png",
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
minetest.register_craftitem("farming:pepper_yellow", {
description = S("Yellow Pepper") .. " (♥3)",
description = S("Yellow Pepper"),
inventory_image = "crops_pepper_yellow.png",
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
minetest.register_craftitem("farming:pepper_red", {
description = S("Red Pepper") .. " (♥3)",
description = S("Red Pepper"),
inventory_image = "crops_pepper_red.png",
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({
output = "farming:peppercorn",
recipe = {{"group:food_pepper"}}

View File

@ -36,12 +36,14 @@ minetest.register_node("farming:pineapple", {
-- pineapple
minetest.register_craftitem("farming:pineapple_ring", {
description = S("Pineapple Ring") .. " (♥1)",
description = S("Pineapple Ring"),
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)
})
farming.add_eatable("farming:pineapple_ring", 1)
minetest.register_craft( {
output = "farming:pineapple_ring 5",
recipe = {{"group:food_pineapple"}},
@ -50,12 +52,14 @@ minetest.register_craft( {
-- pineapple juice
minetest.register_craftitem("farming:pineapple_juice", {
description = S("Pineapple Juice") .. " (♥4)",
description = S("Pineapple Juice"),
inventory_image = "farming_pineapple_juice.png",
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({
output = "farming:pineapple_juice",
recipe = {

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 = {

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- pumpkin slice
minetest.register_craftitem("farming:pumpkin_slice", {
description = S("Pumpkin Slice") .. " (♥2)",
description = S("Pumpkin Slice"),
inventory_image = "farming_pumpkin_slice.png",
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)
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)
})
farming.add_eatable("farming:pumpkin_slice", 2)
minetest.register_craft({
output = "farming:pumpkin",
recipe = {
@ -125,12 +127,14 @@ minetest.register_craft({
-- pumpkin bread
minetest.register_craftitem("farming:pumpkin_bread", {
description = S("Pumpkin Bread") .. " (♥8)",
description = S("Pumpkin Bread"),
inventory_image = "farming_pumpkin_bread.png",
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", {
description = S("Pumpkin Dough"),
inventory_image = "farming_pumpkin_dough.png"

View File

@ -4,11 +4,11 @@ local a = farming.recipe_items
-- raspberries
minetest.register_craftitem("farming:raspberries", {
description = S("Raspberries") .. " (♥1)",
description = S("Raspberries"),
inventory_image = "farming_raspberries.png",
groups = {
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)
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)
})
farming.add_eatable("farming:raspberries", 1)
-- raspberry smoothie
minetest.register_craftitem("farming:smoothie_raspberry", {
description = S("Raspberry Smoothie") .. " (♥2)",
description = S("Raspberry Smoothie"),
inventory_image = "farming_raspberry_smoothie.png",
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({
output = "farming:smoothie_raspberry",
recipe = {

View File

@ -4,10 +4,10 @@ local a = farming.recipe_items
-- rhubarb
minetest.register_craftitem("farming:rhubarb", {
description = S("Rhubarb") .. " (♥1)",
description = S("Rhubarb"),
inventory_image = "farming_rhubarb.png",
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)
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)
})
farming.add_eatable("farming:rhubarb", 1)
-- rhubarb pie
minetest.register_craftitem("farming:rhubarb_pie", {
description = S("Rhubarb Pie") .. " (♥6)",
description = S("Rhubarb Pie"),
inventory_image = "farming_rhubarb_pie.png",
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({
output = "farming:rhubarb_pie",
recipe = {

View File

@ -46,12 +46,14 @@ minetest.register_craft({
-- rice flour and bread
minetest.register_craftitem("farming:rice_bread", {
description = S("Rice Bread") .. " (♥5)",
description = S("Rice Bread"),
inventory_image = "farming_rice_bread.png",
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", {
description = S("Rice Flour"),
inventory_image = "farming_rice_flour.png",

View File

@ -81,12 +81,14 @@ minetest.register_craft({
-- Multigrain bread
minetest.register_craftitem("farming:bread_multigrain", {
description = S("Multigrain Bread") .. " (♥7)",
description = S("Multigrain Bread"),
inventory_image = "farming_bread_multigrain.png",
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({
type = "cooking",
cooktime = 15,

View File

@ -51,7 +51,7 @@ minetest.register_craft( {
-- soy milk
minetest.register_node("farming:soy_milk", {
description = S("Soy Milk") .. " (♥2)",
description = S("Soy Milk"),
drawtype = "plantlike",
tiles = {"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"),
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
},
is_ground_content = false,
sounds = farming.sounds.node_sound_glass_defaults()
})
farming.add_eatable("farming:soy_milk", 2)
minetest.register_craft( {
output = "farming:soy_milk",
recipe = {
@ -85,14 +87,16 @@ minetest.register_craft( {
-- tofu
minetest.register_craftitem("farming:tofu", {
description = S("Tofu") .. " (♥3)",
description = S("Tofu"),
inventory_image = "farming_tofu.png",
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)
})
farming.add_eatable("farming:tofu", 3)
minetest.register_craft({
output = "farming:tofu",
recipe = {
@ -104,12 +108,14 @@ minetest.register_craft({
-- cooked tofu
minetest.register_craftitem("farming:tofu_cooked", {
description = S("Cooked Tofu") .. " (♥6)",
description = S("Cooked Tofu"),
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)
})
farming.add_eatable("farming:tofu_cooked", 6)
minetest.register_craft({
type = "cooking",
output = "farming:tofu_cooked",

View File

@ -3,10 +3,10 @@ local S = farming.translate
-- spinach
minetest.register_craftitem("farming:spinach", {
description = S("Spinach") .. " (♥1)",
description = S("Spinach"),
inventory_image = "farming_spinach.png",
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)
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)
})
farming.add_eatable("farming:spinach", 1)
-- definition
local def = {
drawtype = "plantlike",

View File

@ -3,11 +3,10 @@ local S = farming.translate
-- Strawberry (can also be planted as seed)
minetest.register_craftitem(":ethereal:strawberry", {
description = S("Strawberry") .. " (♥1)",
description = S("Strawberry"),
inventory_image = "ethereal_strawberry.png",
groups = {
compostability = 48, seed = 2, food_strawberry = 1, food_berry = 1,
flammable = 2, eatable = 1
compostability = 48, seed = 2, food_strawberry = 1, food_berry = 1, flammable = 2
},
on_place = function(itemstack, placer, pointed_thing)
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)
})
farming.add_eatable("ethereal:strawberry", 1)
-- Define Strawberry Bush growth stages
local def = {
drawtype = "plantlike",

View File

@ -45,14 +45,16 @@ minetest.register_craft({
-- 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",
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)
})
farming.add_eatable("farming:sunflower_seeds_toasted", 1)
minetest.register_craft({
type = "cooking",
cooktime = 10,
@ -99,12 +101,14 @@ minetest.register_craft({
-- sunflower seed bread
minetest.register_craftitem("farming:sunflower_bread", {
description = S("Sunflower Seed Bread") .. " (♥8)",
description = S("Sunflower Seed Bread"),
inventory_image = "farming_sunflower_bread.png",
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({
output = "farming:sunflower_bread",
recipe = {

View File

@ -8,23 +8,27 @@ local S = farming.translate
-- tomato
minetest.register_craftitem("farming:tomato", {
description = S("Tomato") .. " (♥4)",
description = S("Tomato"),
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)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1")
end,
on_use = minetest.item_eat(4)
})
farming.add_eatable("farming:tomato", 4)
-- tomato soup
minetest.register_craftitem("farming:tomato_soup", {
description = S("Tomato Soup") .. " (♥8)",
description = S("Tomato Soup"),
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")
})
farming.add_eatable("farming:tomato_soup", 8)
minetest.register_craft({
output = "farming:tomato_soup",
recipe = {

View File

@ -4,10 +4,10 @@ local a = farming.recipe_items
-- vanilla
minetest.register_craftitem("farming:vanilla", {
description = S("Vanilla") .. " (♥1)",
description = S("Vanilla"),
inventory_image = "farming_vanilla.png",
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)
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)
})
farming.add_eatable("farming:vanilla", 1)
-- crop definition
local def = {
drawtype = "plantlike",

View File

@ -99,12 +99,14 @@ minetest.register_craft({
-- bread
minetest.register_craftitem("farming:bread", {
description = S("Bread") .. " (♥5)",
description = S("Bread"),
inventory_image = "farming_bread.png",
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({
type = "cooking",
cooktime = 15,

162
food.lua
View File

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

View File

@ -7,7 +7,7 @@
farming = {
mod = "redo",
version = "20240625",
version = "20240726",
path = minetest.get_modpath("farming"),
select = {
type = "fixed",
@ -767,6 +767,27 @@ if input then
input:close()
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
dofile(farming.path .. "/items.lua")