From 8712d7e902f824f2424ddafe391b02fd2fd6154c Mon Sep 17 00:00:00 2001 From: PrismaticGynoid Date: Tue, 20 Feb 2018 08:39:03 -0800 Subject: [PATCH] Two organ bugfixes (#4877) * Two organ bugfixes First, allows FBPs with synthetic brains (posis and drones) to actually die from massive brain damage. Before, although the damage would still affect them, robotic vital organs taking 60+ damage would never actually kill the owner. Second, stops the zombie organs bug from popping up in normal play. You were able to repair all the damage on an organ, but not the ORGAN_DEAD status, leading to "dead" organs that still functioned (and that you could never die from them taking damage). Now, repairing the damage surgically will remove that. * Repair for dead undamaged organs too --- code/modules/organs/organ.dm | 14 +++++++------- code/modules/surgery/organs_internal.dm | 7 ++++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index 7f4599ecdd9..29b98d26634 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -83,10 +83,9 @@ var/list/organ_cache = list() blood_DNA[dna.unique_enzymes] = dna.b_type /obj/item/organ/proc/die() - if(robotic >= ORGAN_ROBOT) - return + if(robotic < ORGAN_ROBOT) + status |= ORGAN_DEAD damage = max_damage - status |= ORGAN_DEAD processing_objects -= src if(owner && vital) owner.death() @@ -107,6 +106,11 @@ var/list/organ_cache = list() return if(preserved) return + + //check if we've hit max_damage + if(damage >= max_damage) + die() + //Process infections if(robotic >= ORGAN_ROBOT || (owner && owner.species && (owner.species.flags & IS_PLANT || (owner.species.flags & NO_INFECT)))) germ_level = 0 @@ -132,10 +136,6 @@ var/list/organ_cache = list() handle_rejection() handle_germ_effects() - //check if we've hit max_damage - if(damage >= max_damage) - die() - /obj/item/organ/examine(mob/user) ..(user) if(status & ORGAN_DEAD) diff --git a/code/modules/surgery/organs_internal.dm b/code/modules/surgery/organs_internal.dm index 49fe150c4e0..d54a4aff146 100644 --- a/code/modules/surgery/organs_internal.dm +++ b/code/modules/surgery/organs_internal.dm @@ -73,7 +73,7 @@ return var/is_organ_damaged = 0 for(var/obj/item/organ/I in affected.internal_organs) - if(I.damage > 0) + if(I && (I.damage > 0 || I.status == ORGAN_DEAD)) is_organ_damaged = 1 break return ..() && is_organ_damaged @@ -91,7 +91,7 @@ var/obj/item/organ/external/affected = target.get_organ(target_zone) for(var/obj/item/organ/I in affected.internal_organs) - if(I && I.damage > 0) + if(I && (I.damage > 0 || I.status == ORGAN_DEAD)) if(!(I.robotic >= ORGAN_ROBOT)) user.visible_message("[user] starts treating damage to [target]'s [I.name] with [tool_name].", \ "You start treating damage to [target]'s [I.name] with [tool_name]." ) @@ -111,11 +111,12 @@ var/obj/item/organ/external/affected = target.get_organ(target_zone) for(var/obj/item/organ/internal/I in affected.internal_organs) - if(I && I.damage > 0) + if(I && (I.damage > 0 || I.status == ORGAN_DEAD)) if(!(I.robotic >= ORGAN_ROBOT)) user.visible_message("[user] treats damage to [target]'s [I.name] with [tool_name].", \ "You treat damage to [target]'s [I.name] with [tool_name]." ) I.damage = 0 + I.status = 0 if(I.organ_tag == O_EYES) target.sdisabilities &= ~BLIND if(I.organ_tag == O_LUNGS)