Files
Bubberstation/code/game/objects/items/food/frozen.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

458 lines
15 KiB
Plaintext

/obj/item/food/icecreamsandwich
name = "ice cream sandwich"
desc = "Portable ice cream in its own packaging."
icon = 'icons/obj/food/frozen_treats.dmi'
icon_state = "icecreamsandwich"
w_class = WEIGHT_CLASS_TINY
food_reagents = list(
/datum/reagent/consumable/nutriment = 3,
/datum/reagent/consumable/ice = 4,
)
tastes = list("ice cream" = 1)
foodtypes = GRAIN | DAIRY | SUGAR
food_flags = FOOD_FINGER_FOOD
crafting_complexity = FOOD_COMPLEXITY_2
crafted_food_buff = /datum/status_effect/food/chilling
/obj/item/food/strawberryicecreamsandwich
name = "strawberry ice cream sandwich"
desc = "Portable ice cream in its own packaging of the strawberry variety."
icon = 'icons/obj/food/frozen_treats.dmi'
icon_state = "strawberryicecreamsandwich"
w_class = WEIGHT_CLASS_TINY
food_reagents = list(
/datum/reagent/consumable/nutriment = 4,
/datum/reagent/consumable/ice = 4,
)
tastes = list("ice cream" = 2, "berry" = 2)
foodtypes = GRAIN|FRUIT|DAIRY|SUGAR
food_flags = FOOD_FINGER_FOOD
crafting_complexity = FOOD_COMPLEXITY_3
crafted_food_buff = /datum/status_effect/food/chilling
/obj/item/food/spacefreezy
name = "space freezy"
desc = "The best ice cream in space."
icon = 'icons/obj/food/frozen_treats.dmi'
icon_state = "spacefreezy"
w_class = WEIGHT_CLASS_TINY
food_reagents = list(
/datum/reagent/consumable/nutriment = 8,
/datum/reagent/consumable/bluecherryjelly = 5,
/datum/reagent/consumable/nutriment/vitamin = 5,
)
tastes = list("blue cherries" = 2, "ice cream" = 2)
foodtypes = GRAIN|FRUIT|DAIRY|SUGAR
crafting_complexity = FOOD_COMPLEXITY_3
crafted_food_buff = /datum/status_effect/food/chilling
/obj/item/food/spacefreezy/make_edible()
. = ..()
AddComponent(/datum/component/ice_cream_holder)
/obj/item/food/sundae
name = "sundae"
desc = "A classic dessert."
icon = 'icons/obj/food/frozen_treats.dmi'
icon_state = "sundae"
w_class = WEIGHT_CLASS_SMALL
food_reagents = list(
/datum/reagent/consumable/nutriment = 6,
/datum/reagent/consumable/banana = 5,
/datum/reagent/consumable/nutriment/vitamin = 2,
)
tastes = list("ice cream" = 1, "banana" = 1)
foodtypes = GRAIN|FRUIT|DAIRY|SUGAR
crafting_complexity = FOOD_COMPLEXITY_3
crafted_food_buff = /datum/status_effect/food/chilling
/obj/item/food/sundae/make_edible()
. = ..()
AddComponent(/datum/component/ice_cream_holder, y_offset = -2, sweetener = /datum/reagent/consumable/caramel)
/obj/item/food/honkdae
name = "honkdae"
desc = "The clown's favorite dessert."
icon = 'icons/obj/food/frozen_treats.dmi'
icon_state = "honkdae"
w_class = WEIGHT_CLASS_SMALL
food_reagents = list(
/datum/reagent/consumable/nutriment = 6,
/datum/reagent/consumable/banana = 10,
/datum/reagent/consumable/nutriment/vitamin = 4,
)
tastes = list("ice cream" = 1, "banana" = 1, "a bad joke" = 1)
foodtypes = GRAIN|FRUIT|DAIRY|SUGAR
crafting_complexity = FOOD_COMPLEXITY_4
crafted_food_buff = /datum/status_effect/food/chilling
/obj/item/food/honkdae/make_edible()
. = ..()
AddComponent(/datum/component/ice_cream_holder, y_offset = -2) //The sugar will react with the banana forming laughter. Honk!
/////////////
//SNOWCONES//
/////////////
/obj/item/food/snowcones //We use this as a base for all other snowcones
name = "flavorless snowcone"
desc = "It's just shaved ice. Still fun to chew on."
icon = 'icons/obj/food/frozen_treats.dmi'
icon_state = "flavorless_sc"
w_class = WEIGHT_CLASS_SMALL
trash_type = /obj/item/reagent_containers/cup/glass/sillycup //We dont eat paper cups
food_reagents = list(
/datum/reagent/water = 11,
) // We dont get food for water/juices
tastes = list("ice" = 1, "water" = 1)
foodtypes = SUGAR //We use SUGAR as a base line to act in as junkfood, other wise we use fruit
food_flags = FOOD_FINGER_FOOD
crafting_complexity = FOOD_COMPLEXITY_2
crafted_food_buff = /datum/status_effect/food/chilling
/obj/item/food/snowcones/lime
name = "lime snowcone"
desc = "Lime syrup drizzled over a snowball in a paper cup."
icon_state = "lime_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/limejuice = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "limes" = 5)
foodtypes = FRUIT
/obj/item/food/snowcones/lemon
name = "lemon snowcone"
desc = "Lemon syrup drizzled over a snowball in a paper cup."
icon_state = "lemon_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/lemonjuice = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "lemons" = 5)
foodtypes = FRUIT
/obj/item/food/snowcones/apple
name = "apple snowcone"
desc = "Apple syrup drizzled over a snowball in a paper cup."
icon_state = "amber_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/applejuice = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "apples" = 5)
foodtypes = FRUIT
/obj/item/food/snowcones/grape
name = "grape snowcone"
desc = "Grape syrup drizzled over a snowball in a paper cup."
icon_state = "grape_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/grapejuice = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "grape" = 5)
foodtypes = FRUIT
/obj/item/food/snowcones/orange
name = "orange snowcone"
desc = "Orange syrup drizzled over a snowball in a paper cup."
icon_state = "orange_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/orangejuice = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "orange" = 5)
foodtypes = FRUIT | ORANGES
/obj/item/food/snowcones/blue
name = "bluecherry snowcone"
desc = "Bluecherry syrup drizzled over a snowball in a paper cup, how rare!"
icon_state = "blue_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/bluecherryjelly = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "blue" = 5, "cherries" = 5)
foodtypes = FRUIT
/obj/item/food/snowcones/red
name = "cherry snowcone"
desc = "Cherry syrup drizzled over a snowball in a paper cup."
icon_state = "red_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/cherryjelly = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "red" = 5, "cherries" = 5)
foodtypes = FRUIT
/obj/item/food/snowcones/berry
name = "berry snowcone"
desc = "Berry syrup drizzled over a snowball in a paper cup."
icon_state = "berry_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/berryjuice = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "berries" = 5)
foodtypes = FRUIT
/obj/item/food/snowcones/fruitsalad
name = "fruit salad snowcone"
desc = "A delightful mix of citrus syrups drizzled over a snowball in a paper cup."
icon_state = "fruitsalad_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/lemonjuice = 5,
/datum/reagent/consumable/limejuice = 5,
/datum/reagent/consumable/orangejuice = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "oranges" = 5, "limes" = 5, "lemons" = 5, "citrus" = 5, "salad" = 5)
foodtypes = FRUIT | ORANGES
/obj/item/food/snowcones/pineapple
name = "pineapple snowcone"
desc = "Pineapple syrup drizzled over a snowball in a paper cup."
icon_state = "pineapple_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/pineapplejuice = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "pineapples" = 5)
foodtypes = PINEAPPLE //Pineapple to allow all that like pineapple to enjoy
/obj/item/food/snowcones/mime
name = "mime snowcone"
desc = "..."
icon_state = "mime_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/nothing = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "nothing" = 5)
foodtypes = SUGAR
/obj/item/food/snowcones/clown
name = "clown snowcone"
desc = "Laughter drizzled over a snowball in a paper cup."
icon_state = "clown_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/laughter = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "jokes" = 5, "brainfreeze" = 5, "joy" = 5)
foodtypes = SUGAR | FRUIT
/obj/item/food/snowcones/soda
name = "space cola snowcone"
desc = "Space Cola drizzled over a snowball in a paper cup."
icon_state = "soda_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/space_cola = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "cola" = 5)
foodtypes = SUGAR
/obj/item/food/snowcones/spacemountainwind
name = "Space Mountain Wind snowcone"
desc = "Space Mountain Wind drizzled over a snowball in a paper cup."
icon_state = "mountainwind_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/spacemountainwind = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "mountain wind" = 5)
foodtypes = SUGAR
/obj/item/food/snowcones/pwrgame
name = "pwrgame snowcone"
desc = "Pwrgame soda drizzled over a snowball in a paper cup."
icon_state = "pwrgame_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/pwr_game = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "valid" = 5, "salt" = 5, "wats" = 5)
foodtypes = SUGAR
/obj/item/food/snowcones/honey
name = "honey snowcone"
desc = "Honey drizzled over a snowball in a paper cup."
icon_state = "amber_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 1,
/datum/reagent/consumable/honey = 5,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "flowers" = 5, "sweetness" = 5, "wax" = 1)
foodtypes = SUGAR
crafting_complexity = FOOD_COMPLEXITY_3
/obj/item/food/snowcones/rainbow
name = "rainbow snowcone"
desc = "A very colorful snowball in a paper cup."
icon_state = "rainbow_sc"
food_reagents = list(
/datum/reagent/consumable/nutriment = 5,
/datum/reagent/consumable/laughter = 25,
/datum/reagent/water = 11,
)
tastes = list("ice" = 1, "water" = 1, "sunlight" = 5, "light" = 5, "slime" = 5, "paint" = 3, "clouds" = 3)
foodtypes = SUGAR
/obj/item/food/popsicle
name = "bug popsicle"
desc = "Mmmm, this should not exist."
icon = 'icons/obj/food/frozen_treats.dmi'
icon_state = "popsicle_stick_s"
food_reagents = list(
/datum/reagent/consumable/nutriment = 4,
/datum/reagent/consumable/cream = 2,
/datum/reagent/consumable/vanilla = 2,
/datum/reagent/consumable/sugar = 4,
)
tastes = list("beetle juice")
trash_type = /obj/item/popsicle_stick
w_class = WEIGHT_CLASS_SMALL
foodtypes = DAIRY | SUGAR
food_flags = FOOD_FINGER_FOOD
crafting_complexity = FOOD_COMPLEXITY_3
crafted_food_buff = /datum/status_effect/food/chilling
var/overlay_state = "creamsicle_o" //This is the edible part of the popsicle.
var/bite_states = 4 //This value value is used for correctly setting the bite_consumption to ensure every bite changes the sprite. Do not set to zero.
var/bitecount = 0
/obj/item/food/popsicle/Initialize(mapload)
. = ..()
bite_consumption = reagents.total_volume / bite_states
update_icon() // make sure the popsicle overlay is primed so it's not just a stick until you start eating it
/obj/item/food/popsicle/make_edible()
. = ..()
AddComponentFrom(SOURCE_EDIBLE_INNATE, /datum/component/edible, after_eat = CALLBACK(src, PROC_REF(after_bite)))
/obj/item/food/popsicle/update_overlays()
. = ..()
if(!bitecount)
. += initial(overlay_state)
return
. += "[initial(overlay_state)]_[min(bitecount, 3)]"
/obj/item/food/popsicle/proc/after_bite(mob/living/eater, mob/living/feeder, bitecount)
src.bitecount = bitecount
update_appearance()
/obj/item/popsicle_stick
name = "popsicle stick"
icon = 'icons/obj/food/frozen_treats.dmi'
icon_state = "popsicle_stick"
desc = "This humble little stick usually carries a frozen treat, at the moment it seems freed from this Atlassian burden."
custom_materials = list(/datum/material/wood = SMALL_MATERIAL_AMOUNT * 0.20)
resistance_flags = FLAMMABLE
w_class = WEIGHT_CLASS_TINY
force = 0
/obj/item/food/popsicle/creamsicle_orange
name = "orange creamsicle"
desc = "A classic orange creamsicle. A sunny frozen treat."
food_reagents = list(
/datum/reagent/consumable/orangejuice = 4,
/datum/reagent/consumable/cream = 2,
/datum/reagent/consumable/vanilla = 2,
/datum/reagent/consumable/sugar = 4,
)
foodtypes = FRUIT | DAIRY | SUGAR | ORANGES
crafting_complexity = FOOD_COMPLEXITY_4
/obj/item/food/popsicle/creamsicle_berry
name = "berry creamsicle"
desc = "A vibrant berry creamsicle. A berry good frozen treat."
food_reagents = list(
/datum/reagent/consumable/berryjuice = 4,
/datum/reagent/consumable/cream = 2,
/datum/reagent/consumable/vanilla = 2,
/datum/reagent/consumable/sugar = 4,
)
overlay_state = "creamsicle_m"
foodtypes = FRUIT | DAIRY | SUGAR
crafting_complexity = FOOD_COMPLEXITY_4
/obj/item/food/popsicle/jumbo
name = "jumbo ice cream"
desc = "A luxurious ice cream covered in rich chocolate. It seems smaller than you remember it being."
food_reagents = list(
/datum/reagent/consumable/hot_coco = 4,
/datum/reagent/consumable/cream = 2,
/datum/reagent/consumable/vanilla = 3,
/datum/reagent/consumable/sugar = 2,
)
overlay_state = "jumbo"
crafting_complexity = FOOD_COMPLEXITY_4
/obj/item/food/popsicle/licorice_creamsicle
name = "Void Bar™"
desc = "A salty licorice ice cream. A salty frozen treat."
food_reagents = list(
/datum/reagent/consumable/nutriment = 4,
/datum/reagent/consumable/salt = 1,
/datum/reagent/consumable/cream = 2,
/datum/reagent/consumable/vanilla = 1,
/datum/reagent/consumable/sugar = 4,
)
tastes = list("salty liquorice")
overlay_state = "licorice_creamsicle"
crafting_complexity = FOOD_COMPLEXITY_4
/obj/item/food/cornuto
name = "cornuto"
w_class = WEIGHT_CLASS_SMALL
icon = 'icons/obj/food/frozen_treats.dmi'
icon_state = "cornuto"
desc = "A neapolitan vanilla and chocolate ice cream cone. It menaces with a sprinkling of caramelized nuts."
food_reagents = list(
/datum/reagent/consumable/nutriment = 6,
/datum/reagent/consumable/hot_coco = 4,
/datum/reagent/consumable/cream = 2,
/datum/reagent/consumable/vanilla = 4,
/datum/reagent/consumable/sugar = 2,
)
tastes = list("chopped hazelnuts", "waffle")
foodtypes = GRAIN|DAIRY|SUGAR
venue_value = FOOD_PRICE_NORMAL
crafting_complexity = FOOD_COMPLEXITY_3
crafted_food_buff = /datum/status_effect/food/chilling
/obj/item/food/popsicle/meatsicle
name = "Meatsicle"
desc = "A horrific abomination of raw meat, glazed with sugar on a stick, then frozen."
food_reagents = list(
/datum/reagent/consumable/nutriment = 4,
/datum/reagent/consumable/nutriment/fat = 2,
/datum/reagent/consumable/nutriment/protein = 2,
/datum/reagent/consumable/sugar = 4,
)
overlay_state = "meatsicle"
foodtypes = RAW | MEAT | SUGAR
crafting_complexity = FOOD_COMPLEXITY_4
custom_materials = list(/datum/material/meat = MEATSLAB_MATERIAL_AMOUNT)