From bd07ff4bf70c45742b272a8434717897f4868f23 Mon Sep 17 00:00:00 2001 From: Thalpy <48600475+ThalpySci@users.noreply.github.com> Date: Thu, 21 Nov 2019 18:55:43 +0000 Subject: [PATCH] This should be the one! --- code/game/objects/items/devices/scanners.dm | 2 +- code/modules/surgery/advanced/revival.dm | 3 + .../emergency_cardioversion_recovery.dm | 78 ++++++++++--------- code/modules/surgery/organs/organ_internal.dm | 7 ++ 4 files changed, 52 insertions(+), 38 deletions(-) diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 33ecfa9e37..c07c52b075 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -314,7 +314,7 @@ SLIME SCANNER damage_message += " Acute [O.name] failure detected." if(temp_message || damage_message) - msg += "[uppertext(O.name)]: [damage_message] [temp_message]\n" + msg += "[uppertext(O.name)]: [damage_message] [temp_message]\n" diff --git a/code/modules/surgery/advanced/revival.dm b/code/modules/surgery/advanced/revival.dm index a2d5345ea4..fbfec404b2 100644 --- a/code/modules/surgery/advanced/revival.dm +++ b/code/modules/surgery/advanced/revival.dm @@ -65,6 +65,9 @@ target.visible_message("...[target] wakes up, alive and aware!") target.emote("gasp") target.adjustOrganLoss(ORGAN_SLOT_BRAIN, 50, 199) //MAD SCIENCE + for(var/obj/item/organ/O in target.internal_organs)//zap those buggers back to life! + if(O.organ_flags & ORGAN_FAILING) + O.applyOrganDamage(-5) return TRUE else user.visible_message("...[target.p_they()] convulses, then lies still.") diff --git a/code/modules/surgery/emergency_cardioversion_recovery.dm b/code/modules/surgery/emergency_cardioversion_recovery.dm index f0540e78c0..284722d271 100644 --- a/code/modules/surgery/emergency_cardioversion_recovery.dm +++ b/code/modules/surgery/emergency_cardioversion_recovery.dm @@ -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, "You begin to apply an electrical charge directly to the heart body...", - "[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, "You need to wield the paddles in both hands before you can use them!") + return FALSE + display_results(user, target, "You begin to apply the [tool] onto the heart directly...", + "[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 @@ "[user] screws up, causing [H] to flop around violently as they're zapped!", "[user] screws up, causing [H] to flop around violently as they're zapped!") 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, "You induce a stable cardio in [H]'s heart.", - "[H]'s heart is shocked, attemping to bring them back to a stable rhythm!", + display_results(user, target, "You attach the [tool] to [target]'s heart and prepare to pulse.", + "[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, "You move the paddles to the restart position.", - "[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, "You screw up, sending a current through their body!", "[user] screws up, causing [H] to flop around violently as they're zapped!", "[user] screws up, causing [H] to flop around violently as they're zapped!") - 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("[H]'s body convulses a bit.") 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 = "The [src] equipment buzzes: Resuscitation failed - Recovery of patient impossible. Further attempts futile." + failed = "The heart is zapped by the [tool], but nothing happens. You feel like the spark of life has fully left [H]." else if (H.hellbound) - failed = "The [src] equipment buzzes: Resuscitation failed - Patient's soul appears to be on another plane of existence. Further attempts futile." - else if(world.time < (DEFIB_TIME_LIMIT * 10)) - failed = "The [src] equipment buzzes: Resuscitation failed - Body has decayed for too long. Further attempts futile." - else if (!heart) - failed = "The [src] equipment buzzes: Resuscitation failed - Patient's heart is missing." - else if (heart.organ_flags & ORGAN_FAILING) - failed = "The [src] equipment buzzes: Resuscitation failed - Patient's heart too damaged." + failed = "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." + else if(tdelta > (DEFIB_TIME_LIMIT * 10)) + failed = "The heart is zapped by the [tool], but nothing happens. It appears their body has become too decomposed." else if(total_burn >= 180 || total_brute >= 180) - failed = "The [src] equipment buzzes: Resuscitation failed - Severe tissue damage makes recovery of patient impossible via surgery. Further attempts futile." + failed = "The [tool] zaps the heart, inducing a sudden contraction, but it appears [H]'s body is too damaged to revive presently." else if(H.get_ghost()) - failed = "The [src] equipment buzzes: Resuscitation failed - No activity in patient's brain. Further attempts may be successful." + failed = "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." else var/obj/item/organ/brain/BR = H.getorgan(/obj/item/organ/brain) if(BR) - if(BR.organ_flags & ORGAN_FAILING) - failed = "The [src] equipment buzzes: Resuscitation failed - Patient's brain tissue is damaged making recovery of patient impossible via surgery. Further attempts futile." - if(BR.brain_death) - failed = "The [src] equipment buzzes: Resuscitation failed - Patient's brain damaged beyond point of no return. Further attempts futile." if(H.suiciding || BR.brainmob?.suiciding) - failed = "The [src] equipment buzzes: Resuscitation failed - No intelligence pattern can be detected in patient's brain. Further attempts futile." + failed = "The heart is zapped by the [tool], but nothing happens. You feel like the spark of life has fully left [H]." else - failed = "The [src] equipment buzzes: Resuscitation failed - Patient's brain is missing. Further attempts futile." + failed = "The [tool] zaps the heart, restarting the heart, but without a brain the contractions quickly die out." 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("The [src] equipment pings: Resuscitation successful.") + H.visible_message("The [tool] zaps the heart, inducing several contractions before speeding up into a regular rhythm, [H]'s eyes snapping open with a loud gasp!") playsound(src, 'sound/machines/defib_success.ogg', 50, 0) H.set_heartattack(FALSE) H.revive() diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index 45cbda9898..ddd7378008 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -283,6 +283,12 @@ var/has_liver = (!(NOLIVER in dna.species.species_traits)) var/has_stomach = (!(NOSTOMACH in dna.species.species_traits)) + for(var/obj/item/organ/O in internal_organs) + if(O.organ_flags & ORGAN_FAILING) + O.setOrganDamage(0) + if(only_one) + return TRUE + if(has_liver && !getorganslot(ORGAN_SLOT_LIVER)) var/obj/item/organ/liver/LI @@ -373,6 +379,7 @@ if(only_one) return TRUE + /obj/item/organ/random name = "Illegal organ" desc = "Something hecked up"