From 18cc737c0f7398685a08a309fca81537aa7e8180 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Wed, 10 Feb 2016 11:23:53 -0800 Subject: [PATCH 1/3] Might make the defib more reliable, and adds a message for the ghost not being present. --- code/game/objects/items/weapons/defib.dm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index 0cef06f2fa2..c61eee98528 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -342,6 +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) + // In case the ghost's not getting deleted for some reason + 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 @@ -387,11 +392,12 @@ user.visible_message("[defib] buzzes: Resuscitation failed - Heart tissue damage beyond point of no return for defibrillation.") 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") + 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("[defib] 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) defib.deductcharge(revivecost) update_icon() From ae3ab870f83c154dda41c719f2f322c8bbb2355d Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Fri, 19 Feb 2016 20:42:25 -0800 Subject: [PATCH 2/3] Adds the recommended fixes --- code/game/objects/items/weapons/defib.dm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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 From 250e07a9157b7484685602a7a2f9b870bcc97930 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Fri, 19 Feb 2016 21:05:48 -0800 Subject: [PATCH 3/3] bluh --- code/game/objects/items/weapons/defib.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index c1369801faf..1b303b0205a 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -344,7 +344,7 @@ 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 + 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) @@ -471,7 +471,7 @@ 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 + 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) @@ -499,7 +499,7 @@ H.adjustBruteLoss(tobehealed) user.visible_message("[user] pings: Resuscitation successful.") playsound(get_turf(src), 'sound/machines/defib_success.ogg', 50, 0) - H.stat = 1 + H.stat = UNCONSCIOUS H.update_revive() H.emote("gasp") if(tplus > tloss) @@ -514,7 +514,7 @@ 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.") + user.visible_message("[user] 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