|
|
|
@@ -11,13 +11,22 @@
|
|
|
|
|
repeatable = TRUE //So you can retry
|
|
|
|
|
|
|
|
|
|
/datum/surgery_step/ventricular_electrotherapy/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
|
|
|
display_results(user, target, "<span class='notice'>You begin to apply an electrical charge directly to the heart body...</span>",
|
|
|
|
|
"[user] begins to make an incision in [target]'s heart.",
|
|
|
|
|
"[user] begins to make an incision in [target]'s heart.")
|
|
|
|
|
if(istype(tool, /obj/item/twohanded/shockpaddles))
|
|
|
|
|
var/obj/item/twohanded/shockpaddles/pads = tool
|
|
|
|
|
if(!pads.wielded)
|
|
|
|
|
to_chat(user, "<span class='warning'>You need to wield the paddles in both hands before you can use them!</span>")
|
|
|
|
|
return FALSE
|
|
|
|
|
display_results(user, target, "<span class='notice'>You begin to apply the [tool] onto the heart directly...</span>",
|
|
|
|
|
"[user] begin to prepare the heart for contact with the [tool].",
|
|
|
|
|
"[user] begin to prepare the heart for contact with the [tool]. ")
|
|
|
|
|
target.notify_ghost_cloning("Your heart is undergoing Emergency Cardioversion Induction Surgery!")
|
|
|
|
|
playsound(src, 'sound/machines/defib_charge.ogg', 75, 0)
|
|
|
|
|
|
|
|
|
|
/datum/surgery_step/ventricular_electrotherapy/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
|
|
|
|
if(istype(tool, /obj/item/twohanded/shockpaddles))
|
|
|
|
|
var/obj/item/twohanded/shockpaddles/pads = tool
|
|
|
|
|
if(!pads.wielded)
|
|
|
|
|
return FALSE
|
|
|
|
|
var/mob/living/carbon/human/H = target
|
|
|
|
|
playsound(src, 'sound/machines/defib_zap.ogg', 75, 1, -1)
|
|
|
|
|
playsound(src, "bodyfall", 50, 1)
|
|
|
|
@@ -26,25 +35,31 @@
|
|
|
|
|
"<span class='warning'>[user] screws up, causing [H] to flop around violently as they're zapped!</span>",
|
|
|
|
|
"<span class='warning'>[user] screws up, causing [H] to flop around violently as they're zapped!</span>")
|
|
|
|
|
H.emote("scream")
|
|
|
|
|
H.electrocute_act(25, (get_turf(H)), 1, FALSE, FALSE, FALSE, TRUE)
|
|
|
|
|
H.electrocute_act(25, (tool), 1, FALSE, FALSE, FALSE, TRUE)
|
|
|
|
|
H.adjustFireLoss(10)
|
|
|
|
|
H.emote("flip")
|
|
|
|
|
H.Jitter(100)
|
|
|
|
|
return FALSE
|
|
|
|
|
display_results(user, target, "<span class='notice'>You induce a stable cardio in [H]'s heart.</span>",
|
|
|
|
|
"[H]'s heart is shocked, attemping to bring them back to a stable rhythm!",
|
|
|
|
|
display_results(user, target, "<span class='notice'>You attach the [tool] to [target]'s heart and prepare to pulse.</span>",
|
|
|
|
|
"[user] attaches the [tool] to [H]'s heart and prepares to pulse.",
|
|
|
|
|
"")
|
|
|
|
|
H.adjustBruteLoss(10)
|
|
|
|
|
H.adjustOrganLoss(ORGAN_SLOT_HEART, -15)
|
|
|
|
|
H.adjustOrganLoss(ORGAN_SLOT_BRAIN, -5)
|
|
|
|
|
H.electrocute_act(0, (get_turf(H)), 1, FALSE, FALSE, FALSE, TRUE)
|
|
|
|
|
var/obj/item/organ/heart = H.getorgan(/obj/item/organ/heart)
|
|
|
|
|
if(heart.organ_flags & ORGAN_FAILING)
|
|
|
|
|
H.adjustOrganLoss(ORGAN_SLOT_HEART, -15)
|
|
|
|
|
var/obj/item/organ/brain/BR = H.getorgan(/obj/item/organ/brain)
|
|
|
|
|
if(BR.organ_flags & ORGAN_FAILING)
|
|
|
|
|
H.adjustOrganLoss(ORGAN_SLOT_BRAIN, -5)
|
|
|
|
|
H.electrocute_act(0, (tool), 1, FALSE, FALSE, FALSE, TRUE)
|
|
|
|
|
//If we're using a defib, let the defib handle the revive.
|
|
|
|
|
if(istype(tool, /obj/item/twohanded/shockpaddles))
|
|
|
|
|
display_results(user, target, "<span class='notice'>You move the paddles to the restart position.</span>",
|
|
|
|
|
"[user] moves the paddles to the restart position...",
|
|
|
|
|
"")
|
|
|
|
|
return TRUE
|
|
|
|
|
if(!do_they_live(H))
|
|
|
|
|
return
|
|
|
|
|
//Otherwise, we're ad hocing it
|
|
|
|
|
if(!(do_after(user, 50, target = target)))
|
|
|
|
|
return FALSE
|
|
|
|
|
if(!ghetto_defib(user, H, tool))
|
|
|
|
|
playsound(src, 'sound/machines/defib_failed.ogg', 50, 0)
|
|
|
|
|
return FALSE
|
|
|
|
|
log_combat(user, H, "revived", "Emergency Cardioversion Induction")
|
|
|
|
|
return TRUE
|
|
|
|
|
|
|
|
|
@@ -55,50 +70,39 @@
|
|
|
|
|
display_results(user, target, "<span class='warning'>You screw up, sending a current through their body!</span>",
|
|
|
|
|
"<span class='warning'>[user] screws up, causing [H] to flop around violently as they're zapped!</span>",
|
|
|
|
|
"<span class='warning'>[user] screws up, causing [H] to flop around violently as they're zapped!</span>")
|
|
|
|
|
H.electrocute_act(25, (get_turf(H)), 1, FALSE, FALSE, FALSE, TRUE)
|
|
|
|
|
H.electrocute_act(25, (tool), 1, FALSE, FALSE, FALSE, TRUE)
|
|
|
|
|
H.adjustFireLoss(5)
|
|
|
|
|
H.emote("flip")
|
|
|
|
|
H.adjustOrganLoss(ORGAN_SLOT_HEART, 10)
|
|
|
|
|
|
|
|
|
|
/datum/surgery_step/ventricular_electrotherapy/proc/do_they_live(mob/living/carbon/human/H)
|
|
|
|
|
|
|
|
|
|
var/obj/item/organ/heart = H.getorgan(/obj/item/organ/heart)
|
|
|
|
|
/datum/surgery_step/ventricular_electrotherapy/proc/ghetto_defib(mob/user, mob/living/carbon/human/H, obj/item/tool)
|
|
|
|
|
H.visible_message("<span class='warning'>[H]'s body convulses a bit.</span>")
|
|
|
|
|
var/total_brute = H.getBruteLoss()
|
|
|
|
|
var/total_burn = H.getFireLoss()
|
|
|
|
|
var/failed
|
|
|
|
|
var/tdelta = round(world.time - H.timeofdeath)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (H.suiciding || (HAS_TRAIT(H, TRAIT_NOCLONE)))
|
|
|
|
|
failed = "<span class='warning'>The [src] equipment buzzes: Resuscitation failed - Recovery of patient impossible. Further attempts futile.</span>"
|
|
|
|
|
failed = "<span class='warning'>The heart is zapped by the [tool], but nothing happens. You feel like the spark of life has fully left [H].</span>"
|
|
|
|
|
else if (H.hellbound)
|
|
|
|
|
failed = "<span class='warning'>The [src] equipment buzzes: Resuscitation failed - Patient's soul appears to be on another plane of existence. Further attempts futile.</span>"
|
|
|
|
|
else if(world.time < (DEFIB_TIME_LIMIT * 10))
|
|
|
|
|
failed = "<span class='warning'>The [src] equipment buzzes: Resuscitation failed - Body has decayed for too long. Further attempts futile.</span>"
|
|
|
|
|
else if (!heart)
|
|
|
|
|
failed = "<span class='warning'>The [src] equipment buzzes: Resuscitation failed - Patient's heart is missing.</span>"
|
|
|
|
|
else if (heart.organ_flags & ORGAN_FAILING)
|
|
|
|
|
failed = "<span class='warning'>The [src] equipment buzzes: Resuscitation failed - Patient's heart too damaged.</span>"
|
|
|
|
|
failed = "<span class='warning'>The heart is zapped by the [tool], but nothing happens. You notice a small tatoo with the words \"Property of Satan\" branded just above the right ventricle.</span>"
|
|
|
|
|
else if(tdelta > (DEFIB_TIME_LIMIT * 10))
|
|
|
|
|
failed = "<span class='warning'>The heart is zapped by the [tool], but nothing happens. It appears their body has become too decomposed.</span>"
|
|
|
|
|
else if(total_burn >= 180 || total_brute >= 180)
|
|
|
|
|
failed = "<span class='warning'>The [src] equipment buzzes: Resuscitation failed - Severe tissue damage makes recovery of patient impossible via surgery. Further attempts futile.</span>"
|
|
|
|
|
failed = "<span class='warning'>The [tool] zaps the heart, inducing a sudden contraction, but it appears [H]'s body is too damaged to revive presently.</span>"
|
|
|
|
|
else if(H.get_ghost())
|
|
|
|
|
failed = "<span class='warning'>The [src] equipment buzzes: Resuscitation failed - No activity in patient's brain. Further attempts may be successful.</span>"
|
|
|
|
|
failed = "<span class='warning'>The [tool] zaps the heart, inducing several contractions before dying down, but there's no spark of life in [H]'s eyes. It may be worth it to try again, however.</span>"
|
|
|
|
|
else
|
|
|
|
|
var/obj/item/organ/brain/BR = H.getorgan(/obj/item/organ/brain)
|
|
|
|
|
if(BR)
|
|
|
|
|
if(BR.organ_flags & ORGAN_FAILING)
|
|
|
|
|
failed = "<span class='warning'>The [src] equipment buzzes: Resuscitation failed - Patient's brain tissue is damaged making recovery of patient impossible via surgery. Further attempts futile.</span>"
|
|
|
|
|
if(BR.brain_death)
|
|
|
|
|
failed = "<span class='warning'>The [src] equipment buzzes: Resuscitation failed - Patient's brain damaged beyond point of no return. Further attempts futile.</span>"
|
|
|
|
|
if(H.suiciding || BR.brainmob?.suiciding)
|
|
|
|
|
failed = "<span class='warning'>The [src] equipment buzzes: Resuscitation failed - No intelligence pattern can be detected in patient's brain. Further attempts futile.</span>"
|
|
|
|
|
failed = "<span class='warning'>The heart is zapped by the [tool], but nothing happens. You feel like the spark of life has fully left [H].</span>"
|
|
|
|
|
else
|
|
|
|
|
failed = "<span class='warning'>The [src] equipment buzzes: Resuscitation failed - Patient's brain is missing. Further attempts futile.</span>"
|
|
|
|
|
failed = "<span class='warning'>The [tool] zaps the heart, restarting the heart, but without a brain the contractions quickly die out.</span>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(failed)
|
|
|
|
|
H.visible_message(failed)
|
|
|
|
|
to_chat(user, failed)
|
|
|
|
|
playsound(src, 'sound/machines/defib_failed.ogg', 50, 0)
|
|
|
|
|
else
|
|
|
|
|
//If the body has been fixed so that they would not be in crit when defibbed, give them oxyloss to put them back into crit
|
|
|
|
@@ -112,7 +116,7 @@
|
|
|
|
|
H.adjustFireLoss((mobhealth - HALFWAYCRITDEATH) * (total_burn / overall_damage), 0)
|
|
|
|
|
H.adjustBruteLoss((mobhealth - HALFWAYCRITDEATH) * (total_brute / overall_damage), 0)
|
|
|
|
|
H.updatehealth() // Previous "adjust" procs don't update health, so we do it manually.
|
|
|
|
|
H.visible_message("<span class='notice'>The [src] equipment pings: Resuscitation successful.</span>")
|
|
|
|
|
H.visible_message("<span class='notice'>The [tool] zaps the heart, inducing several contractions before speeding up into a regular rhythm, [H]'s eyes snapping open with a loud gasp!</span>")
|
|
|
|
|
playsound(src, 'sound/machines/defib_success.ogg', 50, 0)
|
|
|
|
|
H.set_heartattack(FALSE)
|
|
|
|
|
H.revive()
|
|
|
|
|