diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index c61eee98528..c1369801faf 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -342,9 +342,11 @@ user.visible_message("[user] places [src] on [M.name]'s chest.", "You place [src] on [M.name]'s chest.") playsound(get_turf(src), 'sound/machines/defib_charge.ogg', 50, 0) var/mob/dead/observer/ghost = H.get_ghost() - if(!ghost.client) + if(ghost && !ghost.client) // In case the ghost's not getting deleted for some reason + H,key = ghost.key log_to_dd("Ghost of name [ghost.name] is bound to [H.real_name], but lacks a client. Deleting ghost.") + qdel(ghost) ghost = null var/tplus = world.time - H.timeofdeath @@ -393,7 +395,7 @@ else if(total_burn >= 180 || total_brute >= 180) user.visible_message("[defib] buzzes: Resuscitation failed - Severe tissue damage detected.") else if(ghost) - user.visible_message("[defib] buzzes: Resuscitation failed: Patient's brain is unresponsive") + user.visible_message("[defib] buzzes: Resuscitation failed: Patient's brain is unresponsive. Further attempts may succeed.") ghost << "Your heart is being defibrillated. Return to your body if you want to be revived! (Verbs -> Ghost -> Re-enter corpse)" ghost << sound('sound/effects/genetics.ogg') else @@ -467,6 +469,13 @@ user.visible_message("[user] places [src] on [M.name]'s chest.", "You place [src] on [M.name]'s chest.") playsound(get_turf(src), 'sound/machines/defib_charge.ogg', 50, 0) var/mob/dead/observer/ghost = H.get_ghost() + if(ghost && !ghost.client) + // In case the ghost's not getting deleted for some reason + H,key = ghost.key + log_to_dd("Ghost of name [ghost.name] is bound to [H.real_name], but lacks a client. Deleting ghost.") + + qdel(ghost) + ghost = null var/tplus = world.time - H.timeofdeath var/tlimit = 6000 //past this much time the patient is unrecoverable (in deciseconds) var/tloss = 3000 //brain damage starts setting in on the patient after some time left rotting @@ -504,11 +513,12 @@ user.visible_message("[user] buzzes: Resuscitation failed - Heart tissue damage beyond point of no return for defibrillation.") else if(total_burn >= 180 || total_brute >= 180) user.visible_message("[user] buzzes: Resuscitation failed - Severe tissue damage detected.") + else if(ghost) + user.visible_message("[defib] buzzes: Resuscitation failed: Patient's brain is unresponsive. Further attempts may succeed.") + ghost << "Your heart is being defibrillated. Return to your body if you want to be revived! (Verbs -> Ghost -> Re-enter corpse)" + ghost << sound('sound/effects/genetics.ogg') else user.visible_message("[user] buzzes: Resuscitation failed.") - if(ghost) - ghost << "Your heart is being defibrillated. Return to your body if you want to be revived! (Verbs -> Ghost -> Re-enter corpse)" - ghost << sound('sound/effects/genetics.ogg') playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0) if(isrobot(user)) var/mob/living/silicon/robot/R = user