diff --git a/__DEFINES/role_datums_defines.dm b/__DEFINES/role_datums_defines.dm
index 4453843260b..f7891867b5c 100644
--- a/__DEFINES/role_datums_defines.dm
+++ b/__DEFINES/role_datums_defines.dm
@@ -171,6 +171,7 @@
#define MAX_TALISMAN_PER_TOME 5
#define SACRIFICE_CHANGE_COOLDOWN 30 MINUTES
+#define DEATH_SHADEOUT_TIMER 60 SECONDS
#define CONVERSION_REFUSE -1
#define CONVERSION_NOCHOICE 0
diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm
index 4a17aa6caab..9b620ea0e5b 100644
--- a/code/modules/mob/dead/observer/observer.dm
+++ b/code/modules/mob/dead/observer/observer.dm
@@ -424,7 +424,12 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
set name = "Ghost"
set desc = "Relinquish your life and enter the land of the dead."
- if(iscultist(src) && (ishuman(src)||isconstruct(src)||istype(src,/mob/living/carbon/complex/gondola)) && veil_thickness > CULT_PROLOGUE)
+ var/timetocheck = timeofdeath
+ if (isbrain(src))
+ var/mob/living/carbon/brain/brainmob = src
+ timetocheck = brainmob.timeofhostdeath
+
+ if(iscultist(src) && (ishuman(src)||isconstruct(src)||isbrain(src)||istype(src,/mob/living/carbon/complex/gondola)) && veil_thickness > CULT_PROLOGUE && (timetocheck == 0 || timetocheck >= world.time - DEATH_SHADEOUT_TIMER))
var/response = alert(src, "It doesn't have to end here, the veil is thin and the dark energies in you soul cling to this plane. You may forsake this body and materialize as a Shade.","Sacrifice Body","Shade","Ghost","Stay in body")
switch (response)
if ("Shade")
diff --git a/code/modules/mob/living/carbon/brain/MMI.dm b/code/modules/mob/living/carbon/brain/MMI.dm
index 50038cbcc2c..3d34f4cd0fb 100644
--- a/code/modules/mob/living/carbon/brain/MMI.dm
+++ b/code/modules/mob/living/carbon/brain/MMI.dm
@@ -197,6 +197,14 @@ obj/item/device/mmi/Destroy()
brainmob.dna = H.dna.Clone()
brainmob.container = src
+ if (isbrain(H))
+ var/mob/living/carbon/brain/otherbrain = H
+ brainmob.timeofhostdeath = otherbrain.timeofhostdeath
+ else if (H.timeofdeath == 0)//happens when the human gets decapitated while still alive
+ brainmob.timeofhostdeath = world.time
+ else
+ brainmob.timeofhostdeath = H.timeofdeath
+
name = "Man-Machine Interface: [brainmob.real_name]"
icon_state = "mmi_full"
locked = 1
diff --git a/code/modules/mob/living/carbon/brain/brain_item.dm b/code/modules/mob/living/carbon/brain/brain_item.dm
index d3120b3bf0c..f9429afac2b 100644
--- a/code/modules/mob/living/carbon/brain/brain_item.dm
+++ b/code/modules/mob/living/carbon/brain/brain_item.dm
@@ -32,7 +32,15 @@
brainmob.real_name = H.real_name
if(istype(H) && H.dna)
brainmob.dna = H.dna.Clone()
- brainmob.timeofhostdeath = H.timeofdeath
+
+ if (isbrain(H))
+ var/mob/living/carbon/brain/otherbrain = H
+ brainmob.timeofhostdeath = otherbrain.timeofhostdeath
+ else if (H.timeofdeath == 0)//happens when the human gets decapitated while still alive
+ brainmob.timeofhostdeath = world.time
+ else
+ brainmob.timeofhostdeath = H.timeofdeath
+
if(H.mind)
H.mind.transfer_to(brainmob)
diff --git a/code/modules/mob/living/carbon/brain/death.dm b/code/modules/mob/living/carbon/brain/death.dm
index 396f0ff0058..0133bfe22fe 100644
--- a/code/modules/mob/living/carbon/brain/death.dm
+++ b/code/modules/mob/living/carbon/brain/death.dm
@@ -16,6 +16,69 @@
return ..(gibbed)
+/mob/living/carbon/brain/death(gibbed)
+ if(stat == DEAD)
+ return
+ if(!gibbed && container && istype(container, /obj/item/device/mmi))//If not gibbed but in a container.
+ container.OnMobDeath(src)
+
+ stat = DEAD
+
+ change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
+ see_in_dark = 8
+ see_invisible = SEE_INVISIBLE_LEVEL_TWO
+
+ tod = worldtime2text() //weasellos time of death patch
+ if(mind)
+ mind.store_memory("Time of death: [tod]", 0) //mind. ?
+
+ return ..(gibbed)
+
+/mob/living/carbon/brain/dust()
+ var/turf/T = get_turf(loc)
+ if(T && client && iscultist(src) && veil_thickness > CULT_PROLOGUE && timeofhostdeath >= world.time - DEATH_SHADEOUT_TIMER)
+ var/obj/item/organ/internal/brain/B
+ var/obj/item/organ/external/head/H
+ var/obj/item/device/mmi/M
+
+ if (loc && istype(loc,/obj/item/device/mmi))
+ M = loc
+ else if (loc && istype(loc,/obj/item/organ/external/head))
+ H = loc
+ else if(loc && istype(loc,/obj/item/organ/internal/brain))
+ B = loc
+ if (B.loc && istype(B.loc,/obj/item/organ/external/head))
+ H = B.loc
+
+ //Spawning our shade and transfering the mind
+ var/mob/living/simple_animal/shade/shade = new (T)
+ playsound(T, 'sound/hallucinations/growl1.ogg', 50, 1)
+ shade.name = "[real_name] the Shade"
+ shade.real_name = "[real_name]"
+ mind.transfer_to(shade)
+ update_faction_icons()
+ to_chat(shade, "Dark energies rip your dying body appart, anchoring your soul inside the form of a Shade. You retain your memories, and devotion to the cult.")
+
+ //Spawning a skull, or just ashes if there was only a brain
+ if (H)
+ new/obj/item/weapon/skull(T)
+ else if (B || M)
+ new /obj/effect/decal/cleanable/ash(T)
+
+ //Getting rid of the brain/head objects
+ if (B)
+ qdel(B)
+ if (H)
+ qdel(H)
+ if (M)
+ M.icon_state = "mmi_empty"
+ M.name = "\improper Man-Machine Interface"
+
+ //Finally getting rid of the brainmob itself
+ qdel(src)
+ else
+ ..()
+
/mob/living/carbon/brain/gib(animation = FALSE, meat = TRUE)
death(1)
monkeyizing = 1
diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm
index 6cccf44068c..74703448a27 100644
--- a/code/modules/mob/living/carbon/human/death.dm
+++ b/code/modules/mob/living/carbon/human/death.dm
@@ -60,7 +60,7 @@
L.client.images -= pathogen
pathogen = null
- if(client && iscultist(src) && veil_thickness > CULT_PROLOGUE)
+ if(client && iscultist(src) && veil_thickness > CULT_PROLOGUE && (timeofdeath == 0 || timeofdeath >= world.time - DEATH_SHADEOUT_TIMER))
var/turf/T = get_turf(src)
if (T)
var/mob/living/simple_animal/shade/shade = new (T)
diff --git a/code/modules/mob/living/simple_animal/shade.dm b/code/modules/mob/living/simple_animal/shade.dm
index 8688454c1a1..5fb9ba55fd8 100644
--- a/code/modules/mob/living/simple_animal/shade.dm
+++ b/code/modules/mob/living/simple_animal/shade.dm
@@ -30,6 +30,7 @@
flying = TRUE
meat_type = /obj/item/weapon/ectoplasm
mob_property_flags = MOB_SUPERNATURAL
+ var/space_damage_warned = FALSE
/mob/living/simple_animal/shade/New()
..()
@@ -98,7 +99,13 @@
SB.blood++//no cap on blood regen when held by a cultist, no blood regen when held by a non-cultist (but there's a spell to take care of that)
else if (SB.blood < SB.maxregenblood)
SB.blood++
-
+ else
+ var/turf/T = get_turf(src)
+ if (istype(T,/turf/space))
+ if (!space_damage_warned)
+ space_damage_warned = TRUE
+ to_chat(src,"Your ghostly form suffers from the star's radiations. Remaining in space will slowly erase you.")
+ adjustBruteLoss(1)
/mob/living/simple_animal/shade/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri
user.delayNextAttack(8)
diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm
index e86496439ca..78ab30a3625 100644
--- a/code/modules/organs/organ_external.dm
+++ b/code/modules/organs/organ_external.dm
@@ -766,16 +766,6 @@ Note that amputating the affected organ does in fact remove the infection from t
if(body_part == (UPPER_TORSO || LOWER_TORSO)) //We can't lose either, those cannot be amputated and will cause extremely serious problems
return
- if(body_part == HEAD && iscultist(owner) && veil_thickness > CULT_PROLOGUE)
- //spawning a skull where the head would have been
- var/obj/item/weapon/skull/sk = new (get_turf(owner))
- var/randomdir = pick(cardinal)
- step(sk, randomdir)
- //turning the body into skull-less remains, the dusting will take care of the shade's creation.
- status |= ORGAN_DESTROYED
- owner.dust(TRUE)
- return
-
var/datum/species/species = src.species || owner.species
var/obj/item/organ/external/organ //Dropped limb object
@@ -1823,7 +1813,7 @@ obj/item/organ/external/head/New(loc, mob/living/carbon/human/H)
hair.Blend(icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_acc"), ICON_OVERLAY)
overlays.Add(hair) //icon.Blend(hair, ICON_OVERLAY)
- spawn(5)
+
if(brainmob && brainmob.client)
brainmob.client.screen.len = null //clear the hud
@@ -1861,6 +1851,15 @@ obj/item/organ/external/head/proc/transfer_identity(var/mob/living/carbon/human/
brainmob.name = H.real_name
brainmob.real_name = H.real_name
brainmob.dna = H.dna.Clone()
+
+ if (isbrain(H))
+ var/mob/living/carbon/brain/otherbrain = H
+ brainmob.timeofhostdeath = otherbrain.timeofhostdeath
+ else if (H.timeofdeath == 0)//happens when the human gets decapitated while still alive
+ brainmob.timeofhostdeath = world.time
+ else
+ brainmob.timeofhostdeath = H.timeofdeath
+
if(H.mind)
H.mind.transfer_to(brainmob)
brainmob.languages = H.languages
diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm
index 242da2f2fb7..13b0283adfe 100644
--- a/code/modules/reagents/Chemistry-Reagents.dm
+++ b/code/modules/reagents/Chemistry-Reagents.dm
@@ -1104,8 +1104,8 @@
..()
if(volume >= 5)
- if(istype(M,/mob/living/simple_animal/construct))
- var/mob/living/simple_animal/construct/C = M
+ if(istype(M,/mob/living/simple_animal/construct) || istype(M,/mob/living/simple_animal/shade))
+ var/mob/living/simple_animal/C = M
C.purge = 3
C.adjustBruteLoss(5)
C.visible_message("The holy water erodes \the [src].")