mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 06:29:23 +01:00
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:
@@ -38,6 +38,17 @@
|
||||
desc += " This one has a rating of [DisplayEnergy(maxcharge)], and you should not swallow it."
|
||||
update_icon()
|
||||
|
||||
/obj/item/stock_parts/cell/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/item/stock_parts/cell/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
|
||||
|
||||
/obj/item/stock_parts/cell/update_overlays()
|
||||
. = ..()
|
||||
if(grown_battery)
|
||||
@@ -86,9 +97,10 @@
|
||||
user.visible_message("<span class='suicide'>[user] is licking the electrodes of [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
return (FIRELOSS)
|
||||
|
||||
/obj/item/stock_parts/cell/on_reagent_change(changetype)
|
||||
rigged = (corrupted || reagents.has_reagent(/datum/reagent/toxin/plasma, 5)) //has_reagent returns the reagent datum
|
||||
return ..()
|
||||
/obj/item/stock_parts/cell/proc/on_reagent_change(datum/reagents/holder, ...)
|
||||
SIGNAL_HANDLER
|
||||
rigged = (corrupted || holder.has_reagent(/datum/reagent/toxin/plasma, 5)) ? TRUE : FALSE //has_reagent returns the reagent datum
|
||||
return NONE
|
||||
|
||||
|
||||
/obj/item/stock_parts/cell/proc/explode()
|
||||
|
||||
@@ -925,11 +925,32 @@
|
||||
if(status == LIGHT_BURNED || status == LIGHT_OK)
|
||||
shatter()
|
||||
|
||||
// attack bulb/tube with object
|
||||
// if a syringe, can inject plasma to make it explode
|
||||
/obj/item/light/on_reagent_change(changetype)
|
||||
rigged = (reagents.has_reagent(/datum/reagent/toxin/plasma, LIGHT_REAGENT_CAPACITY)) //has_reagent returns the reagent datum
|
||||
return ..()
|
||||
/obj/item/light/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 rigging the cell if it contains enough plasma.
|
||||
*/
|
||||
/obj/item/light/proc/on_reagent_change(datum/reagents/holder, ...)
|
||||
SIGNAL_HANDLER
|
||||
rigged = (reagents.has_reagent(/datum/reagent/toxin/plasma, LIGHT_REAGENT_CAPACITY)) ? TRUE : FALSE //has_reagent returns the reagent datum, we don't want to hold a reference to prevent hard dels
|
||||
return NONE
|
||||
|
||||
/**
|
||||
* Handles the reagent holder datum being deleted for some reason. Probably someone making pizza lights.
|
||||
*/
|
||||
/obj/item/light/proc/on_reagents_del(datum/reagents/holder)
|
||||
SIGNAL_HANDLER
|
||||
UnregisterSignal(holder, list(
|
||||
COMSIG_PARENT_QDELETING,
|
||||
COMSIG_REAGENTS_NEW_REAGENT,
|
||||
COMSIG_REAGENTS_ADD_REAGENT,
|
||||
COMSIG_REAGENTS_REM_REAGENT,
|
||||
COMSIG_REAGENTS_DEL_REAGENT,
|
||||
))
|
||||
return NONE
|
||||
|
||||
#undef LIGHT_REAGENT_CAPACITY
|
||||
|
||||
|
||||
Reference in New Issue
Block a user