From e0936bf8d309b519753c4749e4c8e80973600ecc Mon Sep 17 00:00:00 2001 From: Scott Anderson <662325+scottanderson@users.noreply.github.com> Date: Sun, 6 Jul 2025 20:30:43 -0400 Subject: [PATCH] Quads fix (#1356) ## Description: Add missing code that was meant to go in #1347 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors --- src/core/configuration/DefaultConfig.ts | 19 +++++++++++++++++-- src/core/configuration/DevConfig.ts | 4 ---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 7e7d328c3..7809014cc 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -2,6 +2,7 @@ import { JWK } from "jose"; import { z } from "zod/v4"; import { Difficulty, + Duos, Game, GameMapType, GameMode, @@ -10,9 +11,11 @@ import { Player, PlayerInfo, PlayerType, + Quads, TerrainType, TerraNullius, Tick, + Trios, UnitInfo, UnitType, } from "../game/Game"; @@ -172,8 +175,20 @@ export abstract class DefaultServerConfig implements ServerConfig { const r = Math.random(); const base = r < 0.3 ? l : r < 0.6 ? m : s; let p = Math.min(mode === GameMode.Team ? Math.ceil(base * 1.5) : base, l); - if (typeof numPlayerTeams === "number") { - p -= p % numPlayerTeams; + if (numPlayerTeams === undefined) return p; + switch (numPlayerTeams) { + case Duos: + p -= p % 2; + break; + case Trios: + p -= p % 3; + break; + case Quads: + p -= p % 4; + break; + default: + p -= p % numPlayerTeams; + break; } return p; } diff --git a/src/core/configuration/DevConfig.ts b/src/core/configuration/DevConfig.ts index 9da20511a..ddc48a2fd 100644 --- a/src/core/configuration/DevConfig.ts +++ b/src/core/configuration/DevConfig.ts @@ -17,10 +17,6 @@ export class DevServerConfig extends DefaultServerConfig { return 5 * 1000; } - lobbyMaxPlayers(): number { - return Math.random() < 0.5 ? 2 : 3; - } - samWarheadHittingChance(): number { return 1; }