Files
Bubberstation/code/datums/elements/content_barfer.dm
SkyratBot bea43365e7 [MIRROR] New Lavaland Monster: Bileworms [MDB IGNORE] (#15423)
* New Lavaland Monster: Bileworms

* Update living.dm

* Update space_dragon.dm

* Update mining_mobs.dm

* Update kinetic_crusher.dm

Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>
Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
2022-08-08 01:50:57 +01:00

29 lines
806 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
element_flags = ELEMENT_DETACH
id_arg_index = 2
/datum/element/content_barfer/Attach(datum/target, tally_string)
. = ..()
if(!isliving(target))
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, list(COMSIG_LIVING_DEATH, COMSIG_LIVING_WABBAJACKED), .proc/barf_contents)
/datum/element/content_barfer/Detach(datum/target)
UnregisterSignal(target, list(COMSIG_LIVING_DEATH, COMSIG_LIVING_WABBAJACKED))
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))