From 5a6217c81acb7ebcdd235b24864e600fb8bbbb4f Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 16 Apr 2022 17:19:11 +0200 Subject: [PATCH] [MIRROR] makes grilles grill food, not drinks/condiments [MDB IGNORE] (#12767) * makes grilles grill food, not drinks/condiments (#65833) When food was moved to newfood (and use an edible component), drinks and condiments were left both as subtypes of a no-longer-existant food. (Even worse, one isn't even a subtype of the other). Grilles were not updated to make the edible component's foodtypes fried, instead they kept making old food (which again, is just drinks and condiments) get the grilled foodtype instead, so it likely just runtimed and didn't work at all. This most probably wasn't caught because all the vars for the edible food component were all kept the same when they were created off of old food, even the procs. Edible component is a copy paste of drinks/condiments. Less runtime errors, more grilling! * makes grilles grill food, not drinks/condiments Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> --- code/__DEFINES/dcs/signals/signals_object.dm | 2 ++ code/datums/components/food/edible.dm | 24 +++++++++++++++++++ .../kitchen_machinery/grill.dm | 17 +------------ 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/code/__DEFINES/dcs/signals/signals_object.dm b/code/__DEFINES/dcs/signals/signals_object.dm index 6a1670569ef..8f626c1d544 100644 --- a/code/__DEFINES/dcs/signals/signals_object.dm +++ b/code/__DEFINES/dcs/signals/signals_object.dm @@ -141,6 +141,8 @@ #define COMPONENT_HANDLED_GRILLING (1<<0) ///Called when an object is turned into another item through grilling ontop of a griddle #define COMSIG_GRILL_COMPLETED "item_grill_completed" +///Called when an object is meant to be grilled through a grill: (atom/fry_object, grill_time) +#define COMSIG_GRILL_FOOD "item_grill_food" //Called when an object is in an oven #define COMSIG_ITEM_BAKED "item_baked" #define COMPONENT_HANDLED_BAKING (1<<0) diff --git a/code/datums/components/food/edible.dm b/code/datums/components/food/edible.dm index 32d33253d62..0617b53744c 100644 --- a/code/datums/components/food/edible.dm +++ b/code/datums/components/food/edible.dm @@ -83,6 +83,7 @@ Behavior that's still missing from this component that original food items had t if(isitem(parent)) RegisterSignal(parent, COMSIG_ITEM_ATTACK, .proc/UseFromHand) RegisterSignal(parent, COMSIG_ITEM_FRIED, .proc/OnFried) + RegisterSignal(parent, COMSIG_GRILL_FOOD, .proc/GrillFood) RegisterSignal(parent, COMSIG_ITEM_MICROWAVE_ACT, .proc/OnMicrowaved) RegisterSignal(parent, COMSIG_ITEM_USED_AS_INGREDIENT, .proc/used_to_customize) @@ -184,6 +185,29 @@ Behavior that's still missing from this component that original food items had t qdel(our_atom) return COMSIG_FRYING_HANDLED +/datum/component/edible/proc/GrillFood(datum/source, atom/fry_object, grill_time) + SIGNAL_HANDLER + + var/atom/this_food = parent + + switch(grill_time) //no 0-20 to prevent spam + if(20 to 30) + this_food.name = "lightly-grilled [this_food.name]" + this_food.desc = "[this_food.desc] It's been lightly grilled." + if(30 to 80) + this_food.name = "grilled [this_food.name]" + this_food.desc = "[this_food.desc] It's been grilled." + foodtypes |= FRIED + if(80 to 100) + this_food.name = "heavily grilled [this_food.name]" + this_food.desc = "[this_food.desc] It's been heavily grilled." + foodtypes |= FRIED + if(100 to INFINITY) //grill marks reach max alpha + this_food.name = "Powerfully Grilled [this_food.name]" + this_food.desc = "A [this_food.name]. Reminds you of your wife, wait, no, it's prettier!" + foodtypes |= FRIED + + ///Called when food is created through processing (Usually this means it was sliced). We use this to pass the OG items reagents. /datum/component/edible/proc/OnProcessed(datum/source, atom/original_atom, list/chosen_processing_option) SIGNAL_HANDLER diff --git a/code/modules/food_and_drinks/kitchen_machinery/grill.dm b/code/modules/food_and_drinks/kitchen_machinery/grill.dm index c6accc619ee..8d1aea33dde 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/grill.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/grill.dm @@ -134,22 +134,7 @@ return ..() /obj/machinery/grill/proc/finish_grill() - switch(grill_time) //no 0-20 to prevent spam - if(20 to 30) - grilled_item.name = "lightly-grilled [grilled_item.name]" - grilled_item.desc = "[grilled_item.desc] It's been lightly grilled." - if(30 to 80) - grilled_item.name = "grilled [grilled_item.name]" - grilled_item.desc = "[grilled_item.desc] It's been grilled." - grilled_item.foodtype |= FRIED - if(80 to 100) - grilled_item.name = "heavily grilled [grilled_item.name]" - grilled_item.desc = "[grilled_item.desc] It's been heavily grilled." - grilled_item.foodtype |= FRIED - if(100 to INFINITY) //grill marks reach max alpha - grilled_item.name = "Powerfully Grilled [grilled_item.name]" - grilled_item.desc = "A [grilled_item.name]. Reminds you of your wife, wait, no, it's prettier!" - grilled_item.foodtype |= FRIED + SEND_SIGNAL(grilled_item, COMSIG_GRILL_FOOD, grilled_item, grill_time) grill_time = 0 UnregisterSignal(grilled_item, COMSIG_GRILL_COMPLETED) grill_loop.stop()