[GBP: NO UPDATE] Notify ghosts of defib when paddles are applied, rather than just before shock (#17967)

* Notify ghost before windup

* 🎵 test your code, test your code 🎵
This commit is contained in:
Luc
2022-06-15 14:39:34 +01:00
committed by GitHub
parent 542a39867c
commit b9d7fd9045
+8 -7
View File
@@ -390,26 +390,27 @@
user.visible_message("<span class='warning'>[user] begins to place [src] on [M.name]'s chest.</span>", "<span class='warning'>You begin to place [src] on [M.name]'s chest.</span>")
busy = TRUE
update_icon()
var/mob/dead/observer/ghost = H.get_ghost(TRUE)
if(ghost && ghost.can_reenter_corpse)
to_chat(ghost, "<span class='ghostalert'>Your heart is being defibrillated. Return to your body if you want to be revived!</span> (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("<span class='notice'>[user] places [src] on [M.name]'s chest.</span>", "<span class='warning'>You place [src] on [M.name]'s chest.</span>")
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, "<span class='ghostalert'>Your heart is being defibrillated. Return to your body if you want to be revived!</span> (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))