Add check to ensure that the game can start.
This commit is contained in:
parent
64b5c49187
commit
fd2857d055
1 changed files with 9 additions and 0 deletions
|
|
@ -25,6 +25,15 @@ export const StartGame = (io: Server, socket: Socket, data: StartGame) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ensure the game can be started
|
// Ensure the game can be started
|
||||||
|
let start_error = game.start_error();
|
||||||
|
if (start_error) {
|
||||||
|
log.info(`Game ${game.code}: ${start_error}`);
|
||||||
|
socket.emit(`Starting`, {
|
||||||
|
success: false,
|
||||||
|
message: start_error,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.prettyError(err);
|
log.prettyError(err);
|
||||||
socket.emit(`Starting`, {
|
socket.emit(`Starting`, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue