From b9d7fd90457ee86092c6a8b27cd927e4aa5c9e7c Mon Sep 17 00:00:00 2001
From: Luc <89928798+lewcc@users.noreply.github.com>
Date: Wed, 15 Jun 2022 06:39:34 -0700
Subject: [PATCH] [GBP: NO UPDATE] Notify ghosts of defib when paddles are
applied, rather than just before shock (#17967)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Notify ghost before windup
* 🎵 test your code, test your code 🎵
---
code/game/objects/items/weapons/defib.dm | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm
index 6bcbca01daa..5dcc6c8e4f8 100644
--- a/code/game/objects/items/weapons/defib.dm
+++ b/code/game/objects/items/weapons/defib.dm
@@ -390,26 +390,27 @@
user.visible_message("[user] begins to place [src] on [M.name]'s chest.", "You begin to place [src] on [M.name]'s chest.")
busy = TRUE
update_icon()
+ var/mob/dead/observer/ghost = H.get_ghost(TRUE)
+ if(ghost && ghost.can_reenter_corpse)
+ to_chat(ghost, "Your heart is being defibrillated. Return to your body if you want to be revived! (Verbs -> Ghost -> Re-enter corpse)")
+ window_flash(ghost.client)
+ notify_ghosts()
+ ghost << sound('sound/effects/genetics.ogg')
if(do_after(user, 30 * toolspeed, target = M)) //beginning to place the paddles on patient's chest to allow some time for people to move away to stop the process
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(TRUE)
+
if(ghost && !ghost.client)
// In case the ghost's not getting deleted for some reason
H.key = ghost.key
log_runtime(EXCEPTION("Ghost of name [ghost.name] is bound to [H.real_name], but lacks a client. Deleting ghost."), src)
-
QDEL_NULL(ghost)
var/tplus = world.time - H.timeofdeath
var/tlimit = DEFIB_TIME_LIMIT
var/tloss = DEFIB_TIME_LOSS
var/total_burn = 0
var/total_brute = 0
- if(ghost && ghost.can_reenter_corpse)
- to_chat(ghost, "Your heart is being defibrillated. Return to your body if you want to be revived! (Verbs -> Ghost -> Re-enter corpse)")
- window_flash(ghost.client)
- notify_ghosts()
- ghost << sound('sound/effects/genetics.ogg')
+
if(do_after(user, 20 * toolspeed, target = M)) //placed on chest and short delay to shock for dramatic effect, revive time is 5sec total
for(var/obj/item/carried_item in H.contents)
if(istype(carried_item, /obj/item/clothing/suit/space))