Add the spirits to their rooms when rejoining. (Fixes #75)
This commit is contained in:
parent
b380fef99b
commit
a3b3cfa71f
1 changed files with 6 additions and 1 deletions
|
|
@ -122,10 +122,15 @@ export default (io: Server, socket: Socket, data: JoinGame) => {
|
||||||
let rooms: string[] = [game.id];
|
let rooms: string[] = [game.id];
|
||||||
game.log.info(`Player Reconnected to the game (name=${data.name})`);
|
game.log.info(`Player Reconnected to the game (name=${data.name})`);
|
||||||
|
|
||||||
// Get the hand of the player's team
|
// Get the hand of the player's team if they are a guesser
|
||||||
let hand: string[] = [];
|
let hand: string[] = [];
|
||||||
if (sameName.team && sameName.role == `guesser`) {
|
if (sameName.team && sameName.role == `guesser`) {
|
||||||
hand = game.teams[sameName.team - 1].hand;
|
hand = game.teams[sameName.team - 1].hand;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ensure that the user has a role before connecting them to
|
||||||
|
// the websocket rooms
|
||||||
|
if (sameName.role) {
|
||||||
rooms.push(
|
rooms.push(
|
||||||
`${game.id}:*:${sameName.role}`,
|
`${game.id}:*:${sameName.role}`,
|
||||||
`${game.id}:${sameName.team}:${sameName.role}`
|
`${game.id}:${sameName.team}:${sameName.role}`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue