Files
Aurora.3/code/modules/effects/effect_system.dm
Lohikar f544fe43b1 Processor-driven effects system & Minor Lighting Performance Tweaks (#1697)
Adds a new process-based effects system with the goal of reducing insane lag from sparks.
Currently only supports sparks, but should be easily extendable to other types of effects.
Also fixes a bug with airlocks where the light from bolts wasn't updating.

Refactors bears slightly to reduce duplicated code & pointless spark object creation and destruction.
Lighting profiler will now log /turf locations & names correctly.
Doors will no longer trigger way more visibility checks than they need to.
2017-02-04 03:34:13 +02:00

28 lines
721 B
Plaintext

// -- Effect System --
// The base type for the new processor-driven effect system.
/datum/effect_system
var/atom/movable/holder // The object this effect is attached to. If this is set, the effect will not be qdel()'d at end of processing.
/datum/effect_system/New(var/queue = TRUE)
. = ..()
if (queue)
src.queue()
/datum/effect_system/Destroy()
if (holder)
holder = null
..()
// Queues an effect.
/datum/effect_system/proc/queue()
if (effect_master)
effect_master.queue(src)
return TRUE
return FALSE
/datum/effect_system/proc/process()
return holder ? EFFECT_HALT : EFFECT_DESTROY // Terminate effect if it's not attached to something.
/datum/effect_system/proc/bind(var/target)
holder = target