0
0
Fork 0

Fix data not being populated properly.

This commit is contained in:
Oliver-Akins 2021-01-07 16:12:15 -07:00
parent 65776efd06
commit 7993c0257f

View file

@ -23,6 +23,8 @@ export default (io: Server, socket: Socket, data: JoinGame) => {
name: game.id, name: game.id,
}); });
game.ingame = datastore.ingame;
// Get the specific information for team // Get the specific information for team
let playerData = datastore.players.find(p => p.name === data.name); let playerData = datastore.players.find(p => p.name === data.name);
if (playerData) { if (playerData) {
@ -33,10 +35,10 @@ export default (io: Server, socket: Socket, data: JoinGame) => {
let hand: string[] = []; let hand: string[] = [];
if (host.team) { if (host.team) {
let team = game.teams[host.team - 1]; let team = game.teams[host.team - 1];
hand = team.hand;
switch (host.role) { switch (host.role) {
case "guesser": case "guesser":
game.log.silly(`${host.name} is one of the team's guessers`); game.log.silly(`${host.name} is one of the team's guessers`);
hand = team.hand;
team.guessers.push(host); team.guessers.push(host);
socket.join([ socket.join([
`${game.id}:*:guesser`, `${game.id}:*:guesser`,
@ -105,7 +107,7 @@ export default (io: Server, socket: Socket, data: JoinGame) => {
// Get the hand of the player's team // Get the hand of the player's team
let hand: string[] = []; let hand: string[] = [];
if (sameName.team) { if (sameName.team && sameName.role == `guesser`) {
hand = game.teams[sameName.team - 1].hand; hand = game.teams[sameName.team - 1].hand;
}; };