From 023943ff9ed74070bc15a4fbdbeaca423d85ee6c Mon Sep 17 00:00:00 2001
From: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Date: Sat, 18 Feb 2023 12:47:22 -0600
Subject: [PATCH] Fixes ethereal revival not giving traumas (#73484)
## About The Pull Request
All that needed to be done was `revive` be moved to the end of the
chain, as it was responsible for `null`ing the ethereal heart references
/ causing the runtimes.
While I was here, I fixed a few other issues - like, using
`visible_messages` to start the process was not a good idea, as often
you are blind from unconsciousness when that message happens.
## Why It's Good For The Game
Fixes #71630
Downsides are good
## Changelog
:cl: Melbert
fix: Ethereal revival causing traumas again.
/:cl:
---
code/modules/surgery/organs/heart.dm | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/code/modules/surgery/organs/heart.dm b/code/modules/surgery/organs/heart.dm
index e6e6ea03f63..4040767be59 100644
--- a/code/modules/surgery/organs/heart.dm
+++ b/code/modules/surgery/organs/heart.dm
@@ -357,10 +357,9 @@
if(HAS_TRAIT(victim, TRAIT_CANNOT_CRYSTALIZE))
return // no reviving during mafia, or other inconvenient times.
- victim.visible_message(
- span_notice("Crystals start forming around [victim]."),
- span_nicegreen("Crystals start forming around your dead body."),
- )
+ to_chat(victim, span_nicegreen("Crystals start forming around your dead body."))
+ victim.visible_message(span_notice("Crystals start forming around [victim]."), ignored_mobs = victim)
+
ADD_TRAIT(victim, TRAIT_CORPSELOCKED, SPECIES_TRAIT)
crystalize_timer_id = addtimer(CALLBACK(src, PROC_REF(crystalize), victim), CRYSTALIZE_PRE_WAIT_TIME, TIMER_STOPPABLE)
@@ -492,7 +491,7 @@
ethereal_heart.owner.forceMove(get_turf(src))
REMOVE_TRAIT(ethereal_heart.owner, TRAIT_CORPSELOCKED, SPECIES_TRAIT)
deltimer(crystal_heal_timer)
- visible_message(span_notice("The crystals shatters, causing [ethereal_heart.owner] to fall out"))
+ visible_message(span_notice("The crystals shatters, causing [ethereal_heart.owner] to fall out."))
return ..()
/obj/structure/ethereal_crystal/update_overlays()
@@ -503,13 +502,20 @@
. += shine
/obj/structure/ethereal_crystal/proc/heal_ethereal()
- ethereal_heart.owner.revive(HEAL_ALL)
- to_chat(ethereal_heart.owner, span_notice("You burst out of the crystal with vigour... But at a cost."))
var/datum/brain_trauma/picked_trauma
if(prob(10)) //10% chance for a severe trauma
picked_trauma = pick(subtypesof(/datum/brain_trauma/severe))
else
picked_trauma = pick(subtypesof(/datum/brain_trauma/mild))
- ethereal_heart.owner.gain_trauma(picked_trauma, TRAUMA_RESILIENCE_ABSOLUTE)
- playsound(get_turf(ethereal_heart.owner), 'sound/effects/ethereal_revive.ogg', 100)
- qdel(src)
+
+ // revive will regenerate organs, so our heart refence is going to be null'd. Unreliable
+ var/mob/living/carbon/regenerating = ethereal_heart.owner
+
+ playsound(get_turf(regenerating), 'sound/effects/ethereal_revive.ogg', 100)
+ to_chat(regenerating, span_notice("You burst out of the crystal with vigour... But at a cost."))
+ regenerating.gain_trauma(picked_trauma, TRAUMA_RESILIENCE_ABSOLUTE)
+ regenerating.revive(HEAL_ALL)
+ // revive calls fully heal -> deletes the crystal.
+ // this qdeleted check is just for sanity.
+ if(!QDELETED(src))
+ qdel(src)