From d0bfbfb823791ad649f901b9be3f012862c49147 Mon Sep 17 00:00:00 2001 From: NovaBot <154629622+NovaBot13@users.noreply.github.com> Date: Wed, 10 Apr 2024 20:52:19 -0400 Subject: [PATCH] [MIRROR] Coffee machines carry over reagents from the beans (#1916) * Coffee machines carry over reagents from the beans (#82519) ## About The Pull Request I can't believe that this wasn't included in the original PR #70991. From now on, if there might be any unusual substances inside coffee beans, their reagents will be carried over to the coffee made by the machine. This is one of those niche unused mechanics that no one knows about but the coders hope to see one day in a intricate plot situation. please please please I hope so much for someone to use this Obviously a indispensable gampleay feature. https://github.com/tgstation/tgstation/assets/57324037/e3c243d7-03fd-47bc-9bdb-fac50c5bba0b ## Why It's Good For The Game Provides the coffee machine with features that it should have had fromm the beginning. ## Changelog :cl: add: Coffee machines can now carry over reagents from the beans to the coffee (surely no one will inject poison into them) /:cl: --------- Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> * Coffee machines carry over reagents from the beans --------- Co-authored-by: disappointedButNotSuprised <57324037+disappointedButNotSuprised@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> --- .../food_and_drinks/machinery/coffeemaker.dm | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/code/modules/food_and_drinks/machinery/coffeemaker.dm b/code/modules/food_and_drinks/machinery/coffeemaker.dm index d79eebc993a..5fdd296d7fc 100644 --- a/code/modules/food_and_drinks/machinery/coffeemaker.dm +++ b/code/modules/food_and_drinks/machinery/coffeemaker.dm @@ -715,9 +715,32 @@ if(!try_brew()) return operate_for(brew_time) - coffeepot.reagents.add_reagent_list(list(/datum/reagent/consumable/coffee = 120)) - coffee.Cut(1,2) //remove the first item from the list + + // create a reference bean reagent list + var/list/reference_bean_reagents = list() + var/obj/item/food/grown/coffee/reference_bean = new /obj/item/food/grown/coffee(src) + for(var/datum/reagent/ref_bean_reagent as anything in reference_bean.reagents.reagent_list) + reference_bean_reagents += ref_bean_reagent.name + + // add all the reagents from the coffee beans to the coffeepot (ommit the ones from the reference bean) + var/list/reagent_delta = list() + var/obj/item/food/grown/coffee/bean = coffee[coffee_amount] + for(var/datum/reagent/substance as anything in bean.reagents.reagent_list) + if(!(reference_bean_reagents.Find(substance.name))) // we only add the reagent if it's a non-standard for coffee beans + reagent_delta += list(substance.type = substance.volume) + coffeepot.reagents.add_reagent_list(reagent_delta) + + qdel(reference_bean) + + // remove the coffee beans from the machine + coffee.Cut(1,2) coffee_amount-- + + // fill the rest of the pot with coffee + if(coffeepot.reagents.total_volume < 120) + var/extra_coffee_amount = 120 - coffeepot.reagents.total_volume + coffeepot.reagents.add_reagent(/datum/reagent/consumable/coffee, extra_coffee_amount) + update_appearance(UPDATE_OVERLAYS) #undef BEAN_CAPACITY