1
0
mirror of https://github.com/rubenwardy/food.git synced 2024-12-22 16:00:19 +01:00

Release 2.1

This commit is contained in:
rubenwardy 2014-04-10 19:18:25 +01:00
parent 11175d025f
commit 810022f19c
6 changed files with 99 additions and 101 deletions

View File

@ -3,6 +3,8 @@ The Food Mod
This is the main mod in the food mod collection. This is the main mod in the food mod collection.
Version 2.1
The Aims The Aims
-------- --------
@ -14,27 +16,24 @@ All content should follow these aims:
Documentation Documentation
------------- -------------
Advanced documentation and a recipe guide is coming soon! Recipe guide: https://www.dropbox.com/s/tsvjmobv9n3isu0/food_crafting.pdf?dl=1
Other mods Expansion Packs
---------- ---------------
There are expansion mods avaliable. Just install them in a mod folder, and everything should be fine. There are expansion mods available. Just install them in a mod folder, and everything should be fine.
* Sweet Foods - https://github.com/rubenwardy/food_sweet
* Modern food (Needs updating) - burgers, soft drinks, pop corn, coffee, etc * Modern food (Needs updating) - burgers, soft drinks, pop corn, coffee, etc
* English food (Coming Soon) - breakfast, pastries, pasties, buns, muffins, teas, cheese
* Asian food (Coming Soon) - indian, chinese, thai
Licensing Licensing
--------- ---------
The code, textures and nodeboxes in this mod are, unless otherwise notified, licensed under CC BY SA. Created by rubenwardy
License for code: GPL 3.0 or later.
License for textures: CC-BY-SA
ANDREW "RUBENWARDY" WARD Exceptions:
Creative Commons BY-SA 3.0
(or similar)
http://creativecommons.org/licenses/by-sa/3.0/
* Baked potato texture by Doc, WTFPL * Baked potato texture by Doc, WTFPL
* Dough, flour and wheat textures from default farming mod, WTFPL * Dough, flour and wheat textures from default farming mod, WTFPL

View File

@ -1,3 +1,4 @@
intllib?
default? default?
farming? farming?
farming_plus? farming_plus?

172
init.lua
View File

@ -7,13 +7,15 @@
-- basic foods -- basic foods
-- ===================================== -- =====================================
print("Food Mod - Version 2.1")
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if (minetest.get_modpath("intllib")) then if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua") dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end
end end
food = { food = {
@ -23,10 +25,13 @@ food = {
debug = false debug = false
} }
-- Checks for external content, and adds support
function food.support(group,mod,item) function food.support(group,mod,item)
food.atsup[group] = true food.atsup[group] = true
if not minetest.get_modpath(mod) then if not minetest.get_modpath(mod) then
print("mod '"..mod.."' is not installed") if food.debug then
print("[FOOD MOD DEBUG] mod '"..mod.."' is not installed")
end
return return
end end
@ -39,7 +44,7 @@ function food.support(group,mod,item)
local data = minetest.registered_items[item] local data = minetest.registered_items[item]
if not data then if not data then
print("item '"..item.."' not found") print("[FOOD MOD WARNING] item '"..item.."' not found")
return return
end end
@ -52,6 +57,8 @@ function food.support(group,mod,item)
end end
food.supported[group] = true food.supported[group] = true
end end
-- Defines built in items if needed
function food.asupport(group,add) function food.asupport(group,add)
food.df[group] = true food.df[group] = true
if food.supported[group] then if food.supported[group] then
@ -64,11 +71,15 @@ function food.asupport(group,add)
return return
end end
end end
print("registering "..group.." inbuilt definition") if food.debug then
print("registering "..group.." inbuilt definition")
end
add() add()
end end
-- Checks for hunger mods to register food on
function food.item_eat(amt) function food.item_eat(amt)
if minetest.get_modpath("hud") then if minetest.get_modpath("hud") then
return hud.item_eat(amt) return hud.item_eat(amt)
@ -77,20 +88,52 @@ function food.item_eat(amt)
end end
end end
-- Debug to check all supports have inbuilt -- Registers craft item or node depending on settings
function food.register(name,data,mod)
if (minetest.setting_getbool("food_use_2d") or (mod ~= nil and minetest.setting_getbool("food_"..mod.."_use_2d"))) then
minetest.register_craftitem(name,{
description = data.description,
inventory_image = data.inventory_image,
groups = data.groups,
on_use = data.on_use
})
else
local newdata = {
description = data.description,
tiles = data.tiles,
groups = data.groups,
on_use = data.on_use,
walkable = false,
sunlight_propagates = true,
drawtype="nodebox",
paramtype = "light",
node_box = data.node_box
}
if (minetest.setting_getbool("food_2d_inv_image")) then
newdata.inventory_image = data.inventory_image
end
minetest.register_node(name,newdata)
end
end
-- Allows for overriding in the future
function food.craft(craft)
minetest.register_craft(craft)
end
-- Debug to check all supports have in built version, etc
if food.debug then if food.debug then
minetest.after(0, function() minetest.after(0, function()
for name, val in pairs(food.atsup) do for name, val in pairs(food.atsup) do
if not food.df[name] then if not food.df[name] then
print("[FOOD DEBUG] Ingredient "..name.." has no built in equiv") print("[FOOD MOD DEBUG] Ingredient "..name.." has no built in equiv")
end end
end end
for name, val in pairs(food.df) do for name, val in pairs(food.df) do
if not food.atsup[name] then if not food.atsup[name] then
print("[FOOD DEBUG] Inbuilt ingredient "..name.." has no supported external equiv") print("[FOOD MOD DEBUG] Inbuilt ingredient "..name.." has no supported external equiv")
end end
end end
end) end)
@ -104,8 +147,6 @@ food.support("potato","veggies","veggies:potato")
food.support("potato","farming_plus","farming_plus:potato_item") food.support("potato","farming_plus","farming_plus:potato_item")
food.support("tomato","farming_plus","farming_plus:tomato_item") food.support("tomato","farming_plus","farming_plus:tomato_item")
food.support("tomato","plantlib","plantlib:tomato") food.support("tomato","plantlib","plantlib:tomato")
food.support("strawberry","farming_plus","farming_plus:strawberry_item")
food.support("strawberry","plantlib","plantlib:strawberry")
food.support("carrot","farming_plus","farming_plus:carrot_item") food.support("carrot","farming_plus","farming_plus:carrot_item")
food.support("carrot","docfarming","docfarming:carrot") food.support("carrot","docfarming","docfarming:carrot")
food.support("carrot","plantlib","plantlib:carrot") food.support("carrot","plantlib","plantlib:carrot")
@ -120,7 +161,6 @@ food.support("meat_raw","animalmaterials","animalmaterials:meat_raw")
food.support("meat","mobs","mobs:meat") food.support("meat","mobs","mobs:meat")
food.support("meat","jkanimals","jkanimals:meat") food.support("meat","jkanimals","jkanimals:meat")
food.support("cup","vessels","vessels:drinking_glass") food.support("cup","vessels","vessels:drinking_glass")
food.support("cup","animalmaterials","animalmaterials:glass")
food.support("sugar","jkfarming","jkfarming:sugar") food.support("sugar","jkfarming","jkfarming:sugar")
food.support("sugar","bushes_classic","bushes:sugar") food.support("sugar","bushes_classic","bushes:sugar")
@ -132,7 +172,7 @@ food.asupport("wheat",function()
groups = {food_wheat=1} groups = {food_wheat=1}
}) })
minetest.register_craft({ food.craft({
output = "food:wheat", output = "food:wheat",
recipe = { recipe = {
{"default:dry_shrub"}, {"default:dry_shrub"},
@ -145,14 +185,14 @@ food.asupport("flour",function()
inventory_image = "food_flour.png", inventory_image = "food_flour.png",
groups = {food_flour = 1} groups = {food_flour = 1}
}) })
minetest.register_craft({ food.craft({
output = "food:flour", output = "food:flour",
recipe = { recipe = {
{"group:food_wheat"}, {"group:food_wheat"},
{"group:food_wheat"} {"group:food_wheat"}
} }
}) })
minetest.register_craft({ food.craft({
output = "food:flour", output = "food:flour",
recipe = { recipe = {
{"default:sand"}, {"default:sand"},
@ -166,7 +206,7 @@ food.asupport("potato",function()
inventory_image = "food_potato.png", inventory_image = "food_potato.png",
groups = {food_potato = 1} groups = {food_potato = 1}
}) })
minetest.register_craft({ food.craft({
output = "food:potato", output = "food:potato",
recipe = { recipe = {
{"default:dirt"}, {"default:dirt"},
@ -181,7 +221,7 @@ food.asupport("tomato",function()
inventory_image = "food_tomato.png", inventory_image = "food_tomato.png",
groups = {food_tomato = 1} groups = {food_tomato = 1}
}) })
minetest.register_craft({ food.craft({
output = "food:tomato", output = "food:tomato",
recipe = { recipe = {
{"", "default:desert_sand", ""}, {"", "default:desert_sand", ""},
@ -190,20 +230,6 @@ food.asupport("tomato",function()
} }
}) })
end) end)
food.asupport("strawberry",function()
minetest.register_craftitem("food:strawberry", {
description = S("Strawberry"),
inventory_image = "food_strawberry.png",
on_use = food.item_eat(2),
groups = {food_strawberry=1}
})
minetest.register_craft({
output = "food:strawberry",
recipe = {
{"default:apple"},
}
})
end)
food.asupport("carrot",function() food.asupport("carrot",function()
minetest.register_craftitem("food:carrot", { minetest.register_craftitem("food:carrot", {
description = S("Carrot"), description = S("Carrot"),
@ -211,7 +237,7 @@ food.asupport("carrot",function()
groups = {food_carrot=1}, groups = {food_carrot=1},
on_use = food.item_eat(3) on_use = food.item_eat(3)
}) })
minetest.register_craft({ food.craft({
output = "food:carrot", output = "food:carrot",
recipe = { recipe = {
{"default:apple","default:apple","default:apple"}, {"default:apple","default:apple","default:apple"},
@ -226,7 +252,7 @@ food.asupport("milk",function()
groups = { eatable=1, food_milk = 1 }, groups = { eatable=1, food_milk = 1 },
stack_max=10 stack_max=10
}) })
minetest.register_craft({ food.craft({
output = "food:milk", output = "food:milk",
recipe = { recipe = {
{"default:sand"}, {"default:sand"},
@ -241,7 +267,7 @@ food.asupport("egg",function()
inventory_image = "food_egg.png", inventory_image = "food_egg.png",
groups = {food_egg=1} groups = {food_egg=1}
}) })
minetest.register_craft({ food.craft({
output = "food:egg", output = "food:egg",
recipe = { recipe = {
{"", "default:sand", ""}, {"", "default:sand", ""},
@ -256,7 +282,7 @@ food.asupport("cocoa",function()
inventory_image = "food_cocoa.png", inventory_image = "food_cocoa.png",
groups = {food_cocoa=1} groups = {food_cocoa=1}
}) })
minetest.register_craft({ food.craft({
output = "food:cocoa", output = "food:cocoa",
recipe = { recipe = {
{"","default:apple",""}, {"","default:apple",""},
@ -273,7 +299,7 @@ food.asupport("meat_raw",function()
groups = { meat=1, eatable=1, food_meat_raw=1 }, groups = { meat=1, eatable=1, food_meat_raw=1 },
stack_max=25 stack_max=25
}) })
minetest.register_craft({ food.craft({
output = "food:meat_raw", output = "food:meat_raw",
recipe = { recipe = {
{"default:apple"}, {"default:apple"},
@ -288,7 +314,7 @@ food.asupport("meat",function()
groups = {food_meat=1,food_chicken=1} groups = {food_meat=1,food_chicken=1}
}) })
minetest.register_craft({ food.craft({
type = "cooking", type = "cooking",
output = "food:meat", output = "food:meat",
recipe = "group:food_meat_raw", recipe = "group:food_meat_raw",
@ -297,9 +323,9 @@ food.asupport("meat",function()
end) end)
if minetest.get_modpath("animalmaterials") then if minetest.get_modpath("animalmaterials") then
minetest.register_craft({ food.craft({
type = "cooking", type = "cooking",
output = "food:meat", output = "group:food_meat",
recipe = "group:food_meat_raw", recipe = "group:food_meat_raw",
cooktime = 30 cooktime = 30
}) })
@ -312,7 +338,7 @@ minetest.register_craftitem("food:sugar", {
inventory_image = "food_sugar.png", inventory_image = "food_sugar.png",
groups = {food_sugar=1} groups = {food_sugar=1}
}) })
minetest.register_craft({ food.craft({
output = "food:sugar 20", output = "food:sugar 20",
recipe = { recipe = {
{"default:papyrus"}, {"default:papyrus"},
@ -325,7 +351,7 @@ minetest.register_craftitem("food:chocolate_powder", {
inventory_image = "food_chocolate_powder.png", inventory_image = "food_chocolate_powder.png",
groups = {food_choco_powder = 1} groups = {food_choco_powder = 1}
}) })
minetest.register_craft({ food.craft({
output = "food:chocolate_powder 16", output = "food:chocolate_powder 16",
recipe = { recipe = {
{"group:food_cocoa","group:food_cocoa","group:food_cocoa"}, {"group:food_cocoa","group:food_cocoa","group:food_cocoa"},
@ -340,7 +366,7 @@ minetest.register_craftitem("food:dark_chocolate",{
inventory_image = "food_dark_chocolate.png", inventory_image = "food_dark_chocolate.png",
groups = {food_dark_chocolate=1} groups = {food_dark_chocolate=1}
}) })
minetest.register_craft({ food.craft({
output = "food:dark_chocolate", output = "food:dark_chocolate",
recipe = { recipe = {
{"group:food_cocoa","group:food_cocoa","group:food_cocoa"} {"group:food_cocoa","group:food_cocoa","group:food_cocoa"}
@ -353,7 +379,7 @@ minetest.register_craftitem("food:milk_chocolate",{
inventory_image = "food_milk_chocolate.png", inventory_image = "food_milk_chocolate.png",
groups = {food_milk_chocolate=1} groups = {food_milk_chocolate=1}
}) })
minetest.register_craft({ food.craft({
output = "food:milk_chocolate", output = "food:milk_chocolate",
recipe = { recipe = {
{"","group:food_milk",""}, {"","group:food_milk",""},
@ -367,7 +393,7 @@ minetest.register_craftitem("food:pasta",{
inventory_image = "food_pasta.png", inventory_image = "food_pasta.png",
groups = {food_pasta=1} groups = {food_pasta=1}
}) })
minetest.register_craft({ food.craft({
output = "food:pasta 4", output = "food:pasta 4",
type = "shapeless", type = "shapeless",
recipe = {"group:food_flour","group:food_egg","group:food_egg"} recipe = {"group:food_flour","group:food_egg","group:food_egg"}
@ -379,7 +405,7 @@ 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({ food.craft({
output = "food:bowl", output = "food:bowl",
recipe = { recipe = {
{"default:clay_lump","","default:clay_lump"}, {"default:clay_lump","","default:clay_lump"},
@ -392,7 +418,7 @@ minetest.register_craftitem("food:butter", {
inventory_image = "food_butter.png", inventory_image = "food_butter.png",
groups = {food_butter=1} groups = {food_butter=1}
}) })
minetest.register_craft({ food.craft({
output = "food:butter", output = "food:butter",
recipe = { recipe = {
{"group:food_milk","group:food_milk"}, {"group:food_milk","group:food_milk"},
@ -406,7 +432,7 @@ minetest.register_craftitem("food:cheese", {
on_use = food.item_eat(4), on_use = food.item_eat(4),
groups = {food_cheese=1} groups = {food_cheese=1}
}) })
minetest.register_craft({ food.craft({
output = "food:cheese", output = "food:cheese",
recipe = { recipe = {
{"group:food_butter","group:food_butter"}, {"group:food_butter","group:food_butter"},
@ -419,7 +445,7 @@ minetest.register_craftitem("food:baked_potato", {
inventory_image = "food_baked_potato.png", inventory_image = "food_baked_potato.png",
on_use = food.item_eat(6), on_use = food.item_eat(6),
}) })
minetest.register_craft({ food.craft({
type = "cooking", type = "cooking",
output = "food:baked_potato", output = "food:baked_potato",
recipe = "group:food_potato", recipe = "group:food_potato",
@ -436,12 +462,12 @@ minetest.register_craftitem("food:pasta_bake_raw",{
description = S("Raw Pasta Bake"), description = S("Raw Pasta Bake"),
inventory_image = "food_pasta_bake_raw.png", inventory_image = "food_pasta_bake_raw.png",
}) })
minetest.register_craft({ food.craft({
output = "food:pasta_bake", output = "food:pasta_bake",
type = "cooking", type = "cooking",
recipe = "food:pasta_bake_raw" recipe = "food:pasta_bake_raw"
}) })
minetest.register_craft({ food.craft({
output = "food:pasta_bake_raw", output = "food:pasta_bake_raw",
recipe = { recipe = {
{"group:food_cheese"}, {"group:food_cheese"},
@ -468,12 +494,12 @@ for i=1, #soups do
inventory_image = "food_soup_"..flav[1].."_raw.png", inventory_image = "food_soup_"..flav[1].."_raw.png",
}) })
minetest.register_craft({ food.craft({
type = "cooking", type = "cooking",
output = "food:soup_"..flav[1], output = "food:soup_"..flav[1],
recipe = "food:soup_"..flav[1].."_raw", recipe = "food:soup_"..flav[1].."_raw",
}) })
minetest.register_craft({ food.craft({
output = "food:soup_"..flav[1].."_raw", output = "food:soup_"..flav[1].."_raw",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
@ -494,7 +520,7 @@ for i=1, #juices do
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),
}) })
minetest.register_craft({ food.craft({
output = "food:"..flav.."_juice 4", output = "food:"..flav.."_juice 4",
recipe = { recipe = {
{"","",""}, {"","",""},
@ -510,7 +536,7 @@ minetest.register_craftitem("food:rainbow_juice", {
on_use = minetest.item_eat(20), on_use = minetest.item_eat(20),
}) })
minetest.register_craft({ food.craft({
output = "food:rainbow_juice 99", output = "food:rainbow_juice 99",
recipe = { recipe = {
{"","",""}, {"","",""},
@ -595,36 +621,24 @@ minetest.register_node("food:cake_carrot", {
} }
} }
}) })
minetest.register_craftitem("food:cake_cheese",{ food.craft({
description = S("Cheese cake"),
inventory_image = "food_cake_cheese.png",
on_use = food.item_eat(4),
groups={food=3,crumbly=3}
})
minetest.register_craft({
type = "cooking", type = "cooking",
output = "food:cake", output = "food:cake",
recipe = "food:cakemix_plain", recipe = "food:cakemix_plain",
cooktime = 10, cooktime = 10,
}) })
minetest.register_craft({ food.craft({
type = "cooking", type = "cooking",
output = "food:cake_choco", output = "food:cake_choco",
recipe = "food:cakemix_choco", recipe = "food:cakemix_choco",
cooktime = 10, cooktime = 10,
}) })
minetest.register_craft({ food.craft({
type = "cooking", type = "cooking",
output = "food:cake_carrot", output = "food:cake_carrot",
recipe = "food:cakemix_carrot", recipe = "food:cakemix_carrot",
cooktime = 10, cooktime = 10,
}) })
minetest.register_craft({
type = "cooking",
output = "food:cake_cheese",
recipe = "food:cakemix_cheese",
cooktime = 10,
})
-- Cake mix -- Cake mix
minetest.register_craftitem("food:cakemix_plain",{ minetest.register_craftitem("food:cakemix_plain",{
@ -641,35 +655,23 @@ minetest.register_craftitem("food:cakemix_carrot",{
description = S("Carrot Cake Mix"), description = S("Carrot Cake Mix"),
inventory_image = "food_cakemix_carrot.png", inventory_image = "food_cakemix_carrot.png",
}) })
minetest.register_craftitem("food:cakemix_cheese",{
description = S("Cheese Cake Mix"),
inventory_image = "food_cakemix_carrot.png",
})
minetest.register_craft({ minetest.register_craft({
output = "food:cakemix_plain", output = "food:cakemix_plain",
recipe = { recipe = {
{"group:food_flour","group:food_sugar","group:food_egg"}, {"group:food_flour","group:food_sugar","group:food_egg"},
} }
}) })
minetest.register_craft({ food.craft({
output = "food:cakemix_choco", output = "food:cakemix_choco",
recipe = { recipe = {
{"","group:food_choco_powder",""}, {"","group:food_choco_powder",""},
{"group:food_flour","group:food_sugar","group:food_egg"}, {"group:food_flour","group:food_sugar","group:food_egg"},
} }
}) })
minetest.register_craft({ food.craft({
output = "food:cakemix_carrot", output = "food:cakemix_carrot",
recipe = { recipe = {
{"","group:food_carrot",""}, {"","group:food_carrot",""},
{"group:food_flour","group:food_sugar","group:food_egg"}, {"group:food_flour","group:food_sugar","group:food_egg"},
} }
}) })
minetest.register_craft({
output = "food:cakemix_cheese",
recipe = {
{"group:food_cheese","group:food_strawberry",""},
{"group:food_flour","group:food_sugar","group:food_egg"},
}
})

View File

@ -4,7 +4,6 @@ Wheat = Weizen
Flour = Mehl Flour = Mehl
Potato = Kartoffel Potato = Kartoffel
Tomato = Tomate Tomato = Tomate
Strawberry = Erdbeere
Carrot = Karotte Carrot = Karotte
Milk = Milch Milk = Milch
Egg = Ei Egg = Ei
@ -32,8 +31,6 @@ Rainbow Juice = Regenbogensaft
Cake = Kuchen Cake = Kuchen
Chocolate Cake = Schokoladenkuchen Chocolate Cake = Schokoladenkuchen
Carrot Cake = Karottenkuchen Carrot Cake = Karottenkuchen
Cheese cake = Kaesekuchen
Cake Mix = Backmischung Cake Mix = Backmischung
Chocolate Cake Mix = Backmischung fuer Schokoladenkuchen Chocolate Cake Mix = Backmischung fuer Schokoladenkuchen
Carrot Cake Mix = Backmischung fuer Karottenkuchen Carrot Cake Mix = Backmischung fuer Karottenkuchen
Cheese Cake Mix = Backmischung fuer Kaesekuchen

View File

@ -4,7 +4,6 @@ Wheat =
Flour = Flour =
Potato = Potato =
Tomato = Tomato =
Strawberry =
Carrot = Carrot =
Milk = Milk =
Egg = Egg =

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B