Files
Bubberstation/code/datums/elements/content_barfer.dm
T
SkyratBot 77de679782 [MIRROR] mob_transformation_simple sends a COMSIG_MOB_CHANGED_TYPE signal, letting content_barfer mobs spit things out [MDB IGNORE] (#23518)
* `mob_transformation_simple` sends a `COMSIG_MOB_CHANGED_TYPE` signal, letting `content_barfer` mobs spit things out (#78093)

## About The Pull Request

Title; also makes bileworm devour message have a warning span.
~~it's a bit cheeky but i didn't want to add a deletion signal to the
content_barfer's signal list, and the wabbajack signal here kinda makes
sense?~~

## Why It's Good For The Game

Fixes #76791

## Changelog

🆑
fix: fixed bileworm evolution deleting anything they devoured; they will
now eject their contents upon evolution to vileworms
/🆑

* `mob_transformation_simple` sends a `COMSIG_MOB_CHANGED_TYPE` signal, letting `content_barfer` mobs spit things out

---------

Co-authored-by: Sealed101 <cool.bullseye@yandex.ru>
2023-09-04 21:28:24 -04:00

28 lines
906 B
Plaintext

/**
* Content Barfer; which expels the contents of a mob when it dies, or is transformed
*
* Used for morphs and bileworms!
*/
/datum/element/content_barfer
argument_hash_start_idx = 2
/datum/element/content_barfer/Attach(datum/target, tally_string)
. = ..()
if(!isliving(target))
return ELEMENT_INCOMPATIBLE
RegisterSignals(target, list(COMSIG_LIVING_DEATH, COMSIG_LIVING_ON_WABBAJACKED, COMSIG_LIVING_UNSHAPESHIFTED, COMSIG_MOB_CHANGED_TYPE), PROC_REF(barf_contents))
/datum/element/content_barfer/Detach(datum/target)
UnregisterSignal(target, list(COMSIG_LIVING_DEATH, COMSIG_LIVING_ON_WABBAJACKED, COMSIG_LIVING_UNSHAPESHIFTED, COMSIG_MOB_CHANGED_TYPE))
return ..()
/datum/element/content_barfer/proc/barf_contents(mob/living/target)
SIGNAL_HANDLER
for(var/atom/movable/barfed_out in target)
barfed_out.forceMove(target.loc)
if(prob(90))
step(barfed_out, pick(GLOB.alldirs))