mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Remove the Cyber HUD layout and keep its sonar as a visual style
Display > HUD > Sonar now turns the sonar sweep on over Tactical or Minimal. It is off by default, ON reveals its five sliders, and it keeps its guards: an OFF control, the sweep only while the HUD is visible and outside Cockpit, no animation under reduced motion, and repaint timers re-armed only after a drawn frame that still shows contacts. The Cyber layout, its shell skin and its Cockpit lanes are removed. Share links, scenes, saved views and set_hud that name Cyber open Tactical with Sonar on; links and scene shots record Tactical with Sonar under the same code, and a restored state that names another layout turns Sonar off. set_cyber_sonar keeps its name and works under any layout. A newer Sonar toggle or voice setting wins over a share-link restore that lands later. From 1200px wide the command dock and World Timeline sit 74px above the bottom edge, as in the Omnibar layout, leaving the bottom row to the map attribution (left) and the Power Up corner row (right). The attribution moves to the bottom right when the page runs right to left, where the corner row sits at the bottom left, and a long credit line wraps upward before reaching the corner row. The Tactical bottom-right readout sits 8px above Power Up and the coordinates start level with it. The World Timeline is narrowed to sit between the corners. Toasts keep clear of the raised dock and the chat and voice panel height budgets subtract its rise. Below 1200px the layout is unchanged. The left rail treats the centered World Timeline and voice control as obstacles only where they reach a laid-out panel. On top of the Omnibar: sonar.css replaces cyber.css after the Omnibar imports, the Omnibar's HUD guide step now says Layout picks Tactical or Minimal, and the Omnibar's Tactical bottom-right readout keeps the same 8px above Power Up. Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
1 parent
35b87c75f2
commit
d68adcea21
112 files changed
+1433
-5239
No files matched your search
+37
-76
@@ -48,7 +48,10 @@ import {
|
||||
readCyberSonarSettings,
|
||||
setCyberSonarEnabled,
|
||||
} from '../cyberSonar.js';
|
||||
import { cyberVisualDefaultsForHudTransition } from '../hudLayouts.js';
|
||||
import {
|
||||
isLegacySonarHudLayout,
|
||||
LEGACY_SONAR_HUD_LAYOUTS,
|
||||
} from '../hudLayouts.js';
|
||||
const DETECTION_ALLOCATION_STORAGE_KEY = 'gev:detection-allocation:v1';
|
||||
|
||||
/** Own visual preferences, detection overrides and display-control state. */
|
||||
@@ -119,7 +122,7 @@ export class VisualSettings {
|
||||
this._setSharpenIntensity(sharpenIntensity, { syncShare: false });
|
||||
if (typeof bloom === 'boolean') this._setBloomEnabled(bloom);
|
||||
if (typeof sharpen === 'boolean') this._setSharpenEnabled(sharpen);
|
||||
if (hudVariant) this._setHudVariant(hudVariant);
|
||||
if (hudVariant) this._setHudVariant(hudVariant, { restore: true });
|
||||
if (typeof hudVisible === 'boolean') {
|
||||
this.hud.setMode(hudVisible ? 'on' : 'off');
|
||||
this._updateHudButtonState();
|
||||
@@ -243,8 +246,6 @@ export class VisualSettings {
|
||||
this._scopeOpacityShown = null;
|
||||
this._celestialShown = null;
|
||||
this.activeStyle = 'normal';
|
||||
this._preCyberStyle = null;
|
||||
this._cyberStyleUserSelected = false;
|
||||
document.documentElement.dataset.gevStyle = this.activeStyle;
|
||||
this._detectionUserOverridden = false;
|
||||
this._cockpitVisionMode = 'optical';
|
||||
@@ -716,64 +717,27 @@ export class VisualSettings {
|
||||
this._syncShareState();
|
||||
}
|
||||
|
||||
_setHudVariant(variantName, { applyVisualDefaults = false } = {}) {
|
||||
/**
|
||||
* @param {string} variantName Layout, or the removed `cyber` layout.
|
||||
* @param {{restore?: boolean}} [options] A share link, scene or saved view
|
||||
* is authoritative for Sonar too: it is on only when the state names
|
||||
* Cyber. Other callers leave Sonar as the viewer set it.
|
||||
*/
|
||||
_setHudVariant(variantName, { restore = false } = {}) {
|
||||
if (!variantName) return;
|
||||
const previousVariant = this.hud.getVariant();
|
||||
// Cyber was removed; its sonar became a visual style. A state that names
|
||||
// Cyber opens in Tactical with Sonar on.
|
||||
const sonar = isLegacySonarHudLayout(variantName);
|
||||
if (sonar || (restore && isCyberSonarEnabled()))
|
||||
this._setCyberSonarEnabled(sonar);
|
||||
this.hud.setVariant(variantName);
|
||||
const nextVariant = this.hud.getVariant();
|
||||
const enteredCyber = previousVariant !== 'cyber' && nextVariant === 'cyber';
|
||||
const leftCyber = previousVariant === 'cyber' && nextVariant !== 'cyber';
|
||||
if (!applyVisualDefaults) {
|
||||
// Scene/share/programmatic state is authoritative even when it reapplies
|
||||
// the current Cyber variant. Do not let an older explicit entry restore
|
||||
// stale local preset memory on the next user-selected exit.
|
||||
this._preCyberStyle = null;
|
||||
this._cyberStyleUserSelected = false;
|
||||
} else if (enteredCyber) {
|
||||
this._preCyberStyle = this.activeStyle;
|
||||
this._cyberStyleUserSelected = false;
|
||||
}
|
||||
this._hudVariantShown = nextVariant;
|
||||
this._hudVariantShown = this.hud.getVariant();
|
||||
this._publishDisplay();
|
||||
const visualDefaults = cyberVisualDefaultsForHudTransition(
|
||||
previousVariant,
|
||||
nextVariant,
|
||||
{ explicit: applyVisualDefaults },
|
||||
);
|
||||
if (visualDefaults) this._applyCyberVisualDefaults(visualDefaults);
|
||||
if (leftCyber) {
|
||||
const restoreStyle =
|
||||
applyVisualDefaults && !this._cyberStyleUserSelected
|
||||
? this._preCyberStyle
|
||||
: null;
|
||||
this._preCyberStyle = null;
|
||||
this._cyberStyleUserSelected = false;
|
||||
if (restoreStyle && restoreStyle !== this.activeStyle) {
|
||||
this.setStyle(restoreStyle, {
|
||||
applyPreset: false,
|
||||
revealParameters: false,
|
||||
preserveCyberRestore: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
this._syncCyberSonarControl();
|
||||
this._syncShareState();
|
||||
this._scheduleAdaptivePanelLayout({ settle: true });
|
||||
}
|
||||
|
||||
_applyCyberVisualDefaults({ style, ironbow }) {
|
||||
this.setStyle(style, {
|
||||
applyPreset: false,
|
||||
revealParameters: false,
|
||||
preserveCyberRestore: true,
|
||||
});
|
||||
const thermalUniforms = this.stages?.thermal?.uniforms;
|
||||
if (!thermalUniforms || thermalUniforms.palette === undefined) return;
|
||||
thermalUniforms.palette = ironbow;
|
||||
this._updateSliderPanel('thermal', { reveal: false });
|
||||
this.services.governorRequestRender('cyber-visual-defaults');
|
||||
}
|
||||
|
||||
_syncCyberSonarControl() {
|
||||
const settings = applyCyberSonarSettings(readCyberSonarSettings());
|
||||
this._sonarShown = {
|
||||
@@ -791,9 +755,22 @@ export class VisualSettings {
|
||||
const next = setCyberSonarEnabled(!!enabled);
|
||||
this._syncCyberSonarControl();
|
||||
this.services.governorRequestRender('cyber-sonar-toggle');
|
||||
this._syncShareState();
|
||||
return next;
|
||||
}
|
||||
|
||||
/**
|
||||
* The HUD layout a share link or scene shot records. Tactical with Sonar on
|
||||
* is written as the retired Cyber code, which restores exactly that; Minimal
|
||||
* has no such code, so its Sonar stays local.
|
||||
*/
|
||||
_sharedHudVariant() {
|
||||
const variant = this.hud.getVariant();
|
||||
return variant === 'tactical' && isCyberSonarEnabled()
|
||||
? LEGACY_SONAR_HUD_LAYOUTS[0]
|
||||
: variant;
|
||||
}
|
||||
|
||||
_setCyberSonarSetting(name, value) {
|
||||
const settings = readCyberSonarSettings();
|
||||
if (!Object.hasOwn(settings, name)) return settings;
|
||||
@@ -838,9 +815,7 @@ export class VisualSettings {
|
||||
this._setSharpenEnabled(sharpenInput.enabled);
|
||||
}
|
||||
|
||||
// Cyber is an explicit shell choice, independent of the imagery filter.
|
||||
// Scene/share restoration still applies its own HUD through _setHudVariant.
|
||||
if (preset.hudVariant && this.hud.getVariant() !== 'cyber') {
|
||||
if (preset.hudVariant) {
|
||||
this._setHudVariant(preset.hudVariant);
|
||||
}
|
||||
if (typeof preset.hudVisible === 'boolean') {
|
||||
@@ -865,8 +840,8 @@ export class VisualSettings {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{keepHudVariant?: boolean}} [options] `keepHudVariant` leaves the
|
||||
* HUD layout to the style, as choosing a style does (Visual's reset).
|
||||
* @param {{keepHudVariant?: boolean}} [options] `keepHudVariant` keeps the
|
||||
* current HUD layout (Visual's reset).
|
||||
*/
|
||||
_applyGlobalPostDefaults({ keepHudVariant = false } = {}) {
|
||||
const defaults = GLOBAL_POST_DEFAULTS;
|
||||
@@ -943,7 +918,7 @@ export class VisualSettings {
|
||||
bloomIntensity: this._getBloomIntensity(),
|
||||
bloomVersion: BLOOM_SCALE_VERSION,
|
||||
sharpenIntensity: this._sharpenPct,
|
||||
hudVariant: this.hud.getVariant(),
|
||||
hudVariant: this._sharedHudVariant(),
|
||||
hudVisible: this.hud.visible,
|
||||
detectionMode: detection.mode,
|
||||
detectionDensity: detection.densityPct,
|
||||
@@ -1261,7 +1236,7 @@ export class VisualSettings {
|
||||
},
|
||||
hud: {
|
||||
visible: this.hud.visible,
|
||||
variant: this.hud.getVariant(),
|
||||
variant: this._sharedHudVariant(),
|
||||
},
|
||||
detection: {
|
||||
mode: getDetectionMode(),
|
||||
@@ -1309,7 +1284,7 @@ export class VisualSettings {
|
||||
|
||||
const hudState = state.hud || {};
|
||||
if (hudState.variant) {
|
||||
this._setHudVariant(hudState.variant);
|
||||
this._setHudVariant(hudState.variant, { restore: true });
|
||||
}
|
||||
if (typeof hudState.visible === 'boolean') {
|
||||
this.hud.setMode(hudState.visible ? 'on' : 'off');
|
||||
@@ -1527,8 +1502,6 @@ export class VisualSettings {
|
||||
applyPreset = true,
|
||||
revealParameters = applyPreset,
|
||||
restore = false,
|
||||
userInitiated = false,
|
||||
preserveCyberRestore = false,
|
||||
} = {},
|
||||
) {
|
||||
if (
|
||||
@@ -1538,18 +1511,6 @@ export class VisualSettings {
|
||||
return;
|
||||
const { setDetectionStyle } = this.services;
|
||||
if (!restore) this.shareLinkManager?.claimRestoreLane?.('visual');
|
||||
if (this.hud.getVariant() === 'cyber') {
|
||||
if (userInitiated) {
|
||||
// A direct preset choice owns the active style even when it selects the
|
||||
// same value as Cyber's automatic FLIR default.
|
||||
this._cyberStyleUserSelected = true;
|
||||
} else if (!preserveCyberRestore) {
|
||||
// Scene/share/reset state is authoritative and must not be overwritten
|
||||
// by a remembered local Cyber entry when the user later exits.
|
||||
this._preCyberStyle = null;
|
||||
this._cyberStyleUserSelected = false;
|
||||
}
|
||||
}
|
||||
if (styleName === this.activeStyle) {
|
||||
if (revealParameters && styleName !== 'normal')
|
||||
this._revealStyleParameters();
|
||||
|
||||
Reference in new issue
Block a user