mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-23 21:16:21 +00:00
feat(highlight): replace the small-player highlight toggle with a strength slider (#4588)
## Description: Replaces the "Highlight small players" on/off toggle with a **0-500% Strength slider** controlling the glow's **width** (0 = off, 100% = the previous default). - `UserSettings`: `highlightSmallPlayers()`/toggle → `highlightGlowStrength()`/set, float-backed, clamped to [0, 5]. - `SmallPlayerGlowPass` takes the strength via a setter (pushed by `ClientGameRunner` on the settings-changed event), so it stays a pure consumer and the slider still updates live while the settings modal has the sim paused. Width = a non-linear blur-iteration count; intensity compensated so wider stays about as bright. - `MapRenderer` persists the strength across a WebGL context restore. - `SettingsModal`: the toggle row becomes a range input. Behavior note: with the toggle gone the glow **defaults ON at 100%** (old toggle defaulted OFF); can default to 0 (opt-in) if preferred. ## 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
This commit is contained in:
@@ -14,7 +14,6 @@ import {
|
||||
} from "../core/CosmeticSchemas";
|
||||
import { decodePatternData } from "../core/PatternDecoder";
|
||||
import { PlayerType } from "../core/game/Game";
|
||||
import { UserSettings } from "../core/game/UserSettings";
|
||||
import { getCachedCosmetics } from "./Cosmetics";
|
||||
import { uploadFrameData } from "./render/frame/Upload";
|
||||
// Type-only: a value import would pull GPURenderer and its `.glsl?raw` shader
|
||||
@@ -197,7 +196,6 @@ export class WebGLFrameBuilder {
|
||||
}
|
||||
|
||||
private readonly highlightSetBuf = new Uint8Array(PALETTE_SIZE);
|
||||
private readonly userSettings = new UserSettings();
|
||||
private glowRescanTick = 0;
|
||||
|
||||
update(gameView: GameView): void {
|
||||
@@ -350,8 +348,9 @@ export class WebGLFrameBuilder {
|
||||
* Client-only view — toggle it live in the settings.
|
||||
*/
|
||||
private syncSmallPlayerGlow(gameView: GameView): void {
|
||||
// Strength (incl. off at 0) is read live in the glow pass; here we only
|
||||
// decide who qualifies. Skip spawn + the first minute.
|
||||
if (
|
||||
!this.userSettings.highlightSmallPlayers() ||
|
||||
gameView.inSpawnPhase() ||
|
||||
gameView.elapsedGameSeconds() < SMALL_PLAYER_GLOW_GRACE_SECONDS
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user