1
0
mirror of https://github.com/rubenwardy/food.git synced 2024-12-23 00:10:18 +01:00

Soup and BetterHud support

This commit is contained in:
Rubenwardy 2013-09-10 18:35:04 +01:00
parent de199c93be
commit c40055af83
6 changed files with 88 additions and 8 deletions

View File

@ -5,3 +5,4 @@ plantlib?
docfarming? docfarming?
animalmaterials? animalmaterials?
my_mobs? my_mobs?
hud?

View File

@ -52,6 +52,13 @@ function food.asupport(group,add)
add() add()
end end
function food.item_eat(amt)
if minetest.get_modpath("hud") then
return hud.item_eat(hunger_change)
else
return minetest.item_eat(amt)
end
end
-- Add support for other mods -- Add support for other mods
food.support("wheat","farming","farming:wheat") food.support("wheat","farming","farming:wheat")
@ -67,6 +74,9 @@ food.support("cocoa","farming_plus","farming_plus:cocoa_bean")
food.support("milk","animalmaterials","animalmaterials:milk") food.support("milk","animalmaterials","animalmaterials:milk")
food.support("milk","my_mobs","my_mobs:milk_glass_cup") food.support("milk","my_mobs","my_mobs:milk_glass_cup")
food.support("egg","animalmaterials","animalmaterials:egg") food.support("egg","animalmaterials","animalmaterials:egg")
--food.support("meat_raw","mobs","mobs:meat_raw")
food.support("meat_raw","animalmaterials","animalmaterials:meat_raw")
food.support("meat","mobs","mobs:meat")
-- Default inbuilt ingrediants -- Default inbuilt ingrediants
food.asupport("wheat",function() food.asupport("wheat",function()
@ -123,7 +133,7 @@ food.asupport("strawberry",function()
minetest.register_craftitem("food:strawberry", { minetest.register_craftitem("food:strawberry", {
description = "Strawberry", description = "Strawberry",
inventory_image = "food_strawberry.png", inventory_image = "food_strawberry.png",
on_use = minetest.item_eat(2), on_use = food.item_eat(2),
groups = {food_strawberry=1} groups = {food_strawberry=1}
}) })
minetest.register_craft({ minetest.register_craft({
@ -138,7 +148,7 @@ food.asupport("carrot",function()
description = "Carrot", description = "Carrot",
inventory_image = "food_carrot.png", inventory_image = "food_carrot.png",
groups = {food_carrot=1}, groups = {food_carrot=1},
on_use = minetest.item_eat(3) on_use = food.item_eat(3)
}) })
minetest.register_craft({ minetest.register_craft({
output = "food:carrot", output = "food:carrot",
@ -151,7 +161,7 @@ food.asupport("milk",function()
minetest.register_craftitem("food:milk", { minetest.register_craftitem("food:milk", {
description = "Milk", description = "Milk",
image = "food_milk.png", image = "food_milk.png",
on_use = minetest.item_eat(1), on_use = food.item_eat(1),
groups = { eatable=1, food_milk = 1 }, groups = { eatable=1, food_milk = 1 },
stack_max=10 stack_max=10
}) })
@ -194,6 +204,36 @@ food.asupport("cocoa",function()
} }
}) })
end) end)
food.asupport("meat_raw",function()
minetest.register_craftitem("food:meat_raw", {
description = "Raw meat",
image = "food_meat_raw.png",
on_use = food.item_eat(1),
groups = { meat=1, eatable=1, food_meat_raw=1 },
stack_max=25
})
minetest.register_craft({
output = "food:meat_raw",
recipe = {
{"default:apple"},
{"default:dirt"}
}
})
end)
food.asupport("food:meat",function()
minetest.register_craftitem("food:meat", {
description = "Venison",
inventory_image = "food_meat.png",
groups = {food_meat=1,food_chicken=1}
})
minetest.register_craft({
type = "cooking",
output = "food:meat",
recipe = "group:food_meat_raw",
cooktime = 30
})
end)
-- Register sugar -- Register sugar
minetest.register_craftitem("food:sugar", { minetest.register_craftitem("food:sugar", {
@ -268,6 +308,13 @@ minetest.register_craftitem("food:bowl",{
inventory_image = "food_bowl.png", inventory_image = "food_bowl.png",
groups = {food_bowl=1} groups = {food_bowl=1}
}) })
minetest.register_craft({
output = "food:bowl",
recipe = {
{"default:clay_lump","","default:clay_lump"},
{"","default:clay_lump",""}
}
})
-- Register butter -- Register butter
minetest.register_craftitem("food:butter", { minetest.register_craftitem("food:butter", {
description = "Butter", description = "Butter",
@ -285,7 +332,7 @@ minetest.register_craft({
minetest.register_craftitem("food:cheese", { minetest.register_craftitem("food:cheese", {
description = "Cheese", description = "Cheese",
inventory_image = "food_cheese.png", inventory_image = "food_cheese.png",
on_use = minetest.item_eat(4), on_use = food.item_eat(4),
groups = {food_cheese=1} groups = {food_cheese=1}
}) })
minetest.register_craft({ minetest.register_craft({
@ -299,6 +346,7 @@ minetest.register_craft({
minetest.register_craftitem("food:pasta_bake",{ minetest.register_craftitem("food:pasta_bake",{
description = "Pasta Bake", description = "Pasta Bake",
inventory_image = "food_pasta_bake.png", inventory_image = "food_pasta_bake.png",
on_use = food.item_eat(4),
groups = {food=3} groups = {food=3}
}) })
minetest.register_craftitem("food:pasta_bake_raw",{ minetest.register_craftitem("food:pasta_bake_raw",{
@ -319,10 +367,41 @@ minetest.register_craft({
} }
}) })
-- Soups
local soups = {"tomato","chicken"}
for i=1, #soups do
local flav = soups[i]
minetest.register_craftitem("food:soup_"..flav,{
description = flav.." Soup",
inventory_image = "food_soup_"..flav..".png",
on_use = food.item_eat(4),
groups = {food=3}
})
minetest.register_craftitem("food:soup_"..flav.."_raw",{
description = "Uncooked ".. flav.." Soup",
inventory_image = "food_soup_"..flav.."_raw.png",
})
minetest.register_craft({
type = "cooking",
output = "food:soup_"..flav,
recipe = "food:soup_"..flav.."_raw",
})
minetest.register_craft({
output = "food:soup_"..flav.."_raw",
recipe = {
{"", "", ""},
{"bucket:bucket_water", "group:food_"..flav, "bucket:bucket_water"},
{"", "group:food_bowl", ""},
},
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"},{"bucket:bucket_water", "bucket:bucket_empty"}}
})
end
-- Register cakes -- Register cakes
minetest.register_node("food:cake", { minetest.register_node("food:cake", {
description = "Cake", description = "Cake",
on_use = minetest.item_eat(4), on_use = food.item_eat(4),
groups={food=3,crumbly=3}, groups={food=3,crumbly=3},
tiles = { tiles = {
"food_cake_texture.png", "food_cake_texture.png",
@ -347,7 +426,7 @@ minetest.register_node("food:cake", {
}) })
minetest.register_node("food:cake_choco", { minetest.register_node("food:cake_choco", {
description = "Chocolate Cake", description = "Chocolate Cake",
on_use = minetest.item_eat(4), on_use = food.item_eat(4),
groups={food=3,crumbly=3}, groups={food=3,crumbly=3},
tiles = { tiles = {
"food_cake_choco_texture.png", "food_cake_choco_texture.png",
@ -372,7 +451,7 @@ minetest.register_node("food:cake_choco", {
}) })
minetest.register_node("food:cake_carrot", { minetest.register_node("food:cake_carrot", {
description = "Carrot Cake", description = "Carrot Cake",
on_use = minetest.item_eat(4), on_use = food.item_eat(4),
groups={food=3,crumbly=3}, groups={food=3,crumbly=3},
walkable = false, walkable = false,
sunlight_propagates = true, sunlight_propagates = true,
@ -398,7 +477,7 @@ minetest.register_node("food:cake_carrot", {
minetest.register_craftitem("food:cake_cheese",{ minetest.register_craftitem("food:cake_cheese",{
description = "Cheese cake", description = "Cheese cake",
inventory_image = "food_cake_cheese.png", inventory_image = "food_cake_cheese.png",
on_use = minetest.item_eat(4), on_use = food.item_eat(4),
groups={food=3,crumbly=3} groups={food=3,crumbly=3}
}) })
minetest.register_craft({ minetest.register_craft({

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B