Skip to content

Commit

Permalink
[MIRROR] Fixes race condition in Life() [MDB IGNORE] (#844)
Browse files Browse the repository at this point in the history
* Fixes race condition in Life() (#79934)

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: Bloop <[email protected]>
Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>
  • Loading branch information
4 people authored Nov 27, 2023
1 parent 07ed061 commit 61169e2
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 61169e2

Please sign in to comment.