From 2d46293b92cdcab320b7f649b85302a3a7a9c4bd Mon Sep 17 00:00:00 2001 From: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Thu, 23 Sep 2021 22:00:42 -0400 Subject: [PATCH] Separates checking failing organs and checking damage thresholds on organs (#61614) So I fucked up in #61541 (a86e939bd4435965b81ae14665133e8fbc356b10) - I didn't test/know Inacusiate/Oculine to know thats what the code was for. Snowflake code in their on_life specifically there in case inacusiate/oculine was drank. I thought about trying to make it something all organs did, rather than reverting my change, though I can just revert it if thats preferable. Eyes/Ears can now be repaired with Inacusiate and Oculine again. --- code/modules/surgery/organs/organ_internal.dm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index c463ff64104..8fd942735c1 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -121,6 +121,7 @@ INITIALIZE_IMMEDIATE(/obj/item/organ) applyOrganDamage(decay_factor * maxHealth * delta_time) /obj/item/organ/proc/on_life(delta_time, times_fired) //repair organ damage if the organ is not failing + check_failing_thresholds(owner) // Check if an organ should/shouldnt be failing if(organ_flags & ORGAN_FAILING) handle_failing_organs(delta_time) return @@ -199,14 +200,12 @@ INITIALIZE_IMMEDIATE(/obj/item/organ) var/delta = damage - prev_damage if(delta > 0) if(damage >= maxHealth) - organ_flags |= ORGAN_FAILING return now_failing if(damage > high_threshold && prev_damage <= high_threshold) return high_threshold_passed if(damage > low_threshold && prev_damage <= low_threshold) return low_threshold_passed else - organ_flags &= ~ORGAN_FAILING if(prev_damage > low_threshold && damage <= low_threshold) return low_threshold_cleared if(prev_damage > high_threshold && damage <= high_threshold) @@ -214,6 +213,16 @@ INITIALIZE_IMMEDIATE(/obj/item/organ) if(prev_damage == maxHealth) return now_fixed +/**check_failing_thresholds + * input: mob/organ_owner (a mob, the owner of the organ we call the proc on) + * output: failing organ flags on a failing/no longer failing organ. + */ +/obj/item/organ/proc/check_failing_thresholds(mob/organ_owner) + if(damage >= maxHealth) + organ_flags |= ORGAN_FAILING + if(damage < maxHealth) + organ_flags &= ~ORGAN_FAILING + //Looking for brains? //Try code/modules/mob/living/carbon/brain/brain_item.dm