[MIRROR] Coffee machines carry over reagents from the beans (#27267)

* 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.
<sub><sup>please please please I hope so much for someone to use
this</sup></sub>

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

🆑
add: Coffee machines can now carry over reagents from the beans to the
coffee (surely no one will inject poison into them)
/🆑

---------

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>
This commit is contained in:
SkyratBot
2024-04-16 04:22:01 +02:00
committed by GitHub
parent 0b29278fa8
commit 96d9ba45f2
@@ -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