mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-31 20:11:56 +00:00
- Makes QDELETED use isnull(x) instead of !x, giving about 0.2 to 0.25s of speed. - Make disposal constructs only update icon state rather than go through expensive overlay code. Unfortunately did not have much effect, but is something they should've been doing nonetheless. - Makes RegisterSignal only take signals directly as opposed to allocating a fresh list of signals. Very few consumers actually used this and it costs about 0.4s. Also I think this is just a bad API anyway and that separate procs are important `\bRegisterSignal\((.*)list\(` replaced with `RegisterSignals($1list(`
28 lines
796 B
Plaintext
28 lines
796 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), PROC_REF(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))
|