From f1820b5734e92f1dcba5dcc191019eb7a3581d4f Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 29 Jul 2026 21:05:08 +0500 Subject: [PATCH] chore: Make command dispatch tick optional --- src/core/game.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/game.ts b/src/core/game.ts index d74dbda..5e8bceb 100644 --- a/src/core/game.ts +++ b/src/core/game.ts @@ -537,9 +537,15 @@ export class Game implements IGame { else this.middlewares.push(middleware) } - public dispatch(command: ICommand) { - if (this.options.commandBusOptions?.usingCommangQueue) this.commandQueue.push(command) - else this.proccessCmd(command) + public dispatch(command: Omit & { readonly tick?: number }) { + if (this.options.commandBusOptions?.usingCommangQueue) this.commandQueue.push({ + ...command, + tick: command.tick ?? this.currentTick + }) + else this.proccessCmd({ + ...command, + tick: command.tick ?? this.currentTick + }) } public start(fps=BASE_FPS) {