Fixes colossus possessor crystal cockroaches/animals not dumping the user's body upon death/gibbing (#75843)

## About The Pull Request
Hooks the stasis closet thingamajing into `COMSIG_LIVING_DEATH` instead
of checking the animal's stat on `process()`, which makes possessed
animals properly dump the stasis closet's contents upon death or gibbing
(which is death but cooler).
yeah uh this method is hilarious but it does protect the user's body
quite reliably at least lol

## Why It's Good For The Game
Fixes #75829
also probably makes cockroach death saner in some unreported way, this
`. = ..()` vs `..()` is above my non-existent paygrade but it keeps
popping up from time to time

## Changelog
🆑
fix: gibbing colossus possessor crystal possessed animals will no longer
stick the user's body and their stuff into the shadow realm. the animals
will properly drop your corpse when killed or gibbed
/🆑

---------

Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com>
This commit is contained in:
Sealed101
2023-06-05 12:17:44 -06:00
committed by GitHub
co-authored by Fikou
parent 9d0093f9ca
commit d01b433ab1
2 changed files with 15 additions and 17 deletions
@@ -44,7 +44,7 @@
/mob/living/basic/cockroach/death(gibbed)
if(GLOB.station_was_nuked) //If the nuke is going off, then cockroaches are invincible. Keeps the nuke from killing them, cause cockroaches are immune to nukes.
return
..()
return ..()
/mob/living/basic/cockroach/ex_act() //Explosions are a terrible way to handle a cockroach.
return FALSE
@@ -581,36 +581,28 @@
anchored = TRUE
resistance_flags = FIRE_PROOF | ACID_PROOF | INDESTRUCTIBLE
paint_jobs = null
var/mob/living/simple_animal/holder_animal
/obj/structure/closet/stasis/process()
if(holder_animal)
if(holder_animal.stat == DEAD)
dump_contents()
holder_animal.investigate_log("has been gibbed by [src].", INVESTIGATE_DEATHS)
holder_animal.gib()
return
///The animal the closet (and the user's body) is inside of
var/mob/living/holder_animal
/obj/structure/closet/stasis/Initialize(mapload)
. = ..()
if(isanimal_or_basicmob(loc))
holder_animal = loc
START_PROCESSING(SSobj, src)
RegisterSignal(holder_animal, COMSIG_LIVING_DEATH, PROC_REF(on_holder_animal_death))
/obj/structure/closet/stasis/Entered(atom/movable/arrived, atom/old_loc, list/atom/old_locs)
. = ..()
if(isliving(arrived) && holder_animal)
var/mob/living/L = arrived
L.notransform = 1
ADD_TRAIT(L, TRAIT_MUTE, STASIS_MUTE)
L.status_flags |= GODMODE
L.mind.transfer_to(holder_animal)
var/mob/living/possessor = arrived
possessor.notransform = TRUE
ADD_TRAIT(possessor, TRAIT_MUTE, STASIS_MUTE)
possessor.status_flags |= GODMODE
possessor.mind.transfer_to(holder_animal)
var/datum/action/exit_possession/escape = new(holder_animal)
escape.Grant(holder_animal)
remove_verb(holder_animal, /mob/living/verb/pulled)
/obj/structure/closet/stasis/dump_contents(kill = TRUE)
STOP_PROCESSING(SSobj, src)
for(var/mob/living/possessor in src)
REMOVE_TRAIT(possessor, TRAIT_MUTE, STASIS_MUTE)
possessor.status_flags &= ~GODMODE
@@ -622,6 +614,7 @@
possessor.forceMove(get_turf(holder_animal))
holder_animal.mind.transfer_to(possessor)
possessor.mind.grab_ghost(force = TRUE)
holder_animal.investigate_log("has been gibbed by [src].", INVESTIGATE_DEATHS)
holder_animal.gib()
return ..()
return ..()
@@ -632,6 +625,11 @@
/obj/structure/closet/stasis/ex_act()
return FALSE
///When our host animal dies in any way, we empty the stasis closet out.
/obj/structure/closet/stasis/proc/on_holder_animal_death()
SIGNAL_HANDLER
dump_contents()
/datum/action/exit_possession
name = "Exit Possession"
desc = "Exits the body you are possessing. They will explode violently when this occurs."