Skip to content

Commit

Permalink
Fixes colossus possessor crystal cockroaches/animals not dumping the …
Browse files Browse the repository at this point in the history
…user's body upon death/gibbing (tgstation#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 tgstation#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
:cl:
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
/:cl:

---------

Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com>
  • Loading branch information
Sealed101 and Fikou authored Jun 5, 2023
1 parent 9d0093f commit d01b433
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion code/modules/mob/living/basic/vermin/cockroach.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 14 additions & 16 deletions code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ..()
Expand All @@ -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."
Expand Down

0 comments on commit d01b433

Please sign in to comment.