Aura-Trigger Effects
Aura-triggered effects fire on a timer rather than a signal. The effect engine maintains a dedicated _auras list of every registered effect whose trigger type is aura. Each frame, EffectEngine.tick(dt, game, ship, world) walks that list and accumulates inst.timerAccum += dt on each instance. When timerAccum reaches inst.def.trigger.auraInterval (default 0.5 seconds), the timer resets and the aura re-evaluates its conditions.
State transitions
Each tick interval, conditions are re-evaluated and the instance can be in one of four states based on the prior auraActive flag and the current conditionsPass result:
- false → true (
conditionsPass && !auraActive) — actions run, which typically register modifiers tagged with the effect’s owner.auraActiveis set totrue. - true → false (
!conditionsPass && auraActive) —_removeAuraModifiers(inst)strips every modifier matchingsource === inst.ownerfrom the ship.auraActiveflips back tofalse. - true → true (
conditionsPass && auraActive) — modifiers are removed and re-applied so that any scaled-stat actions (modify_stat_scaled) recompute against fresh game state. - false → false — no-op.
The remove-then-reapply pattern in the steady-true state is what keeps stacking auras correct when their inputs (e.g. nearby-enemy count) change between ticks.
Uses
Auras drive every effect whose payoff is conditional on the live world state rather than a discrete event. Proximity-based artifacts such as Frenzy and Personal Space are the canonical examples: the condition tests “enemies within radius” each tick, the action stacks damage or speed modifiers while true, and those modifiers vanish the moment the player breaks contact. Anything you want to be “on while X, off otherwise” lives here.