Files
Bubberstation/code/game/objects/items/food/spaghetti.dm
Ghom 1f3894e793 Crafting refactor, implementing materials (#89465)
My original plan was to just implement materials into crafting so that
items would inherit the materials of their components, allowing for some
interesting stuff if the material flags of the item allow it. However to
my dismay crafting is a pile of old tech debt, starting from the old
`del_reqs` and `CheckParts` which still contain lines about old janky
bandaids that are no longer in use nor reachable, up to the
`customizable_reagent_holder` component which has some harddel issues
when your custom food is sliced, and items used in food recipes not
being deleted and instead stored inside the result with no purpose as
well as other inconsistencies like stack recipes that transfer materials
having counterparts in the UI that don't do that.

EDIT: Several things have come up while working on this, so I apologise
that it ended up changing over 100+ files. I managed to atomize some of
the changes, but it's a bit tedious.

EDIT: TLDR because I was told this section is too vague and there's too
much going on. This PR:
- Improves the dated crafting code (not the UI).
- replaced `atom/CheckParts` and `crafting_recipe/on_craft_completion`
with `atom/on_craft_completion`.
- Reqs used in food recipes are now deleted by default and not stored
inside the result (they did nothing).
- Renames the customizable_reagent_holder comp and improves it (No
harddels/ref issues).
- Adds a unit test that tries to craft all recipes to see what's wrong
(it skips some of the much more specific reqs for now).
- In the unit test is also the code to make sure materials of the
crafted item and a non-crafted item of the same type are roughly the
same, so far only applied to food.
- Some mild material/food refactoring around the fact that food item
code has been changed to support materials.

Improving the backbone of the crafting system. Also materials and food
code.

🆑
refactor: Refactored crafting backend. Report possible pesky bugs.
balance: the MEAT backpack (from the MEAT cargo pack) may be a smidge
different because of code standardization.
/🆑
2025-06-05 20:05:13 -04:00

278 lines
10 KiB
Plaintext

///spaghetti prototype used by all subtypes
/obj/item/food/spaghetti
icon = 'icons/obj/food/spaghetti.dmi'
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/nutriment/vitamin = 1,
)
foodtypes = GRAIN
venue_value = FOOD_PRICE_CHEAP
crafting_complexity = FOOD_COMPLEXITY_2
// Why are you putting cooked spaghetti in your pockets?
/obj/item/food/spaghetti/make_microwaveable()
var/list/display_message = list(
span_notice("Something wet falls out of their pocket and hits the ground. Is that... [name]?"),
span_warning("Oh shit! All your pocket [name] fell out!"))
AddComponent(/datum/component/spill, display_message, 'sound/effects/splat.ogg', /datum/memory/lost_spaghetti)
return ..()
/obj/item/food/spaghetti/raw
name = "spaghetti"
desc = "Now that's a nic'e pasta!"
icon_state = "spaghetti"
tastes = list("pasta" = 1)
crafting_complexity = FOOD_COMPLEXITY_1
/obj/item/food/spaghetti/make_bakeable()
AddComponent(/datum/component/bakeable, /obj/item/food/spaghetti/boiledspaghetti, rand(15 SECONDS, 20 SECONDS), TRUE, TRUE)
/obj/item/food/spaghetti/raw/make_microwaveable()
AddElement(/datum/element/microwavable, /obj/item/food/spaghetti/boiledspaghetti)
/obj/item/food/spaghetti/boiledspaghetti
name = "boiled spaghetti"
desc = "A plain dish of noodles, this needs more ingredients."
icon_state = "spaghettiboiled"
food_reagents = list(
/datum/reagent/consumable/nutriment = 2,
/datum/reagent/consumable/nutriment/vitamin = 1,
)
crafting_complexity = FOOD_COMPLEXITY_1
/obj/item/food/spaghetti/boiledspaghetti/Initialize(mapload)
. = ..()
AddComponent(/datum/component/ingredients_holder, null, CUSTOM_INGREDIENT_ICON_SCATTER, max_ingredients = 6)
/obj/item/food/spaghetti/pastatomato
name = "spaghetti"
desc = "Spaghetti and crushed tomatoes. Just like your abusive father used to make!"
icon_state = "pastatomato"
bite_consumption = 4
food_reagents = list(
/datum/reagent/consumable/nutriment = 6,
/datum/reagent/consumable/tomatojuice = 10,
/datum/reagent/consumable/nutriment/vitamin = 4,
)
tastes = list("pasta" = 1, "tomato" = 1)
foodtypes = GRAIN | VEGETABLES
crafting_complexity = FOOD_COMPLEXITY_2
/obj/item/food/spaghetti/pastatomato/soulful
name = "soul food"
desc = "Just how mom used to make it."
food_reagents = list(
// same as normal pasghetti
/datum/reagent/consumable/nutriment = 6,
/datum/reagent/consumable/tomatojuice = 10,
/datum/reagent/consumable/nutriment/vitamin = 4,
// where the soul comes from
/datum/reagent/pax = 5,
/datum/reagent/medicine/psicodine = 10,
/datum/reagent/medicine/morphine = 5,
)
tastes = list("nostalgia" = 1, "happiness" = 1)
/obj/item/food/spaghetti/copypasta
name = "copypasta"
desc = "You probably shouldn't try this, you always hear people talking about how bad it is..."
icon_state = "copypasta"
bite_consumption = 4
food_reagents = list(
/datum/reagent/consumable/nutriment = 12,
/datum/reagent/consumable/tomatojuice = 20,
/datum/reagent/consumable/nutriment/vitamin = 8,
)
tastes = list("pasta" = 1, "tomato" = 1)
foodtypes = GRAIN | VEGETABLES
crafting_complexity = FOOD_COMPLEXITY_2
/obj/item/food/spaghetti/meatballspaghetti
name = "spaghetti and meatballs"
desc = "Now that's a nic'e meatball!"
icon_state = "meatballspaghetti"
food_reagents = list(
/datum/reagent/consumable/nutriment = 4,
/datum/reagent/consumable/nutriment/protein = 10,
/datum/reagent/consumable/nutriment/vitamin = 2,
)
tastes = list("pasta" = 1, "meat" = 1)
foodtypes = GRAIN | MEAT
crafting_complexity = FOOD_COMPLEXITY_2
custom_materials = list(/datum/material/meat = MEATDISH_MATERIAL_AMOUNT * 2)
/obj/item/food/spaghetti/spesslaw
name = "spesslaw"
desc = "A lawyers favourite."
icon_state = "spesslaw"
food_reagents = list(
/datum/reagent/consumable/nutriment = 4,
/datum/reagent/consumable/nutriment/protein = 20,
/datum/reagent/consumable/nutriment/vitamin = 3,
)
tastes = list("pasta" = 1, "meat" = 1)
foodtypes = GRAIN | MEAT
crafting_complexity = FOOD_COMPLEXITY_2
custom_materials = list(/datum/material/meat = MEATDISH_MATERIAL_AMOUNT * 4)
/obj/item/food/spaghetti/chowmein
name = "chow mein"
desc = "A nice mix of noodles and fried vegetables."
icon_state = "chowmein"
food_reagents = list(
/datum/reagent/consumable/nutriment = 6,
/datum/reagent/consumable/nutriment/protein = 2,
/datum/reagent/consumable/nutriment/vitamin = 6,
)
tastes = list("noodle" = 1, "meat" = 1, "fried vegetables" = 1)
foodtypes = GRAIN | MEAT | VEGETABLES
crafting_complexity = FOOD_COMPLEXITY_3
custom_materials = list(/datum/material/meat = MEATDISH_MATERIAL_AMOUNT)
/obj/item/food/spaghetti/beefnoodle
name = "beef noodle"
desc = "Nutritious, beefy and noodly."
icon_state = "beefnoodle"
trash_type = /obj/item/reagent_containers/cup/bowl
food_reagents = list(
/datum/reagent/consumable/nutriment = 4,
/datum/reagent/consumable/nutriment/protein = 2,
/datum/reagent/consumable/nutriment/vitamin = 6,
/datum/reagent/consumable/liquidgibs = 3,
)
tastes = list("noodles" = 1, "meat" = 1)
foodtypes = GRAIN | MEAT | VEGETABLES
crafting_complexity = FOOD_COMPLEXITY_3
custom_materials = list(/datum/material/meat = MEATDISH_MATERIAL_AMOUNT * 2)
/obj/item/food/spaghetti/butternoodles
name = "butter noodles"
desc = "Noodles covered in savory butter. Simple and slippery, but delicious."
icon_state = "butternoodles"
food_reagents = list(
/datum/reagent/consumable/nutriment = 9,
/datum/reagent/consumable/nutriment/vitamin = 2,
)
tastes = list("noodles" = 1, "butter" = 1)
foodtypes = GRAIN | DAIRY
crafting_complexity = FOOD_COMPLEXITY_2
/obj/item/food/spaghetti/mac_n_cheese
name = "mac n' cheese"
desc = "Made the proper way with only the finest cheese and breadcrumbs. And yet, it can't scratch the same itch as Ready-Donk."
icon_state = "mac_n_cheese"
food_reagents = list(
/datum/reagent/consumable/nutriment = 9,
/datum/reagent/consumable/nutriment/vitamin = 2,
)
tastes = list("cheese" = 1, "breadcrumbs" = 1, "pasta" = 1)
foodtypes = GRAIN | DAIRY
crafting_complexity = FOOD_COMPLEXITY_4
/obj/item/food/spaghetti/shoyu_tonkotsu_ramen
name = "shoyu tonkotsu ramen"
desc = "A simple ramen made of meat, egg, onion, and a sheet of seaweed."
icon_state = "shoyu_tonkotsu_ramen"
trash_type = /obj/item/reagent_containers/cup/bowl
food_reagents = list(
/datum/reagent/consumable/nutriment = 12,
/datum/reagent/consumable/nutriment/vitamin = 6,
/datum/reagent/consumable/nutriment/protein = 6,
)
tastes = list("noodles" = 5, "meat" = 3, "egg" = 4, "dried seaweed" = 2)
foodtypes = GRAIN | MEAT | VEGETABLES
crafting_complexity = FOOD_COMPLEXITY_4
custom_materials = list(/datum/material/meat = MEATDISH_MATERIAL_AMOUNT)
/obj/item/food/spaghetti/kitakata_ramen
name = "kitakata ramen"
desc = "A hearty ramen composed of meat, mushrooms, onion, and garlic. Often given to the sick to comfort them"
icon_state = "kitakata_ramen"
trash_type = /obj/item/reagent_containers/cup/bowl
food_reagents = list(
/datum/reagent/consumable/nutriment = 15,
/datum/reagent/consumable/nutriment/vitamin = 6,
/datum/reagent/consumable/nutriment/protein = 8,
)
tastes = list("noodles" = 5, "meat" = 4, "mushrooms" = 3, "onion" = 2)
foodtypes = GRAIN | MEAT | VEGETABLES
crafting_complexity = FOOD_COMPLEXITY_4
custom_materials = list(/datum/material/meat = MEATDISH_MATERIAL_AMOUNT * 2)
/obj/item/food/spaghetti/kitsune_udon
name = "kitsune udon"
desc = "A vegetarian udon made of fried tofu and onions, made sweet and savory with sugar and soy sauce. The name comes from an old folktale about a fox enjoying fried tofu."
icon_state = "kitsune_udon"
trash_type = /obj/item/reagent_containers/cup/bowl
food_reagents = list(
/datum/reagent/consumable/nutriment = 12,
/datum/reagent/consumable/nutriment/vitamin = 10,
/datum/reagent/consumable/nutriment/protein = 4,
)
tastes = list("noodles" = 5, "tofu" = 4, "sugar" = 3, "soy sauce" = 2)
foodtypes = GRAIN | VEGETABLES
crafting_complexity = FOOD_COMPLEXITY_4
/obj/item/food/spaghetti/nikujaga
name = "nikujaga"
desc = "A delightful Japanese stew of noodles, onions, potatoes, and meat with mixed vegetables."
icon_state = "nikujaga"
trash_type = /obj/item/reagent_containers/cup/bowl
food_reagents = list(
/datum/reagent/consumable/nutriment = 16,
/datum/reagent/consumable/nutriment/vitamin = 12,
/datum/reagent/consumable/nutriment/protein = 8,
)
tastes = list("noodles" = 5, "meat" = 4, "potato" = 3, "onion" = 2, "mixed veggies" = 2)
foodtypes = GRAIN | VEGETABLES | MEAT
crafting_complexity = FOOD_COMPLEXITY_4
custom_materials = list(/datum/material/meat = MEATDISH_MATERIAL_AMOUNT * 2)
/obj/item/food/spaghetti/pho
name = "pho"
desc = "A Vietnamese dish made of noodles, vegetables, herbs, and meat. Makes for a very popular street food."
icon_state = "pho"
trash_type = /obj/item/reagent_containers/cup/bowl
food_reagents = list(
/datum/reagent/consumable/nutriment = 12,
/datum/reagent/consumable/nutriment/vitamin = 8,
/datum/reagent/consumable/nutriment/protein = 8,
)
tastes = list("noodles" = 5, "meat" = 4, "cabbage" = 3, "onion" = 2, "herbs" = 2)
foodtypes = GRAIN | VEGETABLES | MEAT
crafting_complexity = FOOD_COMPLEXITY_4
custom_materials = list(/datum/material/meat = MEATDISH_MATERIAL_AMOUNT)
/obj/item/food/spaghetti/pad_thai
name = "pad thai"
desc = "A stir-fried noodle dish popular in Thailand made of peanuts, tofu, lime, and onions."
icon_state = "pad_thai"
trash_type = /obj/item/reagent_containers/cup/bowl
food_reagents = list(
/datum/reagent/consumable/nutriment = 15,
/datum/reagent/consumable/nutriment/vitamin = 10,
/datum/reagent/consumable/nutriment/protein = 4,
)
tastes = list("noodles" = 5, "fried tofu" = 4, "lime" = 2, "peanut" = 3, "onion" = 2)
foodtypes = GRAIN | VEGETABLES | NUTS | FRUIT
crafting_complexity = FOOD_COMPLEXITY_4
/obj/item/food/spaghetti/carbonara
name = "spaghetti carbonara"
desc = "Silky eggs, crispy pork, cheesy bliss. Mamma mia!"
icon_state = "carbonara"
food_reagents = list(
/datum/reagent/consumable/nutriment = 10,
/datum/reagent/consumable/nutriment/protein = 6,
/datum/reagent/consumable/nutriment/vitamin = 4,
)
tastes = list("spaghetti" = 1, "parmigiano reggiano" = 1, "guanciale" = 1)
foodtypes = GRAIN | MEAT | DAIRY
crafting_complexity = FOOD_COMPLEXITY_4
custom_materials = list(/datum/material/meat = MEATDISH_MATERIAL_AMOUNT)
/obj/item/food/spaghetti/carbonara/Initialize(mapload)
. = ..()
AddElement(/datum/element/love_food_buff, /datum/status_effect/food/speech/italian)