diff --git a/src/rooms/GeneralRoom.ts b/src/rooms/GeneralRoom.ts index 3cd04d2..799abd0 100644 --- a/src/rooms/GeneralRoom.ts +++ b/src/rooms/GeneralRoom.ts @@ -128,6 +128,8 @@ export class GeneralRoom extends Room { } onDispose() { + this.gameClock.clear(); + this.assistMap.clear(); this.dispatcher.stop(); } @@ -268,8 +270,10 @@ export class GeneralRoom extends Room { } addAssistClient(sessionId: string) { - let client = new RobotClient(sessionId, this.state, this['onMessageHandlers']); - this.assistMap.set(sessionId, client); + if (!this.assistMap.has(sessionId)) { + let client = new RobotClient(sessionId, this.state, this['onMessageHandlers']); + this.assistMap.set(sessionId, client); + } } getAssistClient(sessionId: string): RobotClient {