Files
OpenFrontIO/src/client/render/gl/GraphicsOverrides.ts
T
unne27GitHubunne27 <>
da2e0918a4 feat/highlight the owner of hovered naval units (#4610)
Resolves #4445

## Description:

Changes HoverHighlightController.ts to check for naval units if the
mouse is not currently hovering over land. It then highlights the owner
of the closest naval unit within 50px of the mouse.

The activation radius feels a little to large right now, but it is
consistent with the PlayerInfoOverlay functionality. Some input would be
appreciated

It is also currently disabled by default, not sure if this should be the
case.

## 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

## Please put your Discord username so you can be contacted if a bug or
regression is found:

unne27


https://github.com/user-attachments/assets/7b8262e5-a097-44c8-b2ae-1ac336466623

<img width="534" height="901" alt="image"
src="https://github.com/user-attachments/assets/50e9e126-08a6-4a24-9c26-cd4099a2603e"
/>

---------

Co-authored-by: unne27 <>
2026-07-20 14:21:50 -07:00

87 lines
2.5 KiB
TypeScript

import { z } from "zod";
export const GraphicsOverridesSchema = z
.object({
name: z
.object({
nameScaleFactor: z.number(),
cullThreshold: z.number(),
darkNames: z.boolean(),
hoverFadeAlpha: z.number(),
hoverGlowWidth: z.number(),
hoverGlowAlpha: z.number(),
})
.partial(),
structure: z
.object({
iconSize: z.number(),
classicIcons: z.boolean(),
classicNumbers: z.boolean(),
// When false, structures keep their full icon at any zoom instead of
// collapsing to dots when zoomed out (forces dotsZoomThreshold to 0).
showDots: z.boolean(),
})
.partial(),
mapOverlay: z
.object({
navalHighlight: z.boolean(),
highlightFillBrighten: z.number(),
highlightBrighten: z.number(),
highlightThicken: z.number(),
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
.object({
railMinZoom: z.number(),
railThickness: z.number(),
})
.partial(),
smallPlayerGlow: z
.object({
// Aura around small players' territory: 0 = off, 1 = full brightness.
strength: z.number(),
})
.partial(),
passEnabled: z
.object({
fx: z.boolean(),
// Nuclear fallout effects: the broiling green territory bloom and its
// light emission in day/night mode. Disable to improve performance.
fallout: z.boolean(),
})
.partial(),
accessibility: z
.object({
colorblind: z.boolean(),
})
.partial(),
terrain: z
.object({
// "#rrggbb" hex string; overrides the base ocean (deep water) color.
oceanColor: z.string(),
sandColor: z.string(),
plainsColor: z.string(),
highlandColor: z.string(),
mountainColor: z.string(),
})
.partial(),
lighting: z
.object({
// Scene brightness multiplier in the day/night composite. <1 darkens
// the map and reveals the glow around structures/units; 1 is identity.
ambient: z.number(),
// Exponent controlling how sharply a light fades with distance.
falloffPower: z.number(),
})
.partial(),
})
.partial();
export type GraphicsOverrides = z.infer<typeof GraphicsOverridesSchema>;