EffectPlayer class

Per-entity deterministic effect queue.

Owned by EffectComponent. EffectSystemECS calls advanceTo once per game-loop tick, passing the current absolute tick number. The player computes each effect's relative elapsed count and calls DeterministicEffect.applyTick with (prevElapsed, currElapsed).

Additive stacking

All active effects on the same entity run in registration order every tick. Their component deltas accumulate additively: two overlapping MoveEffects result in a position that is the sum of both displacements.

Fast-forward

If advanceTo is called with a large currentTick jump (e.g. for a reconnecting client catching up), each effect receives a wide (prevElapsed, currElapsed) range. Because DeterministicEffect.applyTick is defined to be equivalent whether called once wide or many times narrow, the result is identical.

Constructors

EffectPlayer()

Properties

activeCount → int
Number of active (non-cancelled) effects in the queue.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
true when the internal entry list is empty (all effects done or none added).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(DeterministicEffect effect, int startTick) → EffectHandle
Enqueue effect to begin at startTick.
advanceTo(int currentTick, EffectContext ctx) → void
Advance all active effects to currentTick.
cancel(EffectHandle handle) → void
Cancel the effect associated with handle.
cancelAll() → void
Cancel and remove all active effects. Safe to call from an effect's own callbacks while the player advances.
fromJson(List json, DeterministicEffect decode(Map<String, dynamic>), int restoredAtTick) → void
Restore from a previously captured toJson snapshot.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson(Map<String, dynamic> encode(DeterministicEffect)) → List<Map<String, dynamic>>
Snapshot all active effects to a JSON-compatible list.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited