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
-4
View File
@@ -21,7 +21,6 @@
/obj/machinery/biogenerator/Initialize()
. = ..()
stored_research = new /datum/techweb/specialized/autounlocking/biogenerator
create_reagents(1000)
/obj/machinery/biogenerator/Destroy()
QDEL_NULL(beaker)
@@ -62,9 +61,6 @@
if(in_range(user, src) || isobserver(user))
. += "<span class='notice'>The status display reads: Productivity at <b>[productivity*100]%</b>.<br>Matter consumption reduced by <b>[(efficiency*25)-25]</b>%.<br>Machine can hold up to <b>[max_items]</b> pieces of produce.</span>"
/obj/machinery/biogenerator/on_reagent_change(changetype) //When the reagents change, change the icon as well.
update_icon()
/obj/machinery/biogenerator/update_icon_state()
if(panel_open)
icon_state = "biogen-empty-o"
+51 -29
View File
@@ -31,36 +31,58 @@
create_reagents(volume, INJECTABLE|DRAWABLE)
/obj/item/seeds/replicapod/on_reagent_change(changetype)
if(changetype == ADD_REAGENT)
var/datum/reagent/blood/B = reagents.has_reagent(/datum/reagent/blood)
if(B)
if(B.data["mind"] && B.data["cloneable"])
mind = B.data["mind"]
ckey = B.data["ckey"]
realName = B.data["real_name"]
blood_gender = B.data["gender"]
blood_type = B.data["blood_type"]
features = B.data["features"]
factions = B.data["factions"]
quirks = B.data["quirks"]
sampleDNA = B.data["blood_DNA"]
contains_sample = TRUE
visible_message("<span class='notice'>The [src] is injected with a fresh blood sample.</span>")
log_cloning("[key_name(mind)]'s cloning record was added to [src] at [AREACOORD(src)].")
else
visible_message("<span class='warning'>The [src] rejects the sample!</span>")
/obj/item/seeds/replicapod/create_reagents(max_vol, flags)
. = ..()
RegisterSignal(reagents, list(COMSIG_REAGENTS_ADD_REAGENT, COMSIG_REAGENTS_NEW_REAGENT), .proc/on_reagent_add)
RegisterSignal(reagents, COMSIG_REAGENTS_DEL_REAGENT, .proc/on_reagent_del)
RegisterSignal(reagents, COMSIG_PARENT_QDELETING, .proc/on_reagents_del)
if(!reagents.has_reagent(/datum/reagent/blood))
mind = null
ckey = null
realName = null
blood_gender = null
blood_type = null
features = null
factions = null
sampleDNA = null
contains_sample = FALSE
/// Handles the seeds' reagents datum getting deleted.
/obj/item/seeds/replicapod/proc/on_reagents_del(datum/reagents/reagents)
SIGNAL_HANDLER
UnregisterSignal(reagents, list(COMSIG_REAGENTS_ADD_REAGENT, COMSIG_REAGENTS_NEW_REAGENT, COMSIG_REAGENTS_DEL_REAGENT, COMSIG_PARENT_QDELETING))
return NONE
/// Handles reagents getting added to this seed.
/obj/item/seeds/replicapod/proc/on_reagent_add(datum/reagents/reagents)
SIGNAL_HANDLER
var/datum/reagent/blood/B = reagents.has_reagent(/datum/reagent/blood)
if(!B)
return
if(B.data["mind"] && B.data["cloneable"])
mind = B.data["mind"]
ckey = B.data["ckey"]
realName = B.data["real_name"]
blood_gender = B.data["gender"]
blood_type = B.data["blood_type"]
features = B.data["features"]
factions = B.data["factions"]
quirks = B.data["quirks"]
sampleDNA = B.data["blood_DNA"]
contains_sample = TRUE
visible_message("<span class='notice'>The [src] is injected with a fresh blood sample.</span>")
log_cloning("[key_name(mind)]'s cloning record was added to [src] at [AREACOORD(src)].")
else
visible_message("<span class='warning'>The [src] rejects the sample!</span>")
return NONE
/// Handles reagents being deleted from these seeds.
/obj/item/seeds/replicapod/proc/on_reagent_del(changetype)
SIGNAL_HANDLER
if(reagents.has_reagent(/datum/reagent/blood))
return
mind = null
ckey = null
realName = null
blood_gender = null
blood_type = null
features = null
factions = null
sampleDNA = null
contains_sample = FALSE
return NONE
/obj/item/seeds/replicapod/get_analyzer_text()
var/text = ..()