Deleting world when empty.

This commit is contained in:
David Négrier 2020-06-29 19:14:54 +02:00
parent d9e6b501b1
commit 9bdcc9da98
2 changed files with 7 additions and 0 deletions

View file

@ -72,6 +72,10 @@ export class World {
this.users.delete(user.userId);
}
public isEmpty(): boolean {
return this.users.size === 0;
}
public updatePosition(socket : Identificable, userPosition: PointInterface): void {
const user = this.users.get(socket.userId);
if(typeof user === 'undefined') {