Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Fixes race condition in Life() #844

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

if(HAS_TRAIT(src, TRAIT_STASIS))
. = ..()
reagents.handle_stasis_chems(src, seconds_per_tick, times_fired)
reagents?.handle_stasis_chems(src, seconds_per_tick, times_fired)
else
//Reagent processing needs to come before breathing, to prevent edge cases.
handle_dead_metabolization(seconds_per_tick, times_fired) //Dead metabolization first since it can modify life metabolization.
Expand Down Expand Up @@ -488,7 +488,7 @@

/mob/living/carbon/proc/handle_organs(seconds_per_tick, times_fired)
if(stat == DEAD)
if(reagents.has_reagent(/datum/reagent/toxin/formaldehyde, 1) || reagents.has_reagent(/datum/reagent/cryostylane)) // No organ decay if the body contains formaldehyde.
if(reagents && (reagents.has_reagent(/datum/reagent/toxin/formaldehyde, 1) || reagents.has_reagent(/datum/reagent/cryostylane))) // No organ decay if the body contains formaldehyde.
return
for(var/obj/item/organ/internal/organ in organs)
// On-death is where organ decay is handled
Expand Down Expand Up @@ -569,9 +569,9 @@
* - times_fired: The number of times SSmobs has ticked.
*/
/mob/living/carbon/proc/handle_dead_metabolization(seconds_per_tick, times_fired)
if (stat != DEAD)
if(stat != DEAD)
return
reagents.metabolize(src, seconds_per_tick, times_fired, can_overdose = TRUE, liverless = TRUE, dead = TRUE) // Your liver doesn't work while you're dead.
reagents?.metabolize(src, seconds_per_tick, times_fired, can_overdose = TRUE, liverless = TRUE, dead = TRUE) // Your liver doesn't work while you're dead.

/// Base carbon environment handler, adds natural stabilization
/mob/living/carbon/handle_environment(datum/gas_mixture/environment, seconds_per_tick, times_fired)
Expand Down
Loading