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)