mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-12 00:23:47 +00:00
Add nuke fallout color graphics option (#4355)
## What Adds a **Nuke fallout color** option to the in-game graphics settings modal (Effects section), letting players recolor the fallout tint left on territory after a nuke.  ## How Mirrors the existing **Ocean color** override pattern: - `GraphicsOverrides.ts` — adds `staleNukeColor` (hex string) to the `mapOverlay` override schema. - `RenderOverrides.ts` — `applyGraphicsOverrides` parses the hex and writes the renderer's `staleNukeR/G/B` 0–1 float channels (`hexToRgb` yields 0–255, so it divides by 255). - `GraphicsSettingsModal.ts` — new hex-text + native color-picker row, default computed from `render-settings.json`. - `en.json` — `nuke_color_label` / `nuke_color_desc`. The value persists via `UserSettings.graphicsOverrides()` and is cleared by the modal's existing "Reset to defaults". The render debug GUI already exposes the same setting as **Stale Nuke Color** (Map Overlay), so no change was needed there. ## Testing - `tsc --noEmit` clean. - Verified in a headless solo game: the row renders with the green default (`#0d8c12`), changing it persists `mapOverlay.staleNukeColor`, and `applyGraphicsOverrides("#ff0000")` produces `staleNukeR=1, G=0, B=0`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,9 @@ export const GraphicsOverridesSchema = z
|
||||
territorySaturation: z.number(),
|
||||
territoryAlpha: z.number(),
|
||||
coordinateGridOpacity: z.number(),
|
||||
// "#rrggbb" hex string; overrides the lingering fallout ground tint
|
||||
// left on territory after a nuke.
|
||||
staleNukeColor: z.string(),
|
||||
})
|
||||
.partial(),
|
||||
railroad: z
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { GraphicsOverrides } from "./GraphicsOverrides";
|
||||
import { createThemeSettings, type RenderSettings } from "./RenderSettings";
|
||||
import { hexToRgb } from "./utils/ColorUtils";
|
||||
|
||||
/**
|
||||
* Apply the user's graphics overrides onto a RenderSettings in place: name
|
||||
@@ -64,6 +65,15 @@ export function applyGraphicsOverrides(
|
||||
settings.mapOverlay.coordinateGridOpacity =
|
||||
overrides.mapOverlay.coordinateGridOpacity;
|
||||
}
|
||||
if (overrides.mapOverlay?.staleNukeColor !== undefined) {
|
||||
// hexToRgb yields 0-255 channels; the stale-nuke uniforms are 0-1 floats.
|
||||
const rgb = hexToRgb(overrides.mapOverlay.staleNukeColor);
|
||||
if (rgb !== null) {
|
||||
settings.mapOverlay.staleNukeR = rgb[0] / 255;
|
||||
settings.mapOverlay.staleNukeG = rgb[1] / 255;
|
||||
settings.mapOverlay.staleNukeB = rgb[2] / 255;
|
||||
}
|
||||
}
|
||||
if (overrides.railroad?.railMinZoom !== undefined) {
|
||||
settings.railroad.railMinZoom = overrides.railroad.railMinZoom;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user