From 1b18ba29b70e869bf34da23ed74dcd3780a3ef5c Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 22 Apr 2023 16:36:59 +0200 Subject: [PATCH] [MIRROR] Fixes silliness involving soup pots clearing ingredients list [MDB IGNORE] (#20700) * Fixes silliness involving soup pots clearing ingredients list (#74882) ## About The Pull Request Fixes #74866 The issue is misleading, it never deleted the disk. The disk remained in the pot's contents but was no longer tracked as an ingredient, leaving it stuck Foolishly I had a case for indestructible things when soup reactions finished, where it wouldn't delete stuff like the disk. But I never removed it from the pot. I just nulled the ingredients list. Oops. So pots will drop ingredients that fail to cook into anything when the reaction finishes. --- Semi-unrelated but stuff like stoves, ovens, and chem heater should probably `allowdrop() return FALSE`. I cannot think of many (any) situations where you would want to use `drop_location` from something in an oven, stove, or heater and actually want those returned rather than their own loc. ## Why It's Good For The Game Whoops ## Changelog :cl: Melbert fix: Ingredients which fail to react in soup reactions drop when the reaction finishes as intended /:cl: * Fixes silliness involving soup pots clearing ingredients list --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> --- code/modules/food_and_drinks/machinery/stove.dm | 9 ++++++--- .../food_and_drinks/recipes/soup_mixtures.dm | 13 +++++++------ .../reagents/chemistry/machinery/chem_heater.dm | 1 - 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/code/modules/food_and_drinks/machinery/stove.dm b/code/modules/food_and_drinks/machinery/stove.dm index 8382e6ff98f..addc0175be2 100644 --- a/code/modules/food_and_drinks/machinery/stove.dm +++ b/code/modules/food_and_drinks/machinery/stove.dm @@ -132,11 +132,12 @@ balloon_alert(user, "can't add that!") return TRUE - var/atom/balloon_loc = ismachinery(loc) ? loc : src + // Ensures that faceatom works correctly, since we can can often be in another atom's loc (a stove) + var/atom/movable/balloon_loc = ismovable(loc) ? loc : src balloon_loc.balloon_alert(user, "ingredient added") user.face_atom(balloon_loc) - LAZYADD(added_ingredients, attacking_item) + LAZYADD(added_ingredients, attacking_item) update_appearance(UPDATE_OVERLAYS) return TRUE @@ -147,7 +148,9 @@ var/obj/item/removed = added_ingredients[1] removed.forceMove(get_turf(src)) user.put_in_hands(removed) - var/atom/balloon_loc = ismachinery(loc) ? loc : src + + // Ensures that faceatom works correctly, since we can can often be in another atom's loc (a stove) + var/atom/movable/balloon_loc = ismovable(loc) ? loc : src balloon_loc.balloon_alert(user, "ingredient removed") user.face_atom(balloon_loc) diff --git a/code/modules/food_and_drinks/recipes/soup_mixtures.dm b/code/modules/food_and_drinks/recipes/soup_mixtures.dm index 5005236ceb4..87eabd6a21c 100644 --- a/code/modules/food_and_drinks/recipes/soup_mixtures.dm +++ b/code/modules/food_and_drinks/recipes/soup_mixtures.dm @@ -162,14 +162,14 @@ testing("Soup reaction finished with a total react volume of [react_vol] and [length(pot.added_ingredients)] ingredients. Cleaning up.") for(var/obj/item/ingredient as anything in pot.added_ingredients) - // Let's not mess with fireproof / indestructible items. - // It's not likely that soups use fireproof items as ingredients, - // and chef doesn't need more ways to delete things with cooking. - if(ingredient.resistance_flags & (FIRE_PROOF|INDESTRUCTIBLE)) + // Let's not mess with indestructible items. + // Chef doesn't need more ways to delete things with cooking. + if(ingredient.resistance_flags & INDESTRUCTIBLE) continue // Things that had reagents or ingredients in the soup will get deleted - if(!isnull(ingredient.reagents) || is_type_in_list(ingredient, required_ingredients)) + else if(!isnull(ingredient.reagents) || is_type_in_list(ingredient, required_ingredients)) + LAZYREMOVE(pot.added_ingredients, ingredient) // Send everything left behind transfer_ingredient_reagents(ingredient, holder) // Delete, it's done @@ -179,7 +179,8 @@ else ingredient.AddElement(/datum/element/fried_item, 30) - LAZYNULL(pot.added_ingredients) + // Anything left in the ingredient list will get dumped out + pot.dump_ingredients(get_turf(pot)) // Blackbox log the chemical reaction used, to account for soup reaction that don't produce typical results BLACKBOX_LOG_FOOD_MADE(type) diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index 06386e0f50c..73a6d14e16a 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -49,7 +49,6 @@ QDEL_NULL(beaker) return ..() - /obj/machinery/chem_heater/handle_atom_del(atom/A) . = ..() if(A == beaker)