Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Coffee machines carry over reagents from the beans #2831

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions code/modules/food_and_drinks/machinery/coffeemaker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading