Files
Bubberstation/code/datums/elements/content_barfer.dm
SkyratBot d56ee7630e [MIRROR] Kills /obj/shapeshift_holder, replaces it with /datum/status_effect/shapechange_mob, also does a lot of Wabbajack refactoring [MDB IGNORE] (#15988)
* Kills `/obj/shapeshift_holder`, replaces it with `/datum/status_effect/shapechange_mob`, also does a lot of Wabbajack refactoring

* Apply suggestions from code review

* fix

* unironically the best solution

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
Co-authored-by: John Doe <gamingskeleton3@gmail.com>
2022-09-15 22:29:56 -07:00

29 lines
812 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_ON_WABBAJACKED), .proc/barf_contents)
/datum/element/content_barfer/Detach(datum/target)
UnregisterSignal(target, list(COMSIG_LIVING_DEATH, COMSIG_LIVING_ON_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))