From 85eb587ce398081d017848647e60d6593dd96dc6 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 17 Apr 2026 18:57:27 +0500 Subject: [PATCH] fix: Network plugin --- src/interfaces/core/support/support.interfaces.ts | 5 +++++ src/plugins/network.plgugin.ts | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/interfaces/core/support/support.interfaces.ts b/src/interfaces/core/support/support.interfaces.ts index c3a1cac..18f52b8 100644 --- a/src/interfaces/core/support/support.interfaces.ts +++ b/src/interfaces/core/support/support.interfaces.ts @@ -46,6 +46,11 @@ export interface ICommand { */ readonly isSystem?: boolean; + /** + * Indicates this command provided from server + */ + readonly isNetwork?: boolean; + /** * Cmd data */ diff --git a/src/plugins/network.plgugin.ts b/src/plugins/network.plgugin.ts index 4d56b12..cc0aea7 100644 --- a/src/plugins/network.plgugin.ts +++ b/src/plugins/network.plgugin.ts @@ -27,7 +27,7 @@ export class NetworkPlguin implements IPlugin { public install(game: Game) { game.use((cmd, next) => { - this.server.emit(cmd.type, cmd.data) + if (!cmd.isNetwork) this.server.emit(cmd.type, cmd.data) next() }) @@ -38,7 +38,8 @@ export class NetworkPlguin implements IPlugin { tick: game.currentTick, type: event, entityId: +client.id, - data + data, + isNetwork: true }) cb(event, data)