From 0275111cc274fbcba6743bcc5d51f7efcdb2ea76 Mon Sep 17 00:00:00 2001 From: HWSensum <121913313+HWSensum@users.noreply.github.com> Date: Mon, 9 Oct 2023 05:51:13 +0300 Subject: [PATCH] Reviver Implant will actually revive people! (#78377) ## About The Pull Request This PR will make reviver implant able to actually revive people. ## Why It's Good For The Game Reviver implant been a mess for a long time. Only thing it had possible is slightly heal you in crit, doing that very slowly. With this PR reviver implant will actually revive you. - You are not gonna be invincible, loosing a head or getting your organs decayed beyond functional state will make revival impossible. - This process will be slow, and even after revival you will have to wait until you are get out of crit state. - Being revived from dead will add an additional 10 minutes to implant coldown. --- .../internal/cyberimp/augments_chest.dm | 60 +++++++++++++++---- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/code/modules/surgery/organs/internal/cyberimp/augments_chest.dm b/code/modules/surgery/organs/internal/cyberimp/augments_chest.dm index 86dacdd98ff..24a3afe47f1 100644 --- a/code/modules/surgery/organs/internal/cyberimp/augments_chest.dm +++ b/code/modules/surgery/organs/internal/cyberimp/augments_chest.dm @@ -52,31 +52,48 @@ slot = ORGAN_SLOT_HEART_AID var/revive_cost = 0 var/reviving = FALSE + /// revival/defibrillation possibility flag that gathered from owner's .can_defib() proc + var/can_defib_owner COOLDOWN_DECLARE(reviver_cooldown) +/obj/item/organ/internal/cyberimp/chest/reviver/on_death(seconds_per_tick, times_fired) + try_heal() // Allowes implant to work even on dead people /obj/item/organ/internal/cyberimp/chest/reviver/on_life(seconds_per_tick, times_fired) + try_heal() + +/obj/item/organ/internal/cyberimp/chest/reviver/proc/try_heal() if(reviving) - switch(owner.stat) - if(UNCONSCIOUS, HARD_CRIT, SOFT_CRIT) - addtimer(CALLBACK(src, PROC_REF(heal)), 3 SECONDS) - else - COOLDOWN_START(src, reviver_cooldown, revive_cost) - reviving = FALSE - to_chat(owner, span_notice("Your reviver implant shuts down and starts recharging. It will be ready again in [DisplayTimeText(revive_cost)].")) + if(owner.stat == CONSCIOUS) + COOLDOWN_START(src, reviver_cooldown, revive_cost) + reviving = FALSE + to_chat(owner, span_notice("Your reviver implant shuts down and starts recharging. It will be ready again in [DisplayTimeText(revive_cost)].")) + else + addtimer(CALLBACK(src, PROC_REF(heal)), 3 SECONDS) return if(!COOLDOWN_FINISHED(src, reviver_cooldown) || HAS_TRAIT(owner, TRAIT_SUICIDED)) return - switch(owner.stat) - if(UNCONSCIOUS, HARD_CRIT) - revive_cost = 0 - reviving = TRUE - to_chat(owner, span_notice("You feel a faint buzzing as your reviver implant starts patching your wounds...")) + if(owner.stat != CONSCIOUS) + revive_cost = 0 + reviving = TRUE + to_chat(owner, span_notice("You feel a faint buzzing as your reviver implant starts patching your wounds...")) /obj/item/organ/internal/cyberimp/chest/reviver/proc/heal() + if(can_defib_owner == DEFIB_POSSIBLE) + revive_dead() + can_defib_owner = null + revive_cost += 10 MINUTES // Additional 10 minutes cooldown after revival. + // this check goes after revive_dead() to delay revival a bit + if(owner.stat == DEAD) + can_defib_owner = owner.can_defib() + if(can_defib_owner == DEFIB_POSSIBLE) + owner.notify_ghost_cloning("You are being revived by [src]!") + owner.grab_ghost() + /// boolean that stands for if PHYSICAL damage being patched + var/body_damage_patched = FALSE var/need_mob_update = FALSE if(owner.getOxyLoss()) need_mob_update += owner.adjustOxyLoss(-5, updating_health = FALSE) @@ -84,15 +101,34 @@ if(owner.getBruteLoss()) need_mob_update += owner.adjustBruteLoss(-2, updating_health = FALSE) revive_cost += 40 + body_damage_patched = TRUE if(owner.getFireLoss()) need_mob_update += owner.adjustFireLoss(-2, updating_health = FALSE) revive_cost += 40 + body_damage_patched = TRUE if(owner.getToxLoss()) need_mob_update += owner.adjustToxLoss(-1, updating_health = FALSE) revive_cost += 40 if(need_mob_update) owner.updatehealth() + if(body_damage_patched && prob(35)) // healing is called every few seconds, not every tick + owner.visible_message(span_warning("[owner]'s body twitches a bit."), span_notice("You feel like something is patching your injured body.")) + + +/obj/item/organ/internal/cyberimp/chest/reviver/proc/revive_dead() + owner.grab_ghost() + + owner.visible_message(span_warning("[owner]'s body convulses a bit.")) + playsound(owner, SFX_BODYFALL, 50, TRUE) + playsound(owner, 'sound/machines/defib_zap.ogg', 75, TRUE, -1) + owner.revive() + owner.emote("gasp") + owner.set_jitter_if_lower(200 SECONDS) + SEND_SIGNAL(owner, COMSIG_LIVING_MINOR_SHOCK) + log_game("[owner] been revived by [src]") + + /obj/item/organ/internal/cyberimp/chest/reviver/emp_act(severity) . = ..() if(!owner || . & EMP_PROTECT_SELF)