mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-22 05:25:15 +01:00
Separates checking failing organs and checking damage thresholds on organs (#61614)
So I fucked up in #61541 (a86e939bd4) - 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.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user