Makes reagent updates more event based, also makes plasma boil properly. (#54790)

Converts most on_reagent_change calls to signals.
Converts on_reagent_change to a signal handler.
Expands the reagent exposure signals
Add a setter proc and signal for reagent temperature
Fixes adjust_thermal_energy not sending a temperature change event
Makes min_temp and max_temp actually do something with adjust_thermal_energy
This commit is contained in:
TemporalOroboros
2020-12-22 19:20:00 -03:00
committed by GitHub
parent 6e8b04d3c1
commit 863977e5fa
32 changed files with 741 additions and 514 deletions
@@ -12,6 +12,17 @@
. = ..()
AddComponent(/datum/component/plumbing/simple_demand, bolt)
/obj/machinery/plumbing/growing_vat/create_reagents(max_vol, flags)
. = ..()
RegisterSignal(reagents, list(COMSIG_REAGENTS_NEW_REAGENT, COMSIG_REAGENTS_ADD_REAGENT, COMSIG_REAGENTS_DEL_REAGENT, COMSIG_REAGENTS_REM_REAGENT), .proc/on_reagent_change)
RegisterSignal(reagents, COMSIG_PARENT_QDELETING, .proc/on_reagents_del)
/// Handles properly detaching signal hooks.
/obj/machinery/plumbing/growing_vat/proc/on_reagents_del(datum/reagents/reagents)
SIGNAL_HANDLER
UnregisterSignal(reagents, list(COMSIG_REAGENTS_NEW_REAGENT, COMSIG_REAGENTS_ADD_REAGENT, COMSIG_REAGENTS_DEL_REAGENT, COMSIG_REAGENTS_REM_REAGENT, COMSIG_PARENT_QDELETING))
return NONE
///When we process, we make use of our reagents to try and feed the samples we have.
/obj/machinery/plumbing/growing_vat/process()
if(!is_operational)
@@ -64,10 +75,11 @@
. = ..()
QDEL_NULL(biological_sample)
///Call update icon when reagents change to update the reagent content icons
/obj/machinery/plumbing/growing_vat/on_reagent_change(changetype)
/// Call update icon when reagents change to update the reagent content icons. Eats signal args.
/obj/machinery/plumbing/growing_vat/proc/on_reagent_change(datum/reagents/holder, ...)
SIGNAL_HANDLER
update_icon()
return ..()
return NONE
///Adds overlays to show the reagent contents
/obj/machinery/plumbing/growing_vat/update_overlays()