From 74e8bbf029dd25b41544fbb394ef70c841b408f1 Mon Sep 17 00:00:00 2001 From: phil235 Date: Fri, 12 Feb 2016 21:47:22 +0100 Subject: [PATCH] Fixes defibbed corpse not getting blind overlay despite being in crit. Brain mobs that are beaten to death can still be inserted inside a brainless human corpse but defibbing the corpse cannot work (the brain is too damaged). On the other hand cloning that corpse will still work. Deffibing a brainless corpse no longer gives "further attempts may be successful". Fixes brain mob's container var not being nullified on Destroy(). --- code/game/objects/items/robot/robot_parts.dm | 2 +- code/game/objects/items/weapons/defib.dm | 7 +++++-- code/modules/mob/living/carbon/brain/MMI.dm | 6 +++--- code/modules/mob/living/carbon/brain/brain.dm | 3 ++- code/modules/mob/living/carbon/brain/brain_item.dm | 2 ++ code/modules/mob/living/carbon/brain/death.dm | 4 ++-- code/modules/mob/living/carbon/brain/life.dm | 14 +++++++++----- code/modules/mob/living/death.dm | 4 ++-- code/modules/mob/transform_procs.dm | 2 +- 9 files changed, 27 insertions(+), 17 deletions(-) diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 89a2e61a5e7..d33c5a274e2 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -187,7 +187,7 @@ user << "The mmi indicates that their mind is currently inactive; it might change!" return - if(BM.stat == DEAD || BM.health <= config.health_threshold_dead) + if(BM.stat == DEAD || (M.brain && M.brain.damaged_brain)) user << "Sticking a dead brain into the frame would sort of defeat the purpose!" return diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index 102b1c72905..1ade32a2a99 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -488,9 +488,12 @@ failed = "[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - Heart tissue damage beyond point of no return. Further attempts futile." else if(total_burn >= 180 || total_brute >= 180) failed = "[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - Severe tissue damage makes recovery of patient impossible via defibrillator. Further attempts futile." - else if(H.get_ghost() || !H.getorgan(/obj/item/organ/internal/brain)) + else if(H.get_ghost()) failed = "[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - No activity in patient's brain. Further attempts may be successful." - + else + var/obj/item/organ/internal/brain/BR = H.getorgan(/obj/item/organ/internal/brain) + if(!BR || BR.damaged_brain) + failed = "[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - Patient's brain is missing or damaged beyond point of no return. Further attempts futile." if(failed) user.visible_message(failed) diff --git a/code/modules/mob/living/carbon/brain/MMI.dm b/code/modules/mob/living/carbon/brain/MMI.dm index 28658677209..912c000ebba 100644 --- a/code/modules/mob/living/carbon/brain/MMI.dm +++ b/code/modules/mob/living/carbon/brain/MMI.dm @@ -61,9 +61,9 @@ newbrain.brainmob = null brainmob.loc = src brainmob.container = src - if(brainmob.health > config.health_threshold_dead) - brainmob.stat = CONSCIOUS - dead_mob_list -= brainmob //Update dem lists + if(!newbrain.damaged_brain) // the brain organ hasn't beaten to death. + brainmob.stat = CONSCIOUS //we manually revive the brain mob + dead_mob_list -= brainmob living_mob_list += brainmob brainmob.reset_perspective() diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm index 2fbb492bfc8..2878b8d755f 100644 --- a/code/modules/mob/living/carbon/brain/brain.dm +++ b/code/modules/mob/living/carbon/brain/brain.dm @@ -2,7 +2,7 @@ /mob/living/carbon/brain languages = HUMAN - var/obj/item/container = null + var/obj/item/device/mmi/container = null var/timeofhostdeath = 0 var/emp_damage = 0//Handles a type of MMI damage has_limbs = 0 @@ -21,6 +21,7 @@ if(stat!=DEAD) //If not dead. death(1) //Brains can die again. AND THEY SHOULD AHA HA HA HA HA HA ghostize() //Ghostize checks for key so nothing else is necessary. + container = null return ..() /mob/living/carbon/brain/update_canmove() diff --git a/code/modules/mob/living/carbon/brain/brain_item.dm b/code/modules/mob/living/carbon/brain/brain_item.dm index 2d59133c9c7..81389febbcb 100644 --- a/code/modules/mob/living/carbon/brain/brain_item.dm +++ b/code/modules/mob/living/carbon/brain/brain_item.dm @@ -11,6 +11,7 @@ origin_tech = "biotech=4" attack_verb = list("attacked", "slapped", "whacked") var/mob/living/carbon/brain/brainmob = null + var/damaged_brain = 0 //whether the brain organ is damaged. /obj/item/organ/internal/brain/Insert(mob/living/carbon/M, special = 0) ..() @@ -58,6 +59,7 @@ brainmob << "You feel slightly disoriented. That's normal when you're just a brain." /obj/item/organ/internal/brain/attackby(obj/item/O, mob/user, params) + user.changeNext_move(CLICK_CD_MELEE) if(brainmob) O.attack(brainmob, user) //Oh noooeeeee diff --git a/code/modules/mob/living/carbon/brain/death.dm b/code/modules/mob/living/carbon/brain/death.dm index 9e79f8dba52..b9672dbe833 100644 --- a/code/modules/mob/living/carbon/brain/death.dm +++ b/code/modules/mob/living/carbon/brain/death.dm @@ -3,7 +3,7 @@ return stat = DEAD - if(!gibbed && container && istype(container, /obj/item/device/mmi))//If not gibbed but in a container. + if(!gibbed && container)//If not gibbed but in a container. var/obj/item/device/mmi = container mmi.visible_message("[src]'s MMI flatlines!", \ "You hear something flatline.") @@ -12,7 +12,7 @@ return ..() /mob/living/carbon/brain/gib(animation = 0) - if(container && istype(container, /obj/item/device/mmi)) + if(container) qdel(container)//Gets rid of the MMI if there is one if(loc) if(istype(loc,/obj/item/organ/internal/brain)) diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 370edbc1d58..fea3ed691e1 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -8,15 +8,19 @@ /mob/living/carbon/brain/handle_environment(datum/gas_mixture/environment) return -/mob/living/carbon/brain/proc/handle_temperature_damage(body_part, exposed_temperature, exposed_intensity) - return - /mob/living/carbon/brain/update_stat() if(status_flags & GODMODE) return - if(stat != DEAD) - if(health <= config.health_threshold_dead) + if(health <= config.health_threshold_dead) + if(stat != DEAD) death() + var/obj/item/organ/internal/brain/BR + if(container && container.brain) + BR = container.brain + else if(istype(loc, /obj/item/organ/internal/brain)) + BR = loc + if(BR) + BR.damaged_brain = 1 //beaten to a pulp /* //currently unused feature, since brain outside a mmi is always dead. /mob/living/carbon/brain/proc/handle_brain_revival_life() diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index a62d0de5c43..b78d0fae14e 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -36,7 +36,6 @@ /mob/living/death(gibbed) unset_machine() - reset_perspective(null) timeofdeath = world.time tod = worldtime2text() if(mind) @@ -50,7 +49,8 @@ stunned = 0 weakened = 0 sleeping = 0 - update_sight() + blind_eyes(1) + reset_perspective(null) hide_fullscreens() update_damage_hud() update_health_hud() diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 6c7a33cf4c2..a175d02523b 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -320,7 +320,7 @@ for(var/t in organs) qdel(t) - var/mob/living/silicon/robot/R = new /mob/living/silicon/robot( loc ) + var/mob/living/silicon/robot/R = new /mob/living/silicon/robot(loc) // cyborgs produced by Robotize get an automatic power cell R.cell = new(R)