Files
Bubberstation/code/datums/elements/content_barfer.dm
T
tralezabandGitHub 0728fb3840 New Lavaland Monster: Bileworms (#68967)
Bileworms are a new lavaland monster, that has unique AI that should prove them.

Instead of moving normally, it periodically burrows underground and resurfaces nearby.
Its attack is an AOE acid spit.
2022-08-05 11:07:34 +02: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))