1
0
mirror of https://codeberg.org/tenplus1/mobs_animal.git synced 2024-12-22 17:00:26 +01:00

use helper function for {eatable}

This commit is contained in:
tenplus1 2024-07-26 17:10:17 +01:00
parent 9cd2974533
commit 01f4922892
7 changed files with 59 additions and 30 deletions

View File

@ -73,12 +73,13 @@ mobs:alias_mob("mobs:bee", "mobs_animal:bee")
-- honey
minetest.register_craftitem(":mobs:honey", {
description = S("Honey") .. " (♥4)",
description = S("Honey"),
inventory_image = "mobs_honey_inv.png",
on_use = minetest.item_eat(4),
groups = {food_honey = 1, food_sugar = 1, flammable = 1, eatable = 4}
groups = {food_honey = 1, food_sugar = 1}
})
mobs.add_eatable("mobs:honey", 4)
-- beehive (when placed spawns bee)
minetest.register_node(":mobs:beehive", {

View File

@ -157,20 +157,24 @@ mobs:alias_mob("mobs:bunny", "mobs_animal:bunny") -- compatibility
-- raw rabbit
minetest.register_craftitem(":mobs:rabbit_raw", {
description = S("Raw Rabbit") .. " (♥3)",
description = S("Raw Rabbit"),
inventory_image = "mobs_rabbit_raw.png",
on_use = minetest.item_eat(3),
groups = {food_meat_raw = 1, food_rabbit_raw = 1, flammable = 2, eatable = 3}
groups = {food_meat_raw = 1, food_rabbit_raw = 1}
})
mobs.add_eatable("mobs:rabbit_raw", 3)
-- cooked rabbit
minetest.register_craftitem(":mobs:rabbit_cooked", {
description = S("Cooked Rabbit") .. " (♥5)",
description = S("Cooked Rabbit"),
inventory_image = "mobs_rabbit_cooked.png",
on_use = minetest.item_eat(5),
groups = {food_meat = 1, food_rabbit = 1, flammable = 2, eatable = 5}
groups = {food_meat = 1, food_rabbit = 1}
})
mobs.add_eatable("mobs:rabbit_cooked", 5)
minetest.register_craft({
type = "cooking",
output = "mobs:rabbit_cooked",

View File

@ -270,12 +270,14 @@ minetest.register_node(":mobs:egg", {
-- fried egg
minetest.register_craftitem(":mobs:chicken_egg_fried", {
description = S("Fried Egg") .. " (♥2)",
description = S("Fried Egg"),
inventory_image = "mobs_chicken_egg_fried.png",
on_use = minetest.item_eat(2),
groups = {food_egg_fried = 1, flammable = 2, eatable = 2}
groups = {food_egg_fried = 1}
})
mobs.add_eatable("mobs:chicken_egg_fried", 2)
minetest.register_craft({
type = "cooking",
recipe = "mobs:egg",
@ -284,20 +286,24 @@ minetest.register_craft({
-- raw chicken
minetest.register_craftitem(":mobs:chicken_raw", {
description = S("Raw Chicken") .. " (♥2)",
description = S("Raw Chicken"),
inventory_image = "mobs_chicken_raw.png",
on_use = minetest.item_eat(2),
groups = {food_meat_raw = 1, food_chicken_raw = 1, flammable = 2, eatable = 2}
groups = {food_meat_raw = 1, food_chicken_raw = 1}
})
mobs.add_eatable("mobs:chicken_raw", 2)
-- cooked chicken
minetest.register_craftitem(":mobs:chicken_cooked", {
description = S("Cooked Chicken") .. " (♥6)",
description = S("Cooked Chicken"),
inventory_image = "mobs_chicken_cooked.png",
on_use = minetest.item_eat(6),
groups = {food_meat = 1, food_chicken = 1, flammable = 2, eatable = 6}
groups = {food_meat = 1, food_chicken = 1}
})
mobs.add_eatable("mobs:chicken_cooked", 6)
minetest.register_craft({
type = "cooking",
recipe = "mobs:chicken_raw",

24
cow.lua
View File

@ -173,21 +173,25 @@ mobs:alias_mob("mobs:cow", "mobs_animal:cow") -- compatibility
-- bucket of milk
minetest.register_craftitem(":mobs:bucket_milk", {
description = S("Bucket of Milk") .. " (♥8)",
description = S("Bucket of Milk"),
inventory_image = "mobs_bucket_milk.png",
stack_max = 1,
on_use = minetest.item_eat(8, "bucket:bucket_empty"),
groups = {food_milk = 1, flammable = 3, drink = 1, eatable = 8}
groups = {food_milk = 1, drink = 1}
})
mobs.add_eatable("mobs:bucket_milk", 8)
-- glass of milk
minetest.register_craftitem(":mobs:glass_milk", {
description = S("Glass of Milk") .. " (♥2)",
description = S("Glass of Milk"),
inventory_image = "mobs_glass_milk.png",
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
groups = {food_milk_glass = 1, flammable = 3, vessel = 1, drink = 1, eatable = 2}
groups = {food_milk_glass = 1, vessel = 1, drink = 1}
})
mobs.add_eatable("mobs:glass_milk", 2)
minetest.register_craft({
output = "mobs:glass_milk 4",
recipe = {
@ -213,12 +217,14 @@ minetest.register_craft({
-- butter
minetest.register_craftitem(":mobs:butter", {
description = S("Butter") .. " (♥1)",
description = S("Butter"),
inventory_image = "mobs_butter.png",
on_use = minetest.item_eat(1),
groups = {food_butter = 1, flammable = 2, eatable = 1}
groups = {food_butter = 1}
})
mobs.add_eatable("mobs:butter", 1)
local salt_item = "default:sapling" -- some saplings are high in sodium
if minetest.get_modpath("farming") and farming and farming.mod then
@ -233,12 +239,14 @@ minetest.register_craft({
-- cheese wedge
minetest.register_craftitem(":mobs:cheese", {
description = S("Cheese") .. " (♥4)",
description = S("Cheese"),
inventory_image = "mobs_cheese.png",
on_use = minetest.item_eat(4),
groups = {food_cheese = 1, flammable = 2, eatable = 4}
groups = {food_cheese = 1}
})
mobs.add_eatable("mobs:cheese", 4)
minetest.register_craft({
type = "cooking",
output = "mobs:cheese",

View File

@ -92,12 +92,14 @@ mobs:alias_mob("mobs:rat", "mobs_animal:rat") -- compatibility
-- cooked rat, yummy!
minetest.register_craftitem(":mobs:rat_cooked", {
description = S("Cooked Rat") .. " (♥3)",
description = S("Cooked Rat"),
inventory_image = "mobs_cooked_rat.png",
on_use = minetest.item_eat(3),
groups = {food_rat = 1, flammable = 2, eatable = 3}
groups = {food_rat = 1}
})
mobs.add_eatable("mobs:rat_cooked", 3)
minetest.register_craft({
type = "cooking",
output = "mobs:rat_cooked",

View File

@ -515,20 +515,24 @@ mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white") -- compatibility
-- raw mutton
minetest.register_craftitem(":mobs:mutton_raw", {
description = S("Raw Mutton") .. " (♥2)",
description = S("Raw Mutton"),
inventory_image = "mobs_mutton_raw.png",
on_use = minetest.item_eat(2),
groups = {food_meat_raw = 1, food_mutton_raw = 1, flammable = 2, eatable = 2}
groups = {food_meat_raw = 1, food_mutton_raw = 1}
})
mobs.add_eatable("mobs:mutton_raw", 2)
-- cooked mutton
minetest.register_craftitem(":mobs:mutton_cooked", {
description = S("Cooked Mutton") .. " (♥6)",
description = S("Cooked Mutton"),
inventory_image = "mobs_mutton_cooked.png",
on_use = minetest.item_eat(6),
groups = {food_meat = 1, food_mutton = 1, flammable = 2, eatable = 6}
groups = {food_meat = 1, food_mutton = 1}
})
mobs.add_eatable("mobs:mutton_cooked", 6)
minetest.register_craft({
type = "cooking",
output = "mobs:mutton_cooked",

View File

@ -104,20 +104,24 @@ mobs:alias_mob("mobs:pumba", "mobs_animal:pumba") -- compatibility
-- raw porkchop
minetest.register_craftitem(":mobs:pork_raw", {
description = S("Raw Porkchop") .. " (♥4)",
description = S("Raw Porkchop"),
inventory_image = "mobs_pork_raw.png",
on_use = minetest.item_eat(4),
groups = {food_meat_raw = 1, food_pork_raw = 1, flammable = 2, eatable = 4}
groups = {food_meat_raw = 1, food_pork_raw = 1}
})
mobs.add_eatable("mobs:pork_raw", 4)
-- cooked porkchop
minetest.register_craftitem(":mobs:pork_cooked", {
description = S("Cooked Porkchop") .. " (♥8)",
description = S("Cooked Porkchop"),
inventory_image = "mobs_pork_cooked.png",
on_use = minetest.item_eat(8),
groups = {food_meat = 1, food_pork = 1, flammable = 2, eatable = 8}
groups = {food_meat = 1, food_pork = 1}
})
mobs.add_eatable("mobs:pork_cooked", 8)
minetest.register_craft({
type = "cooking",
output = "mobs:pork_cooked",