diff --git a/src/client/HostLobbyModal.ts b/src/client/HostLobbyModal.ts index 322cc68add..01dbdc6858 100644 --- a/src/client/HostLobbyModal.ts +++ b/src/client/HostLobbyModal.ts @@ -179,6 +179,7 @@ export class HostLobbyModal extends BaseModal { }); } + /** Render the host lobby body: game config settings and the player list. */ protected renderBody() { const inputCards = [ html` this.kickPlayer(clientID)} > @@ -934,6 +939,7 @@ export class HostLobbyModal extends BaseModal { this.putGameConfig(); } + /** Push the host's current lobby settings to the server as a config update. */ private async putGameConfig() { const spawnImmunityTicks = this.spawnImmunityDurationMinutes ? this.spawnImmunityDurationMinutes * 60 * 10 @@ -945,6 +951,7 @@ export class HostLobbyModal extends BaseModal { detail: { config: { gameMap: this.selectedMap, + randomMap: this.useRandomMap, gameMapSize: this.compactMap ? GameMapSize.Compact : GameMapSize.Normal, diff --git a/src/client/JoinLobbyModal.ts b/src/client/JoinLobbyModal.ts index 115bff0fa4..d2ab1bfced 100644 --- a/src/client/JoinLobbyModal.ts +++ b/src/client/JoinLobbyModal.ts @@ -96,6 +96,7 @@ export class JoinLobbyModal extends BaseModal { }); } + /** Render the join lobby body: game config preview and the player list. */ protected renderBody() { // Pre-join state: show lobby ID input form if (!this.currentLobbyId) { @@ -156,6 +157,7 @@ export class JoinLobbyModal extends BaseModal { this.gameConfig?.nations ?? "default", this.nationCount, )} + .randomMap=${this.gameConfig?.randomMap === true} > ` : ""} @@ -406,15 +408,20 @@ export class JoinLobbyModal extends BaseModal { // --- Game config rendering --- + /** Render the lobby's map, mode, and option cards (map hidden when random). */ private renderGameConfig(): TemplateResult { if (!this.gameConfig) return html``; const c = this.gameConfig; - const mapName = getMapName(c.gameMap); + // A "Random" lobby keeps the concrete map hidden until the game starts. + const isRandomMap = c.randomMap === true; + const mapName = isRandomMap + ? translateText("map.random") + : getMapName(c.gameMap); const normalizedMap = normaliseMapKey(c.gameMap); - const thumbnailUrl = assetUrl( - `maps/${encodeURIComponent(normalizedMap)}/thumbnail.webp`, - ); + const thumbnailUrl = isRandomMap + ? assetUrl("images/RandomMap.webp") + : assetUrl(`maps/${encodeURIComponent(normalizedMap)}/thumbnail.webp`); const isTeam = c.gameMode === GameMode.Team; let modeSubtitle: string; diff --git a/src/client/SinglePlayerModal.ts b/src/client/SinglePlayerModal.ts index 994996ddd6..68454678e6 100644 --- a/src/client/SinglePlayerModal.ts +++ b/src/client/SinglePlayerModal.ts @@ -198,6 +198,7 @@ export class SinglePlayerModal extends BaseModal { }); } + /** Render the single-player setup body: game config settings. */ protected renderBody() { const inputCards = [ html`