From 529c75caeeee6e804dbd4bc0f2355d2f85692917 Mon Sep 17 00:00:00 2001 From: NovaBot <154629622+NovaBot13@users.noreply.github.com> Date: Thu, 28 Dec 2023 09:28:50 -0500 Subject: [PATCH] Some reaction & chamber fixes (#141) * [NO GBP] Some reaction & chamber fixes (#80600) ## About The Pull Request - Fixes #80596 The UI opens when you remove/add a beaker to it - Fixes #80597 Calls `handle_reactions()` per step and updates UI thus reporting changes more often - Fixes https://github.com/tgstation/tgstation/issues/80597#issuecomment-1869693182. For instant reactions such as plastic we want to call `handle_reactions()` wherever possible (in this case whenever new reagent is added per equilibrium step) so that we can maximise product formed and start new reactions whenever possible - Fixes #80632 Same explanation as above since it now triggers all reactions more often ## Changelog :cl: fix: reaction chamber open its UI when inserting/removing beakers from it fix: reaction chamber triggers new reactions & updates UI more often during heating fix: instant and normal reactions now get triggered more often so for e.g. more plastic sheets from polymer reactions or more reactions occur when there are multiple reagents present /:cl: * [NO GBP] Some reaction & chamber fixes --------- Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: NovaBot --- code/modules/reagents/chemistry/equilibrium.dm | 2 +- code/modules/reagents/chemistry/holder/holder.dm | 2 +- .../reagents/chemistry/machinery/chem_heater.dm | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/code/modules/reagents/chemistry/equilibrium.dm b/code/modules/reagents/chemistry/equilibrium.dm index c9d6226930c..ffa8e0c32d4 100644 --- a/code/modules/reagents/chemistry/equilibrium.dm +++ b/code/modules/reagents/chemistry/equilibrium.dm @@ -341,7 +341,7 @@ var/total_step_added = 0 for(var/datum/reagent/product as anything in reaction.results) //create the products - step_add = holder.add_reagent(product, delta_chem_factor * reaction.results[product], null, cached_temp, purity, override_base_ph = TRUE, no_react = TRUE) + step_add = holder.add_reagent(product, delta_chem_factor * reaction.results[product], null, cached_temp, purity, override_base_ph = TRUE) if(!step_add) to_delete = TRUE return diff --git a/code/modules/reagents/chemistry/holder/holder.dm b/code/modules/reagents/chemistry/holder/holder.dm index 867245e9c25..5872f5db1ae 100644 --- a/code/modules/reagents/chemistry/holder/holder.dm +++ b/code/modules/reagents/chemistry/holder/holder.dm @@ -194,7 +194,7 @@ set_temperature(reagtemp) SEND_SIGNAL(src, COMSIG_REAGENTS_NEW_REAGENT, new_reagent, amount, reagtemp, data, no_react) - if(!no_react && !is_reacting) + if(!no_react) handle_reactions() return amount diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index f0113153c92..c31c099c255 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -146,12 +146,14 @@ //keep constant with the chemical acclimator please beaker.reagents.adjust_thermal_energy((target_temperature - beaker.reagents.chem_temp) * heater_coefficient * seconds_per_tick * SPECIFIC_HEAT_DEFAULT * beaker.reagents.total_volume * randomness) - if(!beaker.reagents.is_reacting) - beaker.reagents.handle_reactions() + beaker.reagents.handle_reactions() //use power use_power(active_power_usage * seconds_per_tick) + //show changes to ui immediatly for responsivenes + SStgui.update_uis(src) + /obj/machinery/chem_heater/wrench_act(mob/living/user, obj/item/tool) . = ITEM_INTERACT_BLOCKING if(default_unfasten_wrench(user, tool) == SUCCESSFUL_UNFASTEN) @@ -176,8 +178,10 @@ var/obj/item/reagent_containers/injector = held_item injector.afterattack(beaker, user, proximity_flag = TRUE) return TRUE + if(is_reagent_container(held_item) && held_item.is_open_container()) - replace_beaker(user, held_item) + if(replace_beaker(user, held_item)) + ui_interact(user) balloon_alert(user, "beaker added!") return TRUE