dfcaverns/df_farming/cooking.lua
FaceDeer 0a0c97b74e
Mineclone compatibility (#36)
* latest versions of mapgen_helper and subterrane

* initial work

* call it "minetest_game" compatibility instead of "default" compatibility

* Getting started on moving all default dependencies to a single root mod

* distilling out more dependencies

* fix some typos

* more default dependencies

* beds

* start getting some MCL equivalents set up

* mine gas dependencies

* reorganize

* add some mapgen stuff

* getting close to actually being able to run mineclone with this

* it actually runs! Crashes with out-of-memory error when you try to go below -64, but it's a start.

* hide flowing pit plasma from creative inventory

* mineclone 5 settings

* Update subterrane

* get rid of meselamp dependency, bring in ancient lanterns from deep roads

* stair dependencies

* add mcl fences

* add mcl blast resistance and hardness to everything. Also an alternate name for Nethercap in MCL, since "nether" has another meaning there.

* buckets of oil and syrup should work in mineclone now

* 'splosions!

* make hunters avoid repaired ancient lanterns

* mapgen torchspine wasn't having its timer set

* split mapgen compatibility code into its own file

* bypass dependency indirection for df_farming.

* apply threshold alpha to food items, they look better that way

* bypass dependency indirection for df_mapitems

* bypass dependency indirection for df_primordial_items

* bypass dependency indirection for df_trees

* bypass dependency indirection for df_underworld_items

* bypass dependency indirection for df_caverns

* fixing up the puzzle seal to work in both

* fix puzzle seal formspec for mcl

* create built-in substitutes for fireflies and bones mods for when those aren't available

* set up mcl dungeon loot for underworld warriors, port over some translations from default

* overlooked a debug

* add itemslot backgrounds for mcl

* added mineclone groups to all registered nodes. TODO: craftitems.

This was extremely tedious. Completely untested, aside from simply running the game.

* minor fixes to the built-in bones node

* eatable group for edibles

* clean up some TODOs

* adjust pit plasma abm conditions

* add df_ambience

* fixing up explosions. Also make slade sand diggable in mcl, and fix a bug in web generators

* make tower cap caves less chirpy, fix bigger goblin hut schematic, allow glowing spindlestem extract bottles

* avoid an undeclared global check

* alas, cave pearls aren't set up right for attached_node_facedir.

* bunch of work on mineclone ores, moved main config into df_dependencies

* add a few more ores

* update depends in mod.conf

* add opaque group to light-sensitive dirt types

Mineclone adds the "opaque" group only to non-light nodes, and torches check for the opaque group to decide whether they can be placed there. light-sensitive nodes need the "light" paramtype to work, though. So adding the opaque group manually to these.

* add a touch of reverb to one of the whisper tracks, it didn't fit with the others without it

* bloodthorn also needs to be set opaque

* add sound to torchspines

* isolate Nethercap translation name to make it easier to swap out in Mineclone contexts

* ambience tweak

* fix dirt spreads

https://github.com/FaceDeer/dfcaverns/issues/35

* adding achievements! Almost all untested yet.

* fix a few achievements glitches

* tweak some more achievements, add delay when achievements unlock other achievements

* fix farming achievements, fix spindlestem callbacks on place

* icons for farming achievements

* more achievement icons, fix ancient lantern achievement

* two more icons, update text

* add icons for upper cavern layers

* all achievements have icons now. Also add another sound to the magma sea ambience

* hook into awards' trigger system to get "x/y" progress displayed for the multi-achievement achievements

* ironically, Mineclone has an old version of awards that is incompatible with my trigger work.

* every award should now have a description and a difficulty.

* removing leftovers

* missing callbacks for farmables

* put growth restrictions on farmables so the achievement doesn't trigger inappropriately.

* enable ores in MCL2, fix some undeclared globals, fix icecap growth in MCL (achievements are a good debugging tool)

* get *all* the copper and iron containing nodes

* fix old awards mod's handling of grouped dig items

* Add a little bonus for players who activate a slade breacher - a handheld 'splosion tool

* used the wrong drop method

* beef up explosions in MCL, make slade brick craftable from slade sand and lava

* better creative mode checks, fix crash when digging walls in MCL

* Update subterrane

* various bugfixes and tweaks

* whipping up a simple puzzle chest to give a clue about ancient numbering

The coding is done, but UI and a node mesh need to be done

* prepare for some art tomorrow

* chest node and sounds

* images for the combination dials

* add puzzle chests to the underworld buildings

* update translations

* oops, can't initialize the contents of puzzle chests every time or players get endless stuff

* add backgrounds to item slots in MCL

* wrap the existing function rather than copy and pasting it

* fix bucket dependency in cooking recipes

* add _mcl_saturation to edibles
2022-08-28 23:48:44 -06:00

124 lines
9.4 KiB
Lua

local S = minetest.get_translator(minetest.get_current_modname())
local bucket_empty = df_dependencies.node_name_bucket_empty
local chomp = {eat = {name = "df_farming_chomp_crunch", gain = 1.0}}
local crisp = {eat = {name = "df_farming_crisp_chew", gain = 1.0}}
local gummy = {eat = {name = "df_farming_gummy_chew", gain = 1.0}}
local mushy = {eat = {name = "df_farming_mushy_chew", gain = 1.0}}
local soft = {eat = {name = "df_farming_soft_chew", gain = 1.0}}
local recipes = {
{recipe = {"df_farming:cave_flour", "df_farming:cave_wheat_seed"}, name=S("Cave Wheat Flour Biscuit"), image="dfcaverns_prepared_food08x16.png", sound = crisp},
{recipe = {"df_farming:cave_flour", "df_farming:cave_wheat_seed", "group:sugar"}, name=S("Cave Wheat Flour Bun"), image="dfcaverns_prepared_food11x16.png", sound = mushy},
{recipe = {"df_farming:cave_flour", "group:food_flour", "df_farming:cave_wheat_seed", "df_farming:plump_helmet_spawn"}, name=S("Cave Wheat Flour Pancake"), image="dfcaverns_prepared_food07x16.png", sound = mushy},
{recipe = {"df_farming:cave_wheat_seed", "group:plump_helmet"}, name=S("Cave Wheat Seed Loaf"), image="dfcaverns_prepared_food17x16.png", sound = crisp},
{recipe = {"df_farming:cave_wheat_seed", "df_farming:cave_wheat_seed", "group:sugar"}, name=S("Cave Wheat Seed Puffs"), image="dfcaverns_prepared_food33x16.png", sound = soft},
{recipe = {"df_farming:cave_wheat_seed", "df_farming:cave_wheat_seed", "df_farming:pig_tail_seed", "df_farming:plump_helmet_spawn"}, name=S("Cave Wheat Seed Risotto"), image="dfcaverns_prepared_food14x16.png", sound = gummy},
{recipe = {"df_farming:sweet_pod_seed", "group:food_flour"}, name=S("Sweet Pod Spore Dumplings"), image="dfcaverns_prepared_food09x16.png", sound = mushy},
{recipe = {"df_farming:sweet_pod_seed", "group:food_flour", "group:sugar"}, name=S("Sweet Pod Spore Single Crust Pie"), image="dfcaverns_prepared_food05x16.png", sound = mushy},
{recipe = {"df_farming:sweet_pod_seed", "group:sugar", "group:food_flour", "df_farming:dwarven_syrup_bucket"}, replacements={{"df_farming:dwarven_syrup_bucket", bucket_empty}}, name=S("Sweet Pod Spore Brule"), image="dfcaverns_prepared_food22x16.png", sound = soft},
{recipe = {"df_farming:sugar", "group:food_flour"}, name=S("Sweet Pod Sugar Cookie"), image="dfcaverns_prepared_food02x16.png", sound = crisp},
{recipe = {"df_farming:sugar", "group:food_flour", "df_farming:quarry_bush_leaves"}, name=S("Sweet Pod Sugar Gingerbread"), image="dfcaverns_prepared_food21x16.png", sound = chomp},
{recipe = {"df_farming:sugar", "group:sugar", "group:food_flour", "group:food_flour"}, name=S("Sweet Pod Sugar Roll"), image="dfcaverns_prepared_food25x16.png", sound = crisp},
{recipe = {"group:plump_helmet", "group:plump_helmet"}, name=S("Plump Helmet Mince"), image="dfcaverns_prepared_food15x16.png", sound = mushy},
{recipe = {"group:plump_helmet", "group:plump_helmet", "df_farming:quarry_bush_leaves"}, name=S("Plump Helmet Stalk Sausage"), image="dfcaverns_prepared_food18x16.png", sound = gummy},
{recipe = {"group:plump_helmet", "group:food_flour", "df_farming:plump_helmet_spawn", "df_farming:quarry_bush_leaves"}, name=S("Plump Helmet Roast"), image="dfcaverns_prepared_food04x16.png", sound = mushy},
{recipe = {"df_farming:plump_helmet_spawn", "group:plump_helmet"}, name=S("Plump Helmet Spawn Soup"), image="dfcaverns_prepared_food10x16.png", sound = gummy},
{recipe = {"df_farming:plump_helmet_spawn", "df_farming:quarry_bush_seed", "group:plump_helmet"}, name=S("Plump Helmet Spawn Jambalaya"), image="dfcaverns_prepared_food01x16.png", sound = soft},
{recipe = {"df_farming:plump_helmet_spawn", "df_farming:plump_helmet_spawn", "group:plump_helmet", "group:plump_helmet"}, name=S("Plump Helmet Sprout Stew"), image="dfcaverns_prepared_food26x16.png", sound = gummy},
{recipe = {"df_farming:quarry_bush_leaves", "df_farming:cave_bread"}, name=S("Quarry Bush Leaf Spicy Bun"), image="dfcaverns_prepared_food23x16.png", sound = soft},
{recipe = {"df_farming:quarry_bush_leaves", "group:food_flour", "group:plump_helmet"}, name=S("Quarry Bush Leaf Croissant"), image="dfcaverns_prepared_food29x16.png", sound = soft},
{recipe = {"df_farming:quarry_bush_leaves", "group:plump_helmet", "group:plump_helmet", "group:plump_helmet"}, name=S("Stuffed Quarry Bush Leaf"), image="dfcaverns_prepared_food27x16.png", sound = chomp},
{recipe = {"df_farming:quarry_bush_seed", "df_farming:cave_bread"}, name=S("Rock Nut Bread"), image="dfcaverns_prepared_food16x16.png", sound = soft},
{recipe = {"df_farming:quarry_bush_seed", "group:food_flour", "group:sugar"}, name=S("Rock Nut Cookie"), image="dfcaverns_prepared_food07x16.png", sound = chomp},
{recipe = {"df_farming:quarry_bush_seed", "group:sugar", "df_farming:sweet_pod_seed", "group:food_flour"}, name=S("Rock Nut Cake"), image="dfcaverns_prepared_food03x16.png", sound = soft},
{recipe = {"df_farming:dimple_cup_seed", "group:food_flour"}, name=S("Dimple Cup Spore Flatbread"), image="dfcaverns_prepared_food12x16.png", sound = crisp},
{recipe = {"df_farming:dimple_cup_seed", "group:food_flour", "group:sugar"}, name=S("Dimple Cup Spore Scone"), image="dfcaverns_prepared_food32x16.png", sound = chomp},
{recipe = {"df_farming:dimple_cup_seed", "df_farming:sweet_pod_seed", "df_farming:quarry_bush_seed", "group:food_flour"}, name=S("Dimple Cup Spore Roll"), image="dfcaverns_prepared_food31x16.png", sound = soft},
{recipe = {"df_farming:pig_tail_seed", "df_farming:cave_bread"}, name=S("Pig Tail Spore Sandwich"), image="dfcaverns_prepared_food20x16.png", sound = soft},
{recipe = {"df_farming:pig_tail_seed", "df_farming:pig_tail_seed", "df_farming:dwarven_syrup_bucket"}, name=S("Pig Tail Spore Tofu"), replacements={{"df_farming:dwarven_syrup_bucket", bucket_empty}}, image="dfcaverns_prepared_food30x16.png", sound = gummy},
{recipe = {"df_farming:pig_tail_seed", "df_farming:sweet_pod_seed", "group:food_flour", "group:food_flour"}, name=S("Pig Tail Spore Casserole"), image="dfcaverns_prepared_food34x16.png", sound = mushy},
{recipe = {"df_farming:dwarven_syrup_bucket", "df_farming:dwarven_syrup_bucket"}, replacements={{"df_farming:dwarven_syrup_bucket", bucket_empty}, {"df_farming:dwarven_syrup_bucket", bucket_empty}}, name=S("Dwarven Syrup Taffy"), image="dfcaverns_prepared_food19x16.png", sound = gummy},
{recipe = {"df_farming:dwarven_syrup_bucket", "group:sugar", "group:plump_helmet"}, replacements={{"df_farming:dwarven_syrup_bucket", bucket_empty}}, name=S("Dwarven Syrup Jellies"), image="dfcaverns_prepared_food06x16.png", sound = gummy},
{recipe = {"df_farming:dwarven_syrup_bucket", "group:food_flour", "group:sugar", "df_farming:quarry_bush_seed"}, replacements={{"df_farming:dwarven_syrup_bucket", bucket_empty}}, name=S("Dwarven Syrup Delight"), image="dfcaverns_prepared_food24x16.png", sound = mushy},
}
local complexity = {[2]={name="simple", value=4}, [3]={name="medium", value=6}, [4]={name="complex", value=8}}
local alias_items = {}
-- validate the recipes.
for index1 = 1, table.getn(recipes)-1 do
for index2 = index1+1, table.getn(recipes) do
local recipe1 = recipes[index1].recipe
local recipe2 = recipes[index2].recipe
local recipe1count = {}
local recipe2count = {}
for _, item in pairs(recipe1) do
recipe1count[item] = (recipe1count[item] or 0) + 1
end
for _, item in pairs(recipe2) do
recipe2count[item] = (recipe2count[item] or 0) + 1
end
local identical = true
for key, val in pairs(recipe1count) do
if recipe2count[key] ~= val then
identical = false
break
end
end
for key, val in pairs(recipe2count) do
if recipe1count[key] ~= val then
identical = false
break
end
end
assert(not identical, "recipes " .. recipes[index1].name .. " and " .. recipes[index2].name .. " have identical ingredients!")
end
end
local ingredient_count = {}
--for _, recipe_entry in pairs(recipes) do
-- for _, item in pairs(recipe_entry.recipe) do
-- ingredient_count[item] = (ingredient_count[item] or 0) + 1
-- end
--end
--minetest.debug(dump(ingredient_count))
for _, def in pairs(recipes) do
local recipe_type = complexity[table.getn(def.recipe)]
local _, item_name = string.match(def.recipe[1], "(.*):(.*)")
local output = "df_farming:"..item_name.."_"..recipe_type.name.."_meal"
alias_items[item_name] = true
minetest.register_craftitem(output, {
description = def.name,
_doc_items_longdesc = df_farming.doc[recipe_type.name.."_meal_desc"],
_doc_items_usagehelp = df_farming.doc[recipe_type.name.."_meal_usage"],
inventory_image = def.image,
sound = def.sound,
on_use = minetest.item_eat(recipe_type.value),
groups = {food = recipe_type.value, eatable=recipe_type.value},
_hunger_ng = {satiates = recipe_type.value},
_mcl_saturation = recipe_type.value, -- TODO: make this more interesting
})
minetest.register_craft({
type = "shapeless",
output = output,
recipe = def.recipe,
replacements = def.replacements
})
end
for item, _ in pairs(alias_items) do
minetest.register_alias("dfcaverns:"..item.."_biscuit", "df_farming:"..item.."_simple_meal")
minetest.register_alias("dfcaverns:"..item.."_stew", "df_farming:"..item.."_medium_meal")
minetest.register_alias("dfcaverns:"..item.."_roast", "df_farming:"..item.."_complex_meal")
minetest.register_alias("df_farming:"..item.."_biscuit", "df_farming:"..item.."_simple_meal")
minetest.register_alias("df_farming:"..item.."_stew", "df_farming:"..item.."_medium_meal")
minetest.register_alias("df_farming:"..item.."_roast", "df_farming:"..item.."_complex_meal")
end
-- dfcaverns_prepared_food28 is currently unused
-- dfcaverns_prepared_food13 is used for dwarven bread