From f05b235c4dfdd1f3f48c1283f81ddd120e6ffaa4 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sat, 7 Feb 2026 23:45:23 +0100 Subject: [PATCH] Editor moves --- src/modules/live-run/core.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/live-run/core.ts b/src/modules/live-run/core.ts index 247a291..bef5c97 100644 --- a/src/modules/live-run/core.ts +++ b/src/modules/live-run/core.ts @@ -27,6 +27,14 @@ export async function addRun(run: LiveRun) { liveRuns.push(run); } -export async function addLiveRunMove(id: string) { - if (!liveRuns.find((r) => r.id === id)) throw "Invalid run"; +export async function addLiveRunMoves(id: string, moves: LiveRunMove[]) { + if (!liveRunMoves[id]) throw "Invalid run"; + + // Add the moves immediately + liveRunMoves[id] = [...liveRunMoves[id], ...moves]; + + // After 3 seconds, remove only the moves we just added + setTimeout(() => { + liveRunMoves[id] = liveRunMoves[id].filter((move) => !moves.includes(move)); + }, 3000); }