'Do Not Revive' verb for Ghosts (#15934)

* DNR

* Review things

Bound to be something I missed, but testing all seems to work fine.

* Aliven't
This commit is contained in:
SabreML
2021-05-02 15:42:56 +01:00
committed by GitHub
parent 1167e6441a
commit 6481a50506
6 changed files with 66 additions and 16 deletions
+20 -9
View File
@@ -100,9 +100,9 @@ REAGENT SCANNER
/obj/item/healthanalyzer/attack(mob/living/M, mob/living/user)
if((HAS_TRAIT(user, TRAIT_CLUMSY) || user.getBrainLoss() >= 60) && prob(50))
user.visible_message("<span class='warning'>[user] analyzes the floor's vitals!</span>", "<span class='notice'>You stupidly try to analyze the floor's vitals!</span>")
to_chat(user, "<span class='info'>Analyzing results for The floor:\n\tOverall status: <b>Healthy</b></span>")
to_chat(user, "<span class='info'>Key: <font color='blue'>Suffocation</font>/<font color='green'>Toxin</font>/<font color='#FF8000'>Burn</font>/<font color='red'>Brute</font></span>")
to_chat(user, "<span class='info'>\tDamage specifics: <font color='blue'>0</font>-<font color='green'>0</font>-<font color='#FF8000'>0</font>-<font color='red'>0</font></span>")
to_chat(user, "<span class='info'>Analyzing results for The floor:\n\tOverall status: Healthy</span>")
to_chat(user, "<span class='info'>Key: <font color='blue'>Suffocation</font>/<font color='green'>Toxin</font>/<font color='#FFA500'>Burn</font>/<font color='red'>Brute</font></span>")
to_chat(user, "<span class='info'>\tDamage specifics: <font color='blue'>0</font> - <font color='green'>0</font> - <font color='#FFA500'>0</font> - <font color='red'>0</font></span>")
to_chat(user, "<span class='info'>Body temperature: ???</span>")
return
@@ -130,19 +130,30 @@ REAGENT SCANNER
var/TX = H.getToxLoss() > 50 ? "<b>[H.getToxLoss()]</b>" : H.getToxLoss()
var/BU = H.getFireLoss() > 50 ? "<b>[H.getFireLoss()]</b>" : H.getFireLoss()
var/BR = H.getBruteLoss() > 50 ? "<b>[H.getBruteLoss()]</b>" : H.getBruteLoss()
if(HAS_TRAIT(H, TRAIT_FAKEDEATH))
OX = fake_oxy > 50 ? "<b>[fake_oxy]</b>" : fake_oxy
to_chat(user, "<span class='notice'>Analyzing Results for [H]:\n\t Overall Status: dead</span>")
else
to_chat(user, "<span class='notice'>Analyzing Results for [H]:\n\t Overall Status: [H.stat > 1 ? "dead" : "[H.health]% healthy"]</span>")
var/status = "<font color='red'>Dead</font>" // Dead by default to make it simpler
var/mob/dead/observer/ghost = H.get_ghost(TRUE)
var/DNR = (ghost && !ghost.can_reenter_corpse)
if(H.stat == DEAD)
if(DNR)
status = "<font color='red'>Dead <b>\[DNR]</b></font>"
else // Alive or unconscious
if(HAS_TRAIT(H, TRAIT_FAKEDEATH)) // status still shows as "Dead"
OX = fake_oxy > 50 ? "<b>[fake_oxy]</b>" : fake_oxy
else
status = "[H.health]% Healthy"
to_chat(user, "<span class='notice'>Analyzing Results for [H]:\n\t Overall Status: [status]")
to_chat(user, "\t Key: <font color='blue'>Suffocation</font>/<font color='green'>Toxin</font>/<font color='#FFA500'>Burns</font>/<font color='red'>Brute</font>")
to_chat(user, "\t Damage Specifics: <font color='blue'>[OX]</font> - <font color='green'>[TX]</font> - <font color='#FFA500'>[BU]</font> - <font color='red'>[BR]</font>")
to_chat(user, "<span class='notice'>Body Temperature: [H.bodytemperature-T0C]&deg;C ([H.bodytemperature*1.8-459.67]&deg;F)</span>")
if(H.timeofdeath && (H.stat == DEAD || (HAS_TRAIT(H, TRAIT_FAKEDEATH))))
to_chat(user, "<span class='notice'>Time of Death: [station_time_timestamp("hh:mm:ss", H.timeofdeath)]</span>")
var/tdelta = round(world.time - H.timeofdeath)
if(tdelta < DEFIB_TIME_LIMIT)
if(tdelta < DEFIB_TIME_LIMIT && !DNR)
to_chat(user, "<span class='danger'>Subject died [DisplayTimeText(tdelta)] ago, defibrillation may be possible!</span>")
else
to_chat(user, "<font color='red'>Subject died [DisplayTimeText(tdelta)] ago.</font>")
if(mode == 1)
var/list/damaged = H.get_damaged_organs(1,1)
+8 -5
View File
@@ -363,7 +363,7 @@
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()
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
@@ -446,10 +446,13 @@
else if(total_burn >= 180 || total_brute >= 180)
user.visible_message("<span class='boldnotice'>[defib] buzzes: Resuscitation failed - Severe tissue damage detected.</span>")
else if(ghost)
user.visible_message("<span class='notice'>[defib] buzzes: Resuscitation failed: Patient's brain is unresponsive. Further attempts may succeed.</span>")
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)
ghost << sound('sound/effects/genetics.ogg')
if(!ghost.can_reenter_corpse) // DNR or AntagHUD
user.visible_message("<span class='notice'>[defib] buzzes: Resucitation failed: No electrical brain activity detected.</span>")
else
user.visible_message("<span class='notice'>[defib] buzzes: Resuscitation failed: Patient's brain is unresponsive. Further attempts may succeed.</span>")
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)
ghost << sound('sound/effects/genetics.ogg')
else
user.visible_message("<span class='notice'>[defib] buzzes: Resuscitation failed.</span>")
playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)