mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-23 00:22:12 +00:00
* My heart is dragging me down into... ...oblivion! * drifting closer to the edge but she won't have me * ever round me we are dead before we meet her * for the last time * wake up in sweat * n * fff * uff --------- Co-authored-by: Matt Atlas <liermattia@gmail.com>
81 lines
2.1 KiB
Plaintext
81 lines
2.1 KiB
Plaintext
SUBSYSTEM_DEF(effects)
|
|
name = "Effects Master"
|
|
wait = 1 // Deciseconds.
|
|
flags = SS_NO_INIT
|
|
priority = SS_PRIORITY_EFFECTS
|
|
|
|
var/list/datum/effect_system/effect_systems = list() // The effect-spawning objects. Shouldn't be many of these.
|
|
var/list/obj/effect/visual/visuals = list() // The visible component of an effect. May be created without an effect object.
|
|
|
|
var/tmp/list/processing_effects = list()
|
|
var/tmp/list/processing_visuals = list()
|
|
|
|
/datum/controller/subsystem/effects/fire(resumed = FALSE)
|
|
if (!resumed)
|
|
processing_effects = effect_systems
|
|
effect_systems = list()
|
|
processing_visuals = visuals.Copy()
|
|
|
|
var/list/current_effects = processing_effects
|
|
var/list/current_visuals = processing_visuals
|
|
|
|
// Most of the time these only exist for 1 cycle, so optimize for removal-on-first-fire.
|
|
while (current_effects.len)
|
|
var/datum/effect_system/E = current_effects[current_effects.len]
|
|
current_effects.len--
|
|
|
|
if (QDELETED(E) || !E.isprocessing)
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
continue
|
|
|
|
STOP_EFFECT(E)
|
|
var/last = E.last_fire
|
|
E.last_fire = world.time
|
|
switch (E.process(world.time - last))
|
|
if (EFFECT_CONTINUE)
|
|
QUEUE_EFFECT(E)
|
|
|
|
if (EFFECT_DESTROY)
|
|
qdel(E)
|
|
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
|
|
// Most often these will be continuing to tick, so assume that we're going to keep poking the effect.
|
|
while (current_visuals.len)
|
|
var/obj/effect/visual/V = current_visuals[current_visuals.len]
|
|
current_visuals.len--
|
|
|
|
if (QDELETED(V) || !V.isprocessing)
|
|
visuals -= V
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
continue
|
|
|
|
switch (V.tick())
|
|
if (EFFECT_HALT)
|
|
STOP_VISUAL(V)
|
|
|
|
if (EFFECT_DESTROY)
|
|
STOP_VISUAL(V)
|
|
qdel(V)
|
|
|
|
if (MC_TICK_CHECK)
|
|
return
|
|
|
|
/datum/controller/subsystem/effects/stat_entry(msg)
|
|
msg = "E:[effect_systems.len] V:[visuals.len]"
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/effects/Recover()
|
|
if (istype(SSeffects))
|
|
src.effect_systems = SSeffects.effect_systems
|
|
src.visuals = SSeffects.visuals
|
|
|
|
src.effect_systems |= SSeffects.processing_effects
|
|
src.visuals |= SSeffects.processing_visuals
|
|
|
|
/datum/effect_system
|
|
var/last_fire
|