mirror of
https://github.com/AlecM33/Werewolf.git
synced 2025-12-26 15:57:50 +01:00
cleaner styling, display start game prompt
This commit is contained in:
@@ -191,9 +191,12 @@ function handleRequestForGameState(namespace, logger, gameRunner, accessCode, pe
|
||||
unassignedPerson.assigned = true;
|
||||
unassignedPerson.socketId = socket.id;
|
||||
ackFn(GameStateCurator.getGameStateFromPerspectiveOfPerson(game, unassignedPerson));
|
||||
let isFull = isGameFull(game);
|
||||
game.isFull = isFull;
|
||||
socket.to(accessCode).emit(
|
||||
globals.EVENTS.PLAYER_JOINED,
|
||||
{ name: unassignedPerson.name }
|
||||
{name: unassignedPerson.name},
|
||||
isFull
|
||||
);
|
||||
} else {
|
||||
rejectClientRequestForGameState(ackFn);
|
||||
@@ -220,4 +223,8 @@ function findPersonWithMatchingSocketId(people, socketId) {
|
||||
return people.find((person) => person.socketId === socketId);
|
||||
}
|
||||
|
||||
function isGameFull(game) {
|
||||
return game.moderator.assigned === true && !game.people.find((person) => person.assigned === false);
|
||||
}
|
||||
|
||||
module.exports = Singleton;
|
||||
|
||||
Reference in New Issue
Block a user