Commit a2db3519 authored by purerosefallen's avatar purerosefallen

add room native flag

parent b2c66f0a
......@@ -11,7 +11,12 @@ export class JoinRoom {
}
this.logger.debug({ name: client.name, pass: msg.pass }, 'Joining room');
const roomManager = this.ctx.get(() => RoomManager);
const existing = roomManager.findByName(msg.pass);
if (existing) {
return existing.join(client);
}
const room = await roomManager.findOrCreateByName(msg.pass);
room.native = true;
return room.join(client);
});
}
......
......@@ -3,6 +3,12 @@ import { Room, RoomFinalizor } from './room';
import BetterLock from 'better-lock';
import { HostInfo } from 'ygopro-msg-encode';
declare module './room' {
export interface Room {
native?: boolean;
}
}
export class RoomManager {
constructor(private ctx: Context) {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment