Add getter for host of the game
This commit is contained in:
parent
86199d71d5
commit
bdb7f6fc14
1 changed files with 9 additions and 0 deletions
|
|
@ -14,6 +14,15 @@ export class Game {
|
||||||
return this.#players;
|
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 {
|
public add_player(player: string, is_host:boolean=false): void {
|
||||||
this.#players[player] = {
|
this.#players[player] = {
|
||||||
position: undefined,
|
position: undefined,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue