From 3a8249dfd1429f942d854736e9c707c00c331d66 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 13 Jun 2026 20:09:59 -0700 Subject: [PATCH] Add structure icon size graphics override (#4270) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Adds a new **Structure icon size** option to `GraphicsOverrides`, exposed as a slider in the Graphics Settings modal. Players can now scale how large structure icons are drawn on the map. ## Changes - **`GraphicsOverrides.ts`** — add `iconSize: z.number()` to the `structure` override schema. - **`RenderOverrides.ts`** — apply the override onto `settings.structure.iconSize` (consumed by `StructurePass`/`StructureLevelPass` shaders). - **`GraphicsSettingsModal.ts`** — add a slider (range 20–120, step 5) in the "Structure Icons" section, with getter/handler following the existing pattern. Falls back to the `render-settings.json` default of 60 when unset. - **`resources/lang/en.json`** — add `icon_size_label` / `icon_size_desc` (English only, per i18n rules). - **`tests/GraphicsOverrides.test.ts`** — schema-validation cases plus application tests (override sets the value; absence keeps the default). The setting persists via the existing `userSettings.graphicsOverrides()` localStorage flow and takes effect live through the existing `regenerateRenderSettings` wiring. ## Testing - `npx vitest tests/GraphicsOverrides.test.ts --run` — 35 passed - `tsc --noEmit` — no new type errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 --- resources/lang/en.json | 2 + .../hud/layers/GraphicsSettingsModal.ts | 42 +++++++++++++++++++ src/client/render/gl/GraphicsOverrides.ts | 1 + src/client/render/gl/RenderOverrides.ts | 3 ++ tests/GraphicsOverrides.test.ts | 12 ++++++ 5 files changed, 60 insertions(+) diff --git a/resources/lang/en.json b/resources/lang/en.json index 28cf8fd05..f5879e7b7 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -535,6 +535,8 @@ "hover_glow_alpha_label": "Hover glow strength", "hover_glow_width_desc": "How far the white glow extends behind the hovered player's name", "hover_glow_width_label": "Hover glow size", + "icon_size_desc": "How large structure icons are drawn on the map", + "icon_size_label": "Structure icon size", "name_cull_desc": "Hide names smaller than this size", "name_cull_label": "Minimum name size", "name_scale_label": "Name Scale", diff --git a/src/client/hud/layers/GraphicsSettingsModal.ts b/src/client/hud/layers/GraphicsSettingsModal.ts index 4719bfc42..977161f3a 100644 --- a/src/client/hud/layers/GraphicsSettingsModal.ts +++ b/src/client/hud/layers/GraphicsSettingsModal.ts @@ -32,6 +32,10 @@ const HOVER_GLOW_ALPHA_MIN = 0; const HOVER_GLOW_ALPHA_MAX = 1; const HOVER_GLOW_ALPHA_STEP = 0.05; +const ICON_SIZE_MIN = 40; +const ICON_SIZE_MAX = 70; +const ICON_SIZE_STEP = 5; + const HIGHLIGHT_FILL_MIN = 0; const HIGHLIGHT_FILL_MAX = 1; const HIGHLIGHT_FILL_STEP = 0.01; @@ -318,6 +322,18 @@ export class GraphicsSettingsModal extends LitElement implements Controller { this.patchRailroad({ railThickness: value }); } + private currentIconSize(): number { + return ( + this.userSettings.graphicsOverrides().structure?.iconSize ?? + renderDefaults.structure.iconSize + ); + } + + private onIconSizeChange(event: Event) { + const value = parseFloat((event.target as HTMLInputElement).value); + this.patchStructure({ iconSize: value }); + } + private currentClassicIcons(): boolean { return ( this.userSettings.graphicsOverrides().structure?.classicIcons ?? true @@ -432,6 +448,7 @@ export class GraphicsSettingsModal extends LitElement implements Controller { const hoverGlowWidth = this.currentHoverGlowWidth(); const hoverGlowAlpha = this.currentHoverGlowAlpha(); const namesColored = !this.currentDarkNames(); + const iconSize = this.currentIconSize(); const classicIcons = this.currentClassicIcons(); const classicNumbers = this.currentClassicNumbers(); const highlightFill = this.currentHighlightFill(); @@ -629,6 +646,31 @@ export class GraphicsSettingsModal extends LitElement implements Controller { ${translateText("graphics_setting.section_structure_icons")} +
+
+
+ ${translateText("graphics_setting.icon_size_label")} +
+
+ ${translateText("graphics_setting.icon_size_desc")} +
+ +
+
+ ${iconSize.toFixed(0)} +
+
+