first commit

master
xisd 2019-05-02 08:50:48 +02:00
commit afee91b82e
11 changed files with 167 additions and 0 deletions

4
depends.txt Normal file
View File

@ -0,0 +1,4 @@
default
vessels
playereffects
inttlib?

40
init.lua Normal file
View File

@ -0,0 +1,40 @@
-- This mod add cooking recipes as well as a cooking pot
--
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
-- Load support for intllib.
local S, NS = dofile(modpath.."/intllib.lua")
-- Set to true to never use eggs
local SAM_IS_VEGAN = false
cooking = {}
cooking.intllib = S
cooking.vegan = SAM_IS_VEGAN
--
-- Register Sugar
--
if not minetest.get_modpath("food") then
minetest.register_craftitem(modname..":sugar", {
description = S("Sugar"),
inventory_image = modname.."_sugar.png",
groups = {food_sugar=1}
})
minetest.register_craft({
type = "shapeless",
output = modname..":sugar",
recipe = {"default:papyrus"}
})
else
minetest.register_alias(modname..":sugar", "food:sugar")
end
--dofile(modpath.."/cooking_pot.lua")
dofile(modpath.."/recipe_cake.lua")
dofile(modpath.."/recipe_pie_apple.lua")

44
intllib.lua Normal file
View File

@ -0,0 +1,44 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

35
recipe_cake.lua Normal file
View File

@ -0,0 +1,35 @@
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
-- Intllib
local S = cooking.intllib
--
-- Cake
--
core.register_craftitem(modname..":cake", {
description = S("Cake"),
inventory_image = modname.."_cake.png",
on_use = core.item_eat(7),
})
-- Cake Recipe
local cake_recipe
if not cooking.vegan and minetest.get_modpath("creatures") and minetest.get_modpath("chicken") then
cake_recipe = { "group:food_sugar", "group:food_sugar","",
"farming:flour", "creatures:egg",""}
else
cake_recipe = {"group:food_sugar", "group:food_sugar","",
"farming:flour", "group:water_bucket",""}
end
core.register_craft({
type = "shapeless",
output = modname..":cake",
recipe = cake_recipe,
replacements = {
{"group:water_bucket", "bucket:bucket_empty"},
}
})

44
recipe_pie_apple.lua Normal file
View File

@ -0,0 +1,44 @@
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
-- Intllib
local S = cooking.intllib
--
-- Pie
--
core.register_craftitem(modname..":pie_apple_unbaked", {
description = S("Unbaked Apple Pie"),
inventory_image = modname.."_pie_apple.png^[brighten:100 ",
on_use = core.item_eat(2),
})
core.register_craftitem(modname..":pie_apple", {
description = S("Apple Pie"),
inventory_image = modname.."_pie_apple.png",
on_use = core.item_eat(8),
})
-- Pie Recipe
local pie_recipe
if not cooking.vegan and minetest.get_modpath("creatures") and minetest.get_modpath("chicken") then
pie_recipe = { "default:apple", "default:apple","default:apple",
"farming:flour", "creatures:egg","farming:flour"}
else
pie_recipe = { "default:apple", "default:apple","default:apple",
"farming:flour", "group:water_bucket","farming:flour"}
end
core.register_craft({
type = "shapeless",
output = modname..":pie_apple_unbaked",
recipe = pie_recipe,
replacements = {
{"group:water_bucket", "bucket:bucket_empty"},
}
})
core.register_craft({
type = "cooking",
output = modname..":pie_apple",
recipe = modname..":pie_apple_unbaked",
})

BIN
textures/cooking_cake.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

BIN
textures/cooking_sugar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB