From 333fac00c8ef2fb503045d705f7acee98b3cfdb3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 9 Jan 2024 19:52:15 +0900 Subject: [PATCH] Update drop-and-fusion-engine.ts --- packages/frontend/src/scripts/drop-and-fusion-engine.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/scripts/drop-and-fusion-engine.ts b/packages/frontend/src/scripts/drop-and-fusion-engine.ts index e2327552f3..67ce270f6f 100644 --- a/packages/frontend/src/scripts/drop-and-fusion-engine.ts +++ b/packages/frontend/src/scripts/drop-and-fusion-engine.ts @@ -61,6 +61,7 @@ export class DropAndFusionGame extends EventEmitter<{ private monoTextureUrls: Record = {}; private rng: () => number; private logs: Log[] = []; + private replaying = false; private sfxVolume = 1; @@ -313,6 +314,7 @@ export class DropAndFusionGame extends EventEmitter<{ public start(logs?: Log[]) { if (!this.loaded) throw new Error('game is not loaded yet'); + if (logs) this.replaying = true; for (let i = 0; i < this.STOCK_MAX; i++) { this.stock.push({ @@ -464,7 +466,7 @@ export class DropAndFusionGame extends EventEmitter<{ public drop(_x: number) { if (this.isGameOver) return; - if (Date.now() - this.latestDroppedAt < this.DROP_INTERVAL) return; + if (!this.replaying && (Date.now() - this.latestDroppedAt < this.DROP_INTERVAL)) return; const head = this.stock.shift()!; this.stock.push({