yes
This commit is contained in:
parent
c5eea6e29e
commit
ef568c9899
2 changed files with 8 additions and 1 deletions
|
|
@ -279,6 +279,12 @@ class StateI {
|
||||||
const gameId = newUUID() as unknown as GameId;
|
const gameId = newUUID() as unknown as GameId;
|
||||||
|
|
||||||
this.games.set(gameId, g);
|
this.games.set(gameId, g);
|
||||||
|
setTimeout(() => {
|
||||||
|
if (!g.ready_checks[0] && !g.ready_checks[1]) {
|
||||||
|
this.fastify.log.info(`paused game ${gameId} has been canceled`);
|
||||||
|
this.cleanupGame(gameId, g);
|
||||||
|
}
|
||||||
|
}, 1000 * 31);
|
||||||
this.fastify.log.info('new paused game \'' + gameId + '\'');
|
this.fastify.log.info('new paused game \'' + gameId + '\'');
|
||||||
return gameId;
|
return gameId;
|
||||||
}
|
}
|
||||||
|
|
@ -573,7 +579,7 @@ class StateI {
|
||||||
game.local,
|
game.local,
|
||||||
);
|
);
|
||||||
this.fastify.log.info('SetGameOutcome !');
|
this.fastify.log.info('SetGameOutcome !');
|
||||||
if (!game.local) {
|
if (!game.local && game.ready_checks[0] && game.ready_checks[1]) {
|
||||||
const payload = { nextGame: chat_text };
|
const payload = { nextGame: chat_text };
|
||||||
try {
|
try {
|
||||||
const resp = await fetch('http://app-chat/broadcastNextGame', {
|
const resp = await fetch('http://app-chat/broadcastNextGame', {
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ export class Tournament {
|
||||||
const [u1, u2] = matchup;
|
const [u1, u2] = matchup;
|
||||||
const gameId = newUUID() as PongGameId;
|
const gameId = newUUID() as PongGameId;
|
||||||
const game = State.initGame(null, gameId, u1, u2);
|
const game = State.initGame(null, gameId, u1, u2);
|
||||||
|
State.broadcastTourStatus(`A Tournament game between ${this.users.get(u1)?.name ?? 'the left player'} and ${this.users.get(u2)?.name ?? 'the right player'} will start ASAP`);
|
||||||
if (game) {
|
if (game) {
|
||||||
game.onEnd = () => this.gameEnd();
|
game.onEnd = () => this.gameEnd();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue