miaoda-game-status-phaser
v0.3.3
Published
Phaser Scene status-effect host for miaoda-game-status-core.
Readme
miaoda-game-status-phaser
Use this Phaser 4 adapter to advance a StatusSet from Scene update events. It converts Phaser milliseconds to the core's chosen time unit (seconds by default in a real-time game) and cleans up on shutdown.
Install and use
pnpm add miaoda-game-status-core miaoda-game-status-phaserRegister StatusPlugin and create one status set per target:
const status = this.statusSets.create(player);
status.core.apply(poisonDefinition);
status.core.apply({ id: 'stun', duration: 0.5, flags: ['stun'] });The default remains Scene-owned. For fixed gameplay ordering, select one manual driver and advance it in seconds:
const status = this.statusSets.create(player, { tickSource: 'manual' });
fixedStepper.advance(frameDeltaSeconds, (dtSeconds) => {
status.stepSimulation(dtSeconds);
});Periodic damage, expiry hooks, duration and snapshot now share the coordinator's tick boundary. Calling stepSimulation in host mode, after destruction, or with a malformed seconds value throws before timers or callbacks change. setTicking(false) is a separate local pause and does not transfer time ownership.
Legacy { autoUpdate: false } and update(deltaMs) remain supported; the latter still expects Phaser milliseconds. New strict simulations should prefer { tickSource: 'manual' } and stepSimulation(dtSeconds) so authority and units are explicit. Destruction is terminal and releases Scene event ownership; the underlying core remains available for final observation.
