mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-19 12:56:02 +00:00
created prestart message: add 2 second delay before starting public games to allow all players to connect
This commit is contained in:
@@ -64,11 +64,16 @@ export class GameManager {
|
||||
const phase = game.phase();
|
||||
if (phase == GamePhase.Active) {
|
||||
if (!game.hasStarted()) {
|
||||
try {
|
||||
game.start();
|
||||
} catch (error) {
|
||||
this.log.error(`error starting game ${id}: ${error}`);
|
||||
}
|
||||
// Prestart tells clients to start loading the game.
|
||||
game.prestart();
|
||||
// Start game on delay to allow time for clients to connect.
|
||||
setTimeout(() => {
|
||||
try {
|
||||
game.start();
|
||||
} catch (error) {
|
||||
this.log.error(`error starting game ${id}: ${error}`);
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user