From eda08fef89f61d6ce43a12e98319396b8bb8b4e4 Mon Sep 17 00:00:00 2001 From: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:45:46 +0530 Subject: [PATCH] [NO GBP] Instant reactions yield reagent results again (#81334) ## About The Pull Request - Fixes #81333 Should calculate purity before we remove the reagents ## Changelog :cl: fix: Instant reactions yield reagent results again /:cl: --- code/modules/reagents/chemistry/holder/reactions.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/modules/reagents/chemistry/holder/reactions.dm b/code/modules/reagents/chemistry/holder/reactions.dm index 4d09ccf89e5..3fa4c7ac95c 100644 --- a/code/modules/reagents/chemistry/holder/reactions.dm +++ b/code/modules/reagents/chemistry/holder/reactions.dm @@ -310,14 +310,16 @@ if(!multiplier)//Incase we're missing reagents - usually from on_reaction being called in an equlibrium when the results.len == 0 handler catches a misflagged reaction return FALSE + //average purity to be used in scaling the yield of products formed + var/average_purity = get_average_purity() + //remove the required reagents for(var/datum/reagent/requirement as anything in cached_required_reagents)//this is not an object remove_reagent(requirement, cached_required_reagents[requirement] * multiplier) //add the result reagents whose yield depend on the average purity var/yield - var/average_purity = get_average_purity() - for(var/datum/reagent/product as anything in selected_reaction.results) + for(var/datum/reagent/product as anything in cached_results) yield = cached_results[product] * multiplier * average_purity SSblackbox.record_feedback("tally", "chemical_reaction", yield, product) add_reagent(product, yield, null, chem_temp, average_purity)