From 52e7062fa778fd6db687c87a36c726572b093ca0 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Fri, 19 Jun 2026 20:15:00 +0200 Subject: [PATCH] You can now kiss that pizza toilet with the chef kiss skillchip to add "love" to its reagents. (#96547) ## About The Pull Request De-hardcodes food/crafting complexity (the stuff responsible for food buffs) from food items and gives the var to the edible component, so that objects crafted with pizza or meat sheets can have it as well. Renamed TRAIT_FOOD_CHEF_MADE to TRAIT_HANDMADE now that it's also given to the item when crafted through either the stack recipe UI or crafting UI. ## Why It's Good For The Game See title. In all seriousness though, it's more flexible code. ## Changelog :cl: refactor: Refactored a couple things around food/recipe complexity (what food buffs depend on). Technically, you can now kiss that pizza toilet, which you crafted (right?), with the chef kiss skillchip enabled to add "love" to its reagents. /:cl: --- code/__DEFINES/traits/declarations.dm | 4 ++-- code/_globalvars/traits/_traits.dm | 2 +- code/datums/components/bakeable.dm | 2 +- .../crafting/{crafting.dm => _crafting.dm} | 0 code/datums/components/food/edible.dm | 22 +++++++++++-------- code/datums/components/grillable.dm | 2 +- code/datums/elements/dryable.dm | 2 +- code/datums/elements/food/microwavable.dm | 2 +- .../elements/quality_food_ingredient.dm | 4 ++-- code/datums/materials/meat.dm | 3 ++- code/datums/materials/pizza.dm | 3 ++- code/game/atom/_atom.dm | 9 +++++++- code/game/objects/items/hand_items.dm | 2 +- code/modules/clothing/head/perceptomatrix.dm | 2 +- code/modules/food_and_drinks/food/_food.dm | 3 ++- code/modules/food_and_drinks/food/pizza.dm | 4 ++-- .../food_and_drinks/machinery/deep_fryer.dm | 2 +- .../food_and_drinks/machinery/icecream_vat.dm | 2 +- code/modules/vending/hotdog.dm | 2 +- tgstation.dme | 2 +- 20 files changed, 44 insertions(+), 30 deletions(-) rename code/datums/components/crafting/{crafting.dm => _crafting.dm} (100%) diff --git a/code/__DEFINES/traits/declarations.dm b/code/__DEFINES/traits/declarations.dm index ffd89e2cfdb..2177f016f90 100644 --- a/code/__DEFINES/traits/declarations.dm +++ b/code/__DEFINES/traits/declarations.dm @@ -902,8 +902,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_FOOD_BBQ_GRILLED "food_bbq_grilled" /// This is a silver slime created item #define TRAIT_FOOD_SILVER "food_silver" -/// If this item's been made by a chef instead of being map-spawned or admin-spawned or such -#define TRAIT_FOOD_CHEF_MADE "food_made_by_chef" +/// This object (mainly items) has been made by a player (cooked, crafted etc...) instead of being map-spawned or admin-spawned, printed with a lathe, ordered etc... +#define TRAIT_HANDMADE "food_made_by_chef" /// This atom has a quality_food_ingredient element attached #define TRAIT_QUALITY_FOOD_INGREDIENT "quality_food_ingredient" /// This (edible) atom won't inherit the item of the item it was processed from in the form "a slice of [name]" diff --git a/code/_globalvars/traits/_traits.dm b/code/_globalvars/traits/_traits.dm index 1ddfcd9dc14..8e5e17d2ee1 100644 --- a/code/_globalvars/traits/_traits.dm +++ b/code/_globalvars/traits/_traits.dm @@ -21,10 +21,10 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_DRYABLE" = TRAIT_DRYABLE, "TRAIT_ELEVATING_OBJECT" = TRAIT_ELEVATING_OBJECT, "TRAIT_FISHING_SPOT" = TRAIT_FISHING_SPOT, - "TRAIT_FOOD_CHEF_MADE" = TRAIT_FOOD_CHEF_MADE, "TRAIT_FOOD_FRIED" = TRAIT_FOOD_FRIED, "TRAIT_FOOD_SILVER" = TRAIT_FOOD_SILVER, "TRAIT_GOT_DAMPENED" = TRAIT_GOT_DAMPENED, + "TRAIT_HANDMADE" = TRAIT_HANDMADE, "TRAIT_INGREDIENTS_HOLDER" = TRAIT_INGREDIENTS_HOLDER, "TRAIT_KEEP_TOGETHER" = TRAIT_KEEP_TOGETHER, "TRAIT_LIGHTING_DEBUGGED" = TRAIT_LIGHTING_DEBUGGED, diff --git a/code/datums/components/bakeable.dm b/code/datums/components/bakeable.dm index f43b4fc162b..4508130c3a4 100644 --- a/code/datums/components/bakeable.dm +++ b/code/datums/components/bakeable.dm @@ -98,7 +98,7 @@ baked_result.reagents.add_reagent_list(added_reagents) if(who_baked_us) - ADD_TRAIT(baked_result, TRAIT_FOOD_CHEF_MADE, who_baked_us) + ADD_TRAIT(baked_result, TRAIT_HANDMADE, who_baked_us) if(original_object.custom_materials) baked_result.set_custom_materials(original_object.custom_materials, 1) diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/_crafting.dm similarity index 100% rename from code/datums/components/crafting/crafting.dm rename to code/datums/components/crafting/_crafting.dm diff --git a/code/datums/components/food/edible.dm b/code/datums/components/food/edible.dm index 465b6ae2066..c1aa1c3a6cb 100644 --- a/code/datums/components/food/edible.dm +++ b/code/datums/components/food/edible.dm @@ -24,6 +24,8 @@ Behavior that's still missing from this component that original food items had t var/food_flags = NONE ///Bitfield of the types of this food var/foodtypes = NONE + ///The main food complexity (read: quality) when handmade. It dictates the strength of the effect that this edible gives when eaten. + var/handmade_complexity = FOOD_COMPLEXITY_0 ///Amount of seconds it takes to eat this food var/eat_time = 3 SECONDS ///Defines how much it lowers someones satiety (Need to eat, essentialy) @@ -59,6 +61,7 @@ Behavior that's still missing from this component that original food items had t datum/callback/on_consume, datum/callback/check_liked, reagent_purity = 0.5, + handmade_complexity = FOOD_COMPLEXITY_0 ) if(!isatom(parent)) return COMPONENT_INCOMPATIBLE @@ -72,6 +75,7 @@ Behavior that's still missing from this component that original food items had t src.foodtypes = foodtypes src.eat_time = eat_time src.eatverbs = string_list(eatverbs) + src.handmade_complexity = handmade_complexity /datum/component/edible/RegisterWithParent() RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(examine)) @@ -136,6 +140,7 @@ Behavior that's still missing from this component that original food items had t datum/callback/on_consume, datum/callback/check_liked, reagent_purity = 0.5, + handmade_complexity, ) . = ..() @@ -269,7 +274,7 @@ Behavior that's still missing from this component that original food items had t examine_list += span_green("It is made of finest ingredients prolonging the effect!") var/datum/mind/mind = user.mind - if(mind && HAS_TRAIT_FROM(owner, TRAIT_FOOD_CHEF_MADE, REF(mind))) + if(mind && HAS_TRAIT_FROM(owner, TRAIT_HANDMADE, REF(mind))) examine_list += span_green("[owner] was made by you!") if(!(food_flags & FOOD_IN_CONTAINER)) @@ -638,15 +643,14 @@ Behavior that's still missing from this component that original food items had t var/quality_label = GLOB.food_quality_description[food_quality] to_chat(gourmand, span_notice("That's \an [quality_label] meal.")) -/// Get the complexity of the crafted food +/// Get the complexity of the crafted food. Some ingredients may influence this value. /datum/component/edible/proc/get_recipe_complexity() - var/list/extra_complexity = list(0) - SEND_SIGNAL(parent, COMSIG_FOOD_GET_EXTRA_COMPLEXITY, extra_complexity) - var/complexity_to_add = extra_complexity[1] - if(!HAS_TRAIT(parent, TRAIT_FOOD_CHEF_MADE) || !istype(parent, /obj/item/food)) - return complexity_to_add // It is factory made. Soulless. - var/obj/item/food/food = parent - return food.crafting_complexity + complexity_to_add + var/complexity = FOOD_COMPLEXITY_0 + if(HAS_TRAIT(parent, TRAIT_HANDMADE)) + complexity += handmade_complexity + var/list/complexity_holder = list(complexity) + SEND_SIGNAL(parent, COMSIG_FOOD_GET_EXTRA_COMPLEXITY, complexity_holder) + return complexity_holder[1] /// Get food quality adjusted according to eater's preferences /datum/component/edible/proc/get_perceived_food_quality(mob/living/eater) diff --git a/code/datums/components/grillable.dm b/code/datums/components/grillable.dm index 5b31a0fdec0..22c2f4950d0 100644 --- a/code/datums/components/grillable.dm +++ b/code/datums/components/grillable.dm @@ -167,7 +167,7 @@ SEND_SIGNAL(parent, COMSIG_ITEM_GRILLED, grilled_result) SEND_SIGNAL(grilled_result, COMSIG_ITEM_GRILLED_RESULT, parent) if(who_placed_us) - ADD_TRAIT(grilled_result, TRAIT_FOOD_CHEF_MADE, who_placed_us) + ADD_TRAIT(grilled_result, TRAIT_HANDMADE, who_placed_us) grill_source.visible_message("[parent] turns into \a [grilled_result]!") grilled_result.pixel_x = original_object.pixel_x diff --git a/code/datums/elements/dryable.dm b/code/datums/elements/dryable.dm index 8a0f9964a7d..d487da7f983 100644 --- a/code/datums/elements/dryable.dm +++ b/code/datums/elements/dryable.dm @@ -63,4 +63,4 @@ ADD_TRAIT(target, TRAIT_DRIED, ELEMENT_TRAIT(type)) var/datum/mind/user_mind = drying_user?.resolve() if(drying_user && istype(target, /obj/item/food)) - ADD_TRAIT(target, TRAIT_FOOD_CHEF_MADE, REF(user_mind)) + ADD_TRAIT(target, TRAIT_HANDMADE, REF(user_mind)) diff --git a/code/datums/elements/food/microwavable.dm b/code/datums/elements/food/microwavable.dm index a9f5388cba1..33823c11250 100644 --- a/code/datums/elements/food/microwavable.dm +++ b/code/datums/elements/food/microwavable.dm @@ -66,7 +66,7 @@ LAZYADD(microwaved_food.intrinsic_food_materials, original_food.intrinsic_food_materials) if(microwaver && microwaver.mind) - ADD_TRAIT(result, TRAIT_FOOD_CHEF_MADE, REF(microwaver.mind)) + ADD_TRAIT(result, TRAIT_HANDMADE, REF(microwaver.mind)) //make space and tranfer reagents if it has any, also let any bad result handle removing or converting the transferred reagents on its own terms if(result.reagents && source.reagents) diff --git a/code/datums/elements/quality_food_ingredient.dm b/code/datums/elements/quality_food_ingredient.dm index e9bfec246c5..d3a969356c0 100644 --- a/code/datums/elements/quality_food_ingredient.dm +++ b/code/datums/elements/quality_food_ingredient.dm @@ -66,6 +66,6 @@ RegisterSignal(target, COMSIG_FOOD_GET_EXTRA_COMPLEXITY, PROC_REF(add_complexity), TRUE) ADD_TRAIT(target, TRAIT_QUALITY_FOOD_INGREDIENT, REF(src)) -/datum/element/quality_food_ingredient/proc/add_complexity(datum/source, list/extra_complexity) +/datum/element/quality_food_ingredient/proc/add_complexity(datum/source, list/complexity) SIGNAL_HANDLER - extra_complexity[1] += complexity_increase + complexity[1] += complexity_increase diff --git a/code/datums/materials/meat.dm b/code/datums/materials/meat.dm index 00c26c98797..0e9d1e6d091 100644 --- a/code/datums/materials/meat.dm +++ b/code/datums/materials/meat.dm @@ -72,7 +72,8 @@ initial_reagents = list(/datum/reagent/consumable/nutriment/protein = protein_count, /datum/reagent/consumable/nutriment/fat = fat_count), \ foodtypes = RAW | MEAT, \ eat_time = 3 SECONDS, \ - tastes = list("meat" = 1)) + tastes = list("meat" = 1),\ + handmade_complexity = /obj/item/food/meat/steak::crafting_complexity) source.AddComponent( /datum/component/bloody_spreader,\ diff --git a/code/datums/materials/pizza.dm b/code/datums/materials/pizza.dm index df77ba1d1e4..50e821fe8bb 100644 --- a/code/datums/materials/pizza.dm +++ b/code/datums/materials/pizza.dm @@ -52,7 +52,8 @@ initial_reagents = list(/datum/reagent/consumable/nutriment = nutriment_count, /datum/reagent/consumable/nutriment/fat/oil = oil_count), \ foodtypes = GRAIN | DAIRY | VEGETABLES, \ eat_time = 3 SECONDS, \ - tastes = /obj/item/food/pizza/margherita::tastes) + tastes = /obj/item/food/pizza/margherita::tastes,\ + handmade_complexity = /obj/item/food/pizzaslice/margherita::crafting_complexity) /datum/material/pizza/on_removed(atom/source, mat_amount, multiplier, from_slot) . = ..() diff --git a/code/game/atom/_atom.dm b/code/game/atom/_atom.dm index d59f478a2db..e47b476942e 100644 --- a/code/game/atom/_atom.dm +++ b/code/game/atom/_atom.dm @@ -345,7 +345,14 @@ */ /atom/proc/on_craft_completion(list/components, datum/crafting_recipe/current_recipe, atom/crafter) SHOULD_CALL_PARENT(TRUE) + + if(isliving(crafter)) + var/mob/living/person = crafter + if(person.mind) + ADD_TRAIT(src, TRAIT_HANDMADE, REF(person.mind)) + SEND_SIGNAL(src, COMSIG_ATOM_ON_CRAFT, components, current_recipe) + var/list/remaining_parts = LAZYLISTDUPLICATE(current_recipe?.parts) var/list/parts_by_type = LAZYLISTDUPLICATE(remaining_parts) for(var/parttype in parts_by_type) //necessary for our is_type_in_list() call with the zebra arg set to true @@ -698,7 +705,7 @@ SEND_SIGNAL(src, COMSIG_ATOM_CREATEDBY_PROCESSING, original_atom, chosen_option) if(user.mind) - ADD_TRAIT(src, TRAIT_FOOD_CHEF_MADE, REF(user.mind)) + ADD_TRAIT(src, TRAIT_HANDMADE, REF(user.mind)) ///Connect this atom to a shuttle /atom/proc/connect_to_shuttle(mapload, obj/docking_port/mobile/port, obj/docking_port/stationary/dock) diff --git a/code/game/objects/items/hand_items.dm b/code/game/objects/items/hand_items.dm index 1e5ef4bd23e..27cf4205b25 100644 --- a/code/game/objects/items/hand_items.dm +++ b/code/game/objects/items/hand_items.dm @@ -724,7 +724,7 @@ // From here on, no message suppressed = SUPPRESSED_VERY - if(!(kisser.mind && HAS_TRAIT_FROM(target, TRAIT_FOOD_CHEF_MADE, REF(kisser.mind)))) + if(!(kisser.mind && HAS_TRAIT_FROM(target, TRAIT_HANDMADE, REF(kisser.mind)))) to_chat(firer, span_warning("Wait a second, you didn't make this [target.name]. How can you claim it as your own?")) return if(target.reagents.has_reagent(/datum/reagent/love)) diff --git a/code/modules/clothing/head/perceptomatrix.dm b/code/modules/clothing/head/perceptomatrix.dm index f3753224138..1bd39cba5bd 100644 --- a/code/modules/clothing/head/perceptomatrix.dm +++ b/code/modules/clothing/head/perceptomatrix.dm @@ -187,7 +187,7 @@ if(!chef.mind) continue // if cooked by chef, or if EITHER 5% chance OR its april fools. a || (b || c) - if(HAS_TRAIT_FROM(pancakes, TRAIT_FOOD_CHEF_MADE, REF(chef.mind)) || (prob(5) || check_holidays(APRIL_FOOLS))) + if(HAS_TRAIT_FROM(pancakes, TRAIT_HANDMADE, REF(chef.mind)) || (prob(5) || check_holidays(APRIL_FOOLS))) chef.say("Ma fuckin' pancakes!") playsound(pancakes, 'sound/effects/fuse.ogg', 80) diff --git a/code/modules/food_and_drinks/food/_food.dm b/code/modules/food_and_drinks/food/_food.dm index 7475a8c18ba..8da885e55a4 100644 --- a/code/modules/food_and_drinks/food/_food.dm +++ b/code/modules/food_and_drinks/food/_food.dm @@ -122,6 +122,7 @@ bite_consumption = bite_consumption,\ junkiness = junkiness,\ reagent_purity = starting_reagent_purity,\ + handmade_complexity = crafting_complexity,\ ) /obj/item/food/on_craft_completion(list/components, datum/crafting_recipe/current_recipe, atom/crafter) @@ -133,7 +134,7 @@ LAZYADD(intrinsic_food_materials, food_component.intrinsic_food_materials) var/mob/living/user = crafter if(istype(user) && !isnull(user.mind)) - ADD_TRAIT(src, TRAIT_FOOD_CHEF_MADE, REF(user.mind)) + ADD_TRAIT(src, TRAIT_HANDMADE, REF(user.mind)) ///This proc handles processable elements, overwrite this if you want to add behavior such as slicing, forking, spooning, whatever, to turn the item into something else /obj/item/food/proc/make_processable() diff --git a/code/modules/food_and_drinks/food/pizza.dm b/code/modules/food_and_drinks/food/pizza.dm index cc1c4b79ce8..fa58a3f465b 100644 --- a/code/modules/food_and_drinks/food/pizza.dm +++ b/code/modules/food_and_drinks/food/pizza.dm @@ -98,8 +98,8 @@ var/obj/item/food/pizzaslice/slice = new slice_type(our_turf) if(HAS_TRAIT(src, TRAIT_FOOD_SILVER)) ADD_TRAIT(slice, TRAIT_FOOD_SILVER, INNATE_TRAIT) - if(HAS_TRAIT(src, TRAIT_FOOD_CHEF_MADE)) - ADD_TRAIT(slice, TRAIT_FOOD_CHEF_MADE, GET_TRAIT_SOURCES(src, TRAIT_FOOD_CHEF_MADE)[1]) // wack thing to inherit first source + if(HAS_TRAIT(src, TRAIT_HANDMADE)) + ADD_TRAIT(slice, TRAIT_HANDMADE, GET_TRAIT_SOURCES(src, TRAIT_HANDMADE)[1]) // wack thing to inherit first source slice.pixel_x += rand(-6, 6) slice.pixel_y += rand(-6, 6) user?.put_in_active_hand(slice) diff --git a/code/modules/food_and_drinks/machinery/deep_fryer.dm b/code/modules/food_and_drinks/machinery/deep_fryer.dm index 0d0366674ba..3960f4ee7f8 100644 --- a/code/modules/food_and_drinks/machinery/deep_fryer.dm +++ b/code/modules/food_and_drinks/machinery/deep_fryer.dm @@ -199,7 +199,7 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list( if(isnull(frying.reagents)) frying.create_reagents(50, INJECTABLE) if(user.mind) - ADD_TRAIT(frying, TRAIT_FOOD_CHEF_MADE, REF(user.mind)) + ADD_TRAIT(frying, TRAIT_HANDMADE, REF(user.mind)) SEND_SIGNAL(frying, COMSIG_ITEM_ENTERED_FRYER) update_appearance() diff --git a/code/modules/food_and_drinks/machinery/icecream_vat.dm b/code/modules/food_and_drinks/machinery/icecream_vat.dm index 82b3e9a6224..2b47f7852e3 100644 --- a/code/modules/food_and_drinks/machinery/icecream_vat.dm +++ b/code/modules/food_and_drinks/machinery/icecream_vat.dm @@ -276,7 +276,7 @@ if(isnull(cone.crafted_food_buff)) cone.crafted_food_buff = /datum/status_effect/food/chilling if(user.mind) - ADD_TRAIT(cone, TRAIT_FOOD_CHEF_MADE, REF(user.mind)) + ADD_TRAIT(cone, TRAIT_HANDMADE, REF(user.mind)) ///Swaps the mode to the next one meant to be selected, then tells the user who changed it. /obj/machinery/icecream_vat/proc/swap_modes(mob/user) diff --git a/code/modules/vending/hotdog.dm b/code/modules/vending/hotdog.dm index 9d89702a923..f4d40ba4f26 100644 --- a/code/modules/vending/hotdog.dm +++ b/code/modules/vending/hotdog.dm @@ -56,4 +56,4 @@ if(dispense_returned) return if(istype(vended_item, /obj/item/food)) - ADD_TRAIT(vended_item, TRAIT_FOOD_CHEF_MADE, VENDING_MACHINE_TRAIT) + ADD_TRAIT(vended_item, TRAIT_HANDMADE, VENDING_MACHINE_TRAIT) diff --git a/tgstation.dme b/tgstation.dme index 2cfc9e080e7..eeb8daccf82 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1405,11 +1405,11 @@ #include "code\datums\components\wormborn.dm" #include "code\datums\components\container_item\container_item.dm" #include "code\datums\components\container_item\tank_holder.dm" +#include "code\datums\components\crafting\_crafting.dm" #include "code\datums\components\crafting\_recipes.dm" #include "code\datums\components\crafting\atmospheric.dm" #include "code\datums\components\crafting\chemistry.dm" #include "code\datums\components\crafting\containers.dm" -#include "code\datums\components\crafting\crafting.dm" #include "code\datums\components\crafting\doors.dm" #include "code\datums\components\crafting\entertainment.dm" #include "code\datums\components\crafting\equipment.dm"