From 34fff98c996a11773bdfc824fd3155f9579245a4 Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 23 Feb 2025 20:46:31 -0800 Subject: [PATCH] make europe and world more frequent --- src/server/GameManager.ts | 8 +++++--- src/server/Server.ts | 10 +++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/server/GameManager.ts b/src/server/GameManager.ts index 812ed9e8a..1e37214d7 100644 --- a/src/server/GameManager.ts +++ b/src/server/GameManager.ts @@ -57,7 +57,7 @@ export class GameManager { disableBots: false, disableNPCs: false, creativeMode: false, - }) + }), ); return id; } @@ -66,7 +66,7 @@ export class GameManager { const game = this.games .filter((g) => g.id == gameID) .filter( - (g) => g.phase() == GamePhase.Lobby || g.phase() == GamePhase.Active + (g) => g.phase() == GamePhase.Lobby || g.phase() == GamePhase.Active, ); return game.length > 0; } @@ -92,6 +92,8 @@ export class GameManager { (map) => !ignoreMaps.includes(map), ); this.mapsPlaylist.push(GameMapType.World); + this.mapsPlaylist.push(GameMapType.World); + this.mapsPlaylist.push(GameMapType.Europe); this.mapsPlaylist.push(GameMapType.Europe); this.random.shuffleArray(this.mapsPlaylist); if (this.allNonConsecutive(this.mapsPlaylist)) { @@ -126,7 +128,7 @@ export class GameManager { disableBots: false, disableNPCs: false, creativeMode: false, - }) + }), ); } diff --git a/src/server/Server.ts b/src/server/Server.ts index fc5104eac..28bf27557 100644 --- a/src/server/Server.ts +++ b/src/server/Server.ts @@ -59,7 +59,7 @@ app.use( rateLimit({ windowMs: 1000, // 1 second max: 20, // 20 requests per IP per second - }) + }), ); const rateLimiter = new RateLimiterMemory({ @@ -289,7 +289,7 @@ wss.on("connection", (ws, req) => { } try { const clientMsg: ClientMessage = ClientMessageSchema.parse( - JSON.parse(message) + JSON.parse(message), ); if (clientMsg.type == "join") { const forwarded = req.headers["x-forwarded-for"]; @@ -302,7 +302,7 @@ wss.on("connection", (ws, req) => { const { isValid, error } = validateUsername(clientMsg.username); if (!isValid) { console.log( - `game ${clientMsg.gameID}, client ${clientMsg.clientID} received invalid username, ${error}` + `game ${clientMsg.gameID}, client ${clientMsg.clientID} received invalid username, ${error}`, ); return; } @@ -313,10 +313,10 @@ wss.on("connection", (ws, req) => { clientMsg.persistentID, ip, clientMsg.username, - ws + ws, ), clientMsg.gameID, - clientMsg.lastTurn + clientMsg.lastTurn, ); if (!wasFound) { console.log(`game ${clientMsg.gameID} not found, loading from gcs`);