From 806551a91e8252ca0cbeda098572d73f23255a42 Mon Sep 17 00:00:00 2001 From: Erikos Date: Thu, 16 Jan 2025 09:17:22 +0000 Subject: [PATCH 1/6] kinda works --- .../reagents/chemistry/reagents/medicine.dm | 89 +++++++++++-------- 1 file changed, 54 insertions(+), 35 deletions(-) diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index 1c7dfebce304..fee46ca2c4b9 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -969,43 +969,62 @@ if(iscarbon(M)) if(method == REAGENT_INGEST || (method == REAGENT_TOUCH && prob(25))) if(M.stat == DEAD) - if(M.getBruteLoss() + M.getFireLoss() + M.getCloneLoss() >= 150) - if(IS_CHANGELING(M) || HAS_TRAIT(M, TRAIT_I_WANT_BRAINS)) - return - M.delayed_gib(TRUE) - return - if(!M.ghost_can_reenter()) - M.visible_message("[M] twitches slightly, but is otherwise unresponsive!") - return - - if(!M.suiciding && !HAS_TRAIT(M, TRAIT_HUSK) && !HAS_TRAIT(M, TRAIT_BADDNA)) - M.visible_message("[M] seems to rise from the dead!") - M.adjustCloneLoss(50) - M.setOxyLoss(0) - M.adjustBruteLoss(rand(0, 15)) - M.adjustToxLoss(rand(0, 15)) - M.adjustFireLoss(rand(0, 15)) - if(ishuman(M)) - var/mob/living/carbon/human/H = M - var/necrosis_prob = 15 * H.decaylevel - H.decaylevel = 0 - for(var/obj/item/organ/O in (H.bodyparts | H.internal_organs)) - // Per non-vital body part: - // 15% * H.decaylevel (1 to 4) - // Min of 0%, Max of 60% - if(prob(necrosis_prob) && !O.is_robotic() && !O.vital) - // side effects may include: Organ failure - O.necrotize(FALSE) - if(O.status & ORGAN_DEAD) - O.germ_level = INFECTION_LEVEL_THREE - H.update_body() - - M.grab_ghost() - M.update_revive() - add_attack_logs(M, M, "Revived with lazarus reagent") //Yes, the logs say you revived yourself. - SSblackbox.record_feedback("tally", "players_revived", 1, "lazarus_reagent") + var/mob/dead/observer/ghost = M.get_ghost() + M.visible_message("[M]'s body begins to twitch as the Lazarus Reagent takes effect!") + M.do_jitter_animation(200) // Visual feedback of lazarus working. + + if(ghost) + to_chat(ghost, "Lazarus Reagent is attempting to revive your body. Re-enter your body to be revived! (Verbs -> Ghost -> Re-enter corpse)") + window_flash(ghost.client) + SEND_SOUND(ghost, sound('sound/effects/genetics.ogg')) + + addtimer(CALLBACK(src, /datum/reagent/medicine/lazarus_reagent/proc/check_revival, M), 5 SECONDS) // 5 seconds to re-enter body + ..() +/datum/reagent/medicine/lazarus_reagent/proc/check_revival(mob/living/carbon/M) + + var/mob/dead/observer/ghost = M.get_ghost() + + if(ghost) // If the ghost is still outside the body, the revival fails. + M.visible_message("[M]'s body stops twitching as the Lazarus Reagent loses potency.") + return + if(M.suiciding) // Feedback if the player suicided. + M.visible_message("[M] twitches slightly, but appears to have no will to live!") + return + if(HAS_TRAIT(M, TRAIT_HUSK || HAS_TRAIT(M, TRAIT_BADDNA))) // Feedback if the body is husked or has bad DNA. + M.visible_message("[M] twitches slightly, but nothing happens.") + return + if(M.getBruteLoss() + M.getFireLoss() + M.getCloneLoss() >= 150) + if(IS_CHANGELING(M) || HAS_TRAIT(M, TRAIT_I_WANT_BRAINS)) + return + M.delayed_gib(TRUE) + return + + // If the ghost has re-entered the body, perform the revival + M.visible_message("[M] gasps as they return to life!") + M.adjustCloneLoss(50) + M.setOxyLoss(0) + M.adjustBruteLoss(rand(0, 15)) + M.adjustToxLoss(rand(0, 15)) + M.adjustFireLoss(rand(0, 15)) + + if(ishuman(M)) + var/mob/living/carbon/human/H = M + var/necrosis_prob = 15 * H.decaylevel + H.decaylevel = 0 + for(var/obj/item/organ/O in (H.bodyparts | H.internal_organs)) + if(prob(necrosis_prob) && !O.is_robotic() && !O.vital) + O.necrotize(FALSE) + if(O.status & ORGAN_DEAD) + O.germ_level = INFECTION_LEVEL_THREE + H.update_body() + + M.grab_ghost() + M.update_revive() + add_attack_logs(M, M, "Revived with Lazarus Reagent") + SSblackbox.record_feedback("tally", "players_revived", 1, "lazarus_reagent") + /datum/reagent/medicine/sanguine_reagent name = "Sanguine Reagent" id = "sanguine_reagent" From cf60a032ce3f45084fd75b9f523bf587ce0159f5 Mon Sep 17 00:00:00 2001 From: Erikos Date: Thu, 16 Jan 2025 13:39:02 +0000 Subject: [PATCH 2/6] work damn it --- code/modules/reagents/chemistry/reagents/medicine.dm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index fee46ca2c4b9..f86acedfcf28 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -969,16 +969,15 @@ if(iscarbon(M)) if(method == REAGENT_INGEST || (method == REAGENT_TOUCH && prob(25))) if(M.stat == DEAD) - var/mob/dead/observer/ghost = M.get_ghost() M.visible_message("[M]'s body begins to twitch as the Lazarus Reagent takes effect!") M.do_jitter_animation(200) // Visual feedback of lazarus working. - + var/mob/dead/observer/ghost = M.get_ghost() if(ghost) to_chat(ghost, "Lazarus Reagent is attempting to revive your body. Re-enter your body to be revived! (Verbs -> Ghost -> Re-enter corpse)") window_flash(ghost.client) SEND_SOUND(ghost, sound('sound/effects/genetics.ogg')) - addtimer(CALLBACK(src, /datum/reagent/medicine/lazarus_reagent/proc/check_revival, M), 5 SECONDS) // 5 seconds to re-enter body + addtimer(CALLBACK(src, PROC_REF(check_revival), M), 5 SECONDS) // same time as the defib to keep things consistant. ..() @@ -1001,7 +1000,7 @@ M.delayed_gib(TRUE) return - // If the ghost has re-entered the body, perform the revival + // If the ghost has re-entered the body, perform the revival! M.visible_message("[M] gasps as they return to life!") M.adjustCloneLoss(50) M.setOxyLoss(0) From 5853dff657956dfbf3a9a63575c6006d2e6d9f7d Mon Sep 17 00:00:00 2001 From: Erikos Date: Fri, 17 Jan 2025 12:22:00 +0000 Subject: [PATCH 3/6] almost there --- .../modules/mob/living/carbon/carbon_procs.dm | 32 +++++++++++ .../reagents/chemistry/reagents/medicine.dm | 56 ++++--------------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon_procs.dm b/code/modules/mob/living/carbon/carbon_procs.dm index 60219a1527d3..9cfd5e417f41 100644 --- a/code/modules/mob/living/carbon/carbon_procs.dm +++ b/code/modules/mob/living/carbon/carbon_procs.dm @@ -1372,3 +1372,35 @@ so that different stomachs can handle things in different ways VB*/ /// Returns TRUE if a breathing tube is equipped. /mob/living/carbon/proc/can_breathe_tube() return get_organ_slot("breathing_tube") + +/mob/living/carbon/proc/lazrevivial(mob/living/carbon/M) + + var/mob/dead/observer/ghost = M.get_ghost() + + if(ghost) // If the ghost is still outside the body, the revival fails. + M.visible_message("[M]'s body stops twitching as the Lazarus Reagent loses potency.") + return + + // If the ghost has re-entered the body, perform the revival! + M.visible_message("[M] gasps as they return to life!") + M.adjustCloneLoss(50) + M.setOxyLoss(0) + M.adjustBruteLoss(rand(0, 15)) + M.adjustToxLoss(rand(0, 15)) + M.adjustFireLoss(rand(0, 15)) + + if(ishuman(M)) + var/mob/living/carbon/human/H = M + var/necrosis_prob = 15 * H.decaylevel + H.decaylevel = 0 + for(var/obj/item/organ/O in (H.bodyparts | H.internal_organs)) + if(prob(necrosis_prob) && !O.is_robotic() && !O.vital) + O.necrotize(FALSE) + if(O.status & ORGAN_DEAD) + O.germ_level = INFECTION_LEVEL_THREE + H.update_body() + + M.grab_ghost() + M.update_revive() + add_attack_logs(M, M, "Revived with Lazarus Reagent") + SSblackbox.record_feedback("tally", "players_revived", 1, "lazarus_reagent") diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index f86acedfcf28..ad4a1209a6b9 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -969,6 +969,17 @@ if(iscarbon(M)) if(method == REAGENT_INGEST || (method == REAGENT_TOUCH && prob(25))) if(M.stat == DEAD) + if(M.suiciding) // Feedback if the player suicided. + M.visible_message("[M] twitches slightly, but appears to have no will to live!") + return + if(HAS_TRAIT(M, TRAIT_HUSK || HAS_TRAIT(M, TRAIT_BADDNA))) // Feedback if the body is husked or has bad DNA. + M.visible_message("[M] twitches slightly, but nothing happens.") + return + if(M.getBruteLoss() + M.getFireLoss() + M.getCloneLoss() >= 150) + if(IS_CHANGELING(M) || HAS_TRAIT(M, TRAIT_I_WANT_BRAINS)) + return + M.delayed_gib(TRUE) + return M.visible_message("[M]'s body begins to twitch as the Lazarus Reagent takes effect!") M.do_jitter_animation(200) // Visual feedback of lazarus working. var/mob/dead/observer/ghost = M.get_ghost() @@ -977,53 +988,10 @@ window_flash(ghost.client) SEND_SOUND(ghost, sound('sound/effects/genetics.ogg')) - addtimer(CALLBACK(src, PROC_REF(check_revival), M), 5 SECONDS) // same time as the defib to keep things consistant. + addtimer(CALLBACK(M, TYPE_PROC_REF(/mob/living/carbon, lazrevivial), M), 5 SECONDS) // same time as the defib to keep things consistant. ..() -/datum/reagent/medicine/lazarus_reagent/proc/check_revival(mob/living/carbon/M) - - var/mob/dead/observer/ghost = M.get_ghost() - - if(ghost) // If the ghost is still outside the body, the revival fails. - M.visible_message("[M]'s body stops twitching as the Lazarus Reagent loses potency.") - return - if(M.suiciding) // Feedback if the player suicided. - M.visible_message("[M] twitches slightly, but appears to have no will to live!") - return - if(HAS_TRAIT(M, TRAIT_HUSK || HAS_TRAIT(M, TRAIT_BADDNA))) // Feedback if the body is husked or has bad DNA. - M.visible_message("[M] twitches slightly, but nothing happens.") - return - if(M.getBruteLoss() + M.getFireLoss() + M.getCloneLoss() >= 150) - if(IS_CHANGELING(M) || HAS_TRAIT(M, TRAIT_I_WANT_BRAINS)) - return - M.delayed_gib(TRUE) - return - - // If the ghost has re-entered the body, perform the revival! - M.visible_message("[M] gasps as they return to life!") - M.adjustCloneLoss(50) - M.setOxyLoss(0) - M.adjustBruteLoss(rand(0, 15)) - M.adjustToxLoss(rand(0, 15)) - M.adjustFireLoss(rand(0, 15)) - - if(ishuman(M)) - var/mob/living/carbon/human/H = M - var/necrosis_prob = 15 * H.decaylevel - H.decaylevel = 0 - for(var/obj/item/organ/O in (H.bodyparts | H.internal_organs)) - if(prob(necrosis_prob) && !O.is_robotic() && !O.vital) - O.necrotize(FALSE) - if(O.status & ORGAN_DEAD) - O.germ_level = INFECTION_LEVEL_THREE - H.update_body() - - M.grab_ghost() - M.update_revive() - add_attack_logs(M, M, "Revived with Lazarus Reagent") - SSblackbox.record_feedback("tally", "players_revived", 1, "lazarus_reagent") - /datum/reagent/medicine/sanguine_reagent name = "Sanguine Reagent" id = "sanguine_reagent" From ec94db85d71c1b4fdcc36fcb504d65842f0e3ced Mon Sep 17 00:00:00 2001 From: Erikos Date: Fri, 17 Jan 2025 12:50:38 +0000 Subject: [PATCH 4/6] let there be life --- code/modules/mob/living/carbon/carbon_procs.dm | 6 +++--- .../modules/reagents/chemistry/reagents/medicine.dm | 13 ++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon_procs.dm b/code/modules/mob/living/carbon/carbon_procs.dm index 9cfd5e417f41..91b8c8541965 100644 --- a/code/modules/mob/living/carbon/carbon_procs.dm +++ b/code/modules/mob/living/carbon/carbon_procs.dm @@ -1373,11 +1373,11 @@ so that different stomachs can handle things in different ways VB*/ /mob/living/carbon/proc/can_breathe_tube() return get_organ_slot("breathing_tube") -/mob/living/carbon/proc/lazrevivial(mob/living/carbon/M) +/mob/living/carbon/proc/lazrevival(mob/living/carbon/M, mob/dead/observer/G) - var/mob/dead/observer/ghost = M.get_ghost() + G = M.get_ghost() // Get the ghost again to see if it has returned to the body. - if(ghost) // If the ghost is still outside the body, the revival fails. + if(G) // ghosted after the timer expires. M.visible_message("[M]'s body stops twitching as the Lazarus Reagent loses potency.") return diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index ad4a1209a6b9..5a4e8ee0ba7c 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -982,13 +982,12 @@ return M.visible_message("[M]'s body begins to twitch as the Lazarus Reagent takes effect!") M.do_jitter_animation(200) // Visual feedback of lazarus working. - var/mob/dead/observer/ghost = M.get_ghost() - if(ghost) - to_chat(ghost, "Lazarus Reagent is attempting to revive your body. Re-enter your body to be revived! (Verbs -> Ghost -> Re-enter corpse)") - window_flash(ghost.client) - SEND_SOUND(ghost, sound('sound/effects/genetics.ogg')) - - addtimer(CALLBACK(M, TYPE_PROC_REF(/mob/living/carbon, lazrevivial), M), 5 SECONDS) // same time as the defib to keep things consistant. + var/mob/dead/observer/G = M.get_ghost() + if(G) + to_chat(G, "Lazarus Reagent is attempting to revive your body. Re-enter your body to be revived! (Verbs -> Ghost -> Re-enter corpse)") + window_flash(G.client) + SEND_SOUND(G, sound('sound/effects/genetics.ogg')) + addtimer(CALLBACK(M, TYPE_PROC_REF(/mob/living/carbon, lazrevival), M, G), 5 SECONDS) // same time as the defib to keep things consistant. ..() From dfb0a0a3d72cab7cd79cfcdc43842fbb5d38d144 Mon Sep 17 00:00:00 2001 From: Erikos Date: Fri, 17 Jan 2025 12:58:15 +0000 Subject: [PATCH 5/6] small changes --- code/modules/mob/living/carbon/carbon_procs.dm | 1 + code/modules/reagents/chemistry/reagents/medicine.dm | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon_procs.dm b/code/modules/mob/living/carbon/carbon_procs.dm index 91b8c8541965..64c14f8b548b 100644 --- a/code/modules/mob/living/carbon/carbon_procs.dm +++ b/code/modules/mob/living/carbon/carbon_procs.dm @@ -1388,6 +1388,7 @@ so that different stomachs can handle things in different ways VB*/ M.adjustBruteLoss(rand(0, 15)) M.adjustToxLoss(rand(0, 15)) M.adjustFireLoss(rand(0, 15)) + M.do_jitter_animation(200) if(ishuman(M)) var/mob/living/carbon/human/H = M diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index 5a4e8ee0ba7c..94b8b847412d 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -973,15 +973,16 @@ M.visible_message("[M] twitches slightly, but appears to have no will to live!") return if(HAS_TRAIT(M, TRAIT_HUSK || HAS_TRAIT(M, TRAIT_BADDNA))) // Feedback if the body is husked or has bad DNA. - M.visible_message("[M] twitches slightly, but nothing happens.") + M.visible_message("[M] twitches slightly, but is otherwise unresponsive!") return if(M.getBruteLoss() + M.getFireLoss() + M.getCloneLoss() >= 150) - if(IS_CHANGELING(M) || HAS_TRAIT(M, TRAIT_I_WANT_BRAINS)) + if(IS_CHANGELING(M) || HAS_TRAIT(M, TRAIT_I_WANT_BRAINS || !M.ghost_can_reenter())) + M.visible_message("[M] twitches slightly, but nothing happens.") return M.delayed_gib(TRUE) return M.visible_message("[M]'s body begins to twitch as the Lazarus Reagent takes effect!") - M.do_jitter_animation(200) // Visual feedback of lazarus working. + M.do_jitter_animation(300) // Visual feedback of lazarus working. var/mob/dead/observer/G = M.get_ghost() if(G) to_chat(G, "Lazarus Reagent is attempting to revive your body. Re-enter your body to be revived! (Verbs -> Ghost -> Re-enter corpse)") From 2bc06a4ec3507601f7ae6b822e731fa999d18a38 Mon Sep 17 00:00:00 2001 From: Erikos Date: Sat, 18 Jan 2025 00:50:46 +0000 Subject: [PATCH 6/6] Recommended changes (Thanks CinnamonSnowball!) --- code/modules/mob/living/carbon/carbon_procs.dm | 7 ++----- code/modules/reagents/chemistry/reagents/medicine.dm | 6 +++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon_procs.dm b/code/modules/mob/living/carbon/carbon_procs.dm index 64c14f8b548b..0c348fac5e55 100644 --- a/code/modules/mob/living/carbon/carbon_procs.dm +++ b/code/modules/mob/living/carbon/carbon_procs.dm @@ -1373,11 +1373,8 @@ so that different stomachs can handle things in different ways VB*/ /mob/living/carbon/proc/can_breathe_tube() return get_organ_slot("breathing_tube") -/mob/living/carbon/proc/lazrevival(mob/living/carbon/M, mob/dead/observer/G) - - G = M.get_ghost() // Get the ghost again to see if it has returned to the body. - - if(G) // ghosted after the timer expires. +/mob/living/carbon/proc/lazrevival(mob/living/carbon/M) + if(M.get_ghost()) // ghosted after the timer expires. M.visible_message("[M]'s body stops twitching as the Lazarus Reagent loses potency.") return diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index 94b8b847412d..8c166fc97695 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -972,11 +972,11 @@ if(M.suiciding) // Feedback if the player suicided. M.visible_message("[M] twitches slightly, but appears to have no will to live!") return - if(HAS_TRAIT(M, TRAIT_HUSK || HAS_TRAIT(M, TRAIT_BADDNA))) // Feedback if the body is husked or has bad DNA. + if(HAS_TRAIT(M, TRAIT_HUSK) || HAS_TRAIT(M, TRAIT_BADDNA)) // Feedback if the body is husked or has bad DNA. M.visible_message("[M] twitches slightly, but is otherwise unresponsive!") return if(M.getBruteLoss() + M.getFireLoss() + M.getCloneLoss() >= 150) - if(IS_CHANGELING(M) || HAS_TRAIT(M, TRAIT_I_WANT_BRAINS || !M.ghost_can_reenter())) + if(IS_CHANGELING(M) || HAS_TRAIT(M, TRAIT_I_WANT_BRAINS) || !M.ghost_can_reenter()) M.visible_message("[M] twitches slightly, but nothing happens.") return M.delayed_gib(TRUE) @@ -988,7 +988,7 @@ to_chat(G, "Lazarus Reagent is attempting to revive your body. Re-enter your body to be revived! (Verbs -> Ghost -> Re-enter corpse)") window_flash(G.client) SEND_SOUND(G, sound('sound/effects/genetics.ogg')) - addtimer(CALLBACK(M, TYPE_PROC_REF(/mob/living/carbon, lazrevival), M, G), 5 SECONDS) // same time as the defib to keep things consistant. + addtimer(CALLBACK(M, TYPE_PROC_REF(/mob/living/carbon, lazrevival), M), 5 SECONDS) // same time as the defib to keep things consistant. ..()