mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 14:08:31 +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:
@@ -57,6 +57,17 @@
|
||||
SSmobs.cubemonkeys -= src
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/monkey/create_reagents(max_vol, flags)
|
||||
. = ..()
|
||||
RegisterSignal(reagents, list(COMSIG_REAGENTS_NEW_REAGENT, COMSIG_REAGENTS_DEL_REAGENT), .proc/on_reagent_change)
|
||||
RegisterSignal(reagents, COMSIG_PARENT_QDELETING, .proc/on_reagents_del)
|
||||
|
||||
/// Handles removing signal hooks incase someone is crazy enough to reset the reagents datum.
|
||||
/mob/living/carbon/monkey/proc/on_reagents_del(datum/reagents/reagents)
|
||||
SIGNAL_HANDLER
|
||||
UnregisterSignal(reagents, list(COMSIG_REAGENTS_NEW_REAGENT, COMSIG_REAGENTS_DEL_REAGENT, COMSIG_PARENT_QDELETING))
|
||||
return NONE
|
||||
|
||||
/mob/living/carbon/monkey/create_internal_organs()
|
||||
internal_organs += new /obj/item/organ/appendix
|
||||
internal_organs += new /obj/item/organ/lungs
|
||||
@@ -69,8 +80,13 @@
|
||||
internal_organs += new /obj/item/organ/stomach
|
||||
..()
|
||||
|
||||
/mob/living/carbon/monkey/on_reagent_change()
|
||||
. = ..()
|
||||
/**
|
||||
* Snowflake handling for morphine and nuka cola speed mods.
|
||||
*
|
||||
* Should be moved to the reagents at some future point. As it is I'm in a hurry.
|
||||
*/
|
||||
/mob/living/carbon/monkey/proc/on_reagent_change(datum/reagents/holder, ...)
|
||||
SIGNAL_HANDLER
|
||||
var/amount
|
||||
if(reagents.has_reagent(/datum/reagent/medicine/morphine))
|
||||
amount = -1
|
||||
@@ -78,6 +94,7 @@
|
||||
amount = -1
|
||||
if(amount)
|
||||
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/monkey_reagent_speedmod, TRUE, amount)
|
||||
return NONE
|
||||
|
||||
/mob/living/carbon/monkey/updatehealth()
|
||||
. = ..()
|
||||
|
||||
@@ -437,6 +437,7 @@
|
||||
taste(source)
|
||||
|
||||
var/touch_protection = (methods & VAPOR) ? get_permeability_protection() : 0
|
||||
SEND_SIGNAL(source, COMSIG_REAGENTS_EXPOSE_MOB, src, reagents, methods, volume_modifier, show_message, touch_protection)
|
||||
for(var/reagent in reagents)
|
||||
var/datum/reagent/R = reagent
|
||||
. |= R.expose_mob(src, methods, reagents[R], show_message, touch_protection)
|
||||
|
||||
@@ -67,7 +67,6 @@
|
||||
new /obj/item/stock_parts/cell/potato(Tsec)
|
||||
var/obj/item/reagent_containers/food/drinks/drinkingglass/shotglass/S = new(Tsec)
|
||||
S.reagents.add_reagent(/datum/reagent/consumable/ethanol/whiskey, 15)
|
||||
S.on_reagent_change(ADD_REAGENT)
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/bot/secbot/pingsky
|
||||
|
||||
@@ -113,6 +113,17 @@
|
||||
Friends = null
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/slime/create_reagents(max_vol, flags)
|
||||
. = ..()
|
||||
RegisterSignal(reagents, list(COMSIG_REAGENTS_NEW_REAGENT, COMSIG_REAGENTS_DEL_REAGENT), .proc/on_reagent_change)
|
||||
RegisterSignal(reagents, COMSIG_PARENT_QDELETING, .proc/on_reagents_del)
|
||||
|
||||
/// Handles removing signal hooks incase someone is crazy enough to reset the reagents datum.
|
||||
/mob/living/simple_animal/slime/proc/on_reagents_del(datum/reagents/reagents)
|
||||
SIGNAL_HANDLER
|
||||
UnregisterSignal(reagents, list(COMSIG_REAGENTS_NEW_REAGENT, COMSIG_REAGENTS_DEL_REAGENT, COMSIG_PARENT_QDELETING))
|
||||
return NONE
|
||||
|
||||
/mob/living/simple_animal/slime/proc/set_colour(new_colour)
|
||||
colour = new_colour
|
||||
update_name()
|
||||
@@ -142,8 +153,13 @@
|
||||
icon_state = icon_dead
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/slime/on_reagent_change()
|
||||
. = ..()
|
||||
/**
|
||||
* Snowflake handling of reagent movespeed modifiers
|
||||
*
|
||||
* Should be moved to the reagents at some point in the future. As it is I'm in a hurry.
|
||||
*/
|
||||
/mob/living/simple_animal/slime/proc/on_reagent_change(datum/reagents/holder, ...)
|
||||
SIGNAL_HANDLER
|
||||
remove_movespeed_modifier(/datum/movespeed_modifier/slime_reagentmod)
|
||||
var/amount = 0
|
||||
if(reagents.has_reagent(/datum/reagent/medicine/morphine)) // morphine slows slimes down
|
||||
@@ -152,6 +168,7 @@
|
||||
amount = 5
|
||||
if(amount)
|
||||
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/slime_reagentmod, multiplicative_slowdown = amount)
|
||||
return NONE
|
||||
|
||||
/mob/living/simple_animal/slime/updatehealth()
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user