From c4a86d643da8c93acfe93b0a2a20ca579eb322ff Mon Sep 17 00:00:00 2001 From: FloPinguin <25036848+FloPinguin@users.noreply.github.com> Date: Sat, 17 Jan 2026 16:42:45 +0100 Subject: [PATCH] Add nation count loading for JoinPrivateLobbyModal (Part 2) (#2942) ## Description: Use `this.getEffectiveNationCount()` everywhere inside of `LobbyPlayerView`, instead of `this.nationCount`. So the team player counts always update properly. ## 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 ## Please put your Discord username so you can be contacted if a bug or regression is found: FloPinguin --- src/client/components/LobbyPlayerView.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/client/components/LobbyPlayerView.ts b/src/client/components/LobbyPlayerView.ts index 2bcac3108..4c72fc21d 100644 --- a/src/client/components/LobbyPlayerView.ts +++ b/src/client/components/LobbyPlayerView.ts @@ -46,7 +46,9 @@ export class LobbyTeamView extends LitElement { changedProperties.has("gameMode") || changedProperties.has("clients") || changedProperties.has("teamCount") || - changedProperties.has("nationCount") + changedProperties.has("nationCount") || + changedProperties.has("disableNations") || + changedProperties.has("isCompactMap") ) { const teamsList = this.getTeamList(); this.computeTeamPreview(teamsList); @@ -237,7 +239,7 @@ export class LobbyTeamView extends LitElement { private getTeamList(): Team[] { if (this.gameMode !== GameMode.Team) return []; - const playerCount = this.clients.length + this.nationCount; + const playerCount = this.clients.length + this.getEffectiveNationCount(); const config = this.teamCount; if (config === HumansVsNations) { @@ -301,7 +303,7 @@ export class LobbyTeamView extends LitElement { const assignment = assignTeamsLobbyPreview( players, teams, - this.nationCount, + this.getEffectiveNationCount(), ); const buckets = new Map(); for (const t of teams) buckets.set(t, []); @@ -325,7 +327,9 @@ export class LobbyTeamView extends LitElement { // Fallback: divide players across teams; guard against 0 and empty lobbies this.teamMaxSize = Math.max( 1, - Math.ceil((this.clients.length + this.nationCount) / teams.length), + Math.ceil( + (this.clients.length + this.getEffectiveNationCount()) / teams.length, + ), ); } this.teamPreview = teams.map((t) => ({