From bdb7f6fc14f6123d1d0a269c8be759f404157062 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Tue, 6 Oct 2020 23:16:36 -0600 Subject: [PATCH] Add getter for host of the game --- src/utils/Game.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils/Game.ts b/src/utils/Game.ts index 3a00a41..a37f048 100644 --- a/src/utils/Game.ts +++ b/src/utils/Game.ts @@ -14,6 +14,15 @@ export class Game { return this.#players; }; + get host(): string|null { + for (var player in this._players) { + if (this._players[player].host) { + return player; + }; + }; + return null; + } + public add_player(player: string, is_host:boolean=false): void { this.#players[player] = { position: undefined,