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) {