From facff8c53c42873843d787679069e7cd5307690e Mon Sep 17 00:00:00 2001 From: Thomas Bergmueller Date: Thu, 16 May 2024 13:50:52 +0200 Subject: [PATCH] user-auth: Add possibility for server-induced userData updates In several occassions server-side logic may want to induce an (enforced) userData update, distributed to all players. Examples: - Moderating: Changing offensive usernames and/or characters - Ownership-based: Loss of ownership of a certain character or characterDescription-Item (includes e.g. NFT-Transfers, when items are represented as NFT) - Game-Events: A group of Users, e.g. the winning team of a challenge, should get awared with a special character or character item. --- .../src/Networked3dWebExperienceServer.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/3d-web-experience-server/src/Networked3dWebExperienceServer.ts b/packages/3d-web-experience-server/src/Networked3dWebExperienceServer.ts index a4cc1579..b38dea15 100644 --- a/packages/3d-web-experience-server/src/Networked3dWebExperienceServer.ts +++ b/packages/3d-web-experience-server/src/Networked3dWebExperienceServer.ts @@ -96,6 +96,11 @@ export class Networked3dWebExperienceServer { }); } + public updateUserCharacter(clientId: number, userData: UserData) { + console.log(`Initiate server-side update of client ${clientId}`) + this.userNetworkingServer.updateUserCharacter(clientId, userData); + } + registerExpressRoutes(app: enableWs.Application) { app.ws(this.config.networkPath, (ws) => { this.userNetworkingServer.connectClient(ws);