mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 02:14:01 +00:00
Snow is no longer offered anywhere a style can be chosen: the Visual Presets tray, keyboard shortcut 7, the Cockpit vision carousel, and the set_visual_style voice action. The shader and its labels go with it; weather snowfall and the SNOW weather condition are unaffected. Share links keep working. Snow's enum code (6) stays reserved, so a compact or long-form link that names it opens on Normal and drops the Snow shader parameters without reporting them as unknown. A Scene Director shot saved with Snow plays on Normal too. Snow's frozen share defaults matched Normal's apart from those parameters, so no other setting in an old link changes meaning. The legacy voice-schema pins restore Snow before hashing, so the unchanged pins still prove nothing else moved; the complete Realtime payload digest is re-derived.
129 lines
4.3 KiB
JavaScript
129 lines
4.3 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import {
|
|
applyCockpitVisionStageIntensities,
|
|
captureCockpitVisionBaseline,
|
|
cockpitVisionModeForStyle,
|
|
COCKPIT_VISION_MODES,
|
|
normalizeCockpitVisionMode,
|
|
} from './cockpitVisionPolicy.js';
|
|
|
|
const createStages = () => ({
|
|
noir: { uniforms: { intensity: 0.72, contrast: 1.3 } },
|
|
retro: { uniforms: { intensity: 0.18, gain: 0.4 } },
|
|
surveillance: { uniforms: { intensity: 0, grain: 0.6 } },
|
|
thermal: { uniforms: { intensity: 0, heat: 0.8 } },
|
|
});
|
|
|
|
test('Cockpit vision order mirrors the unique map preset order', () => {
|
|
assert.deepEqual(COCKPIT_VISION_MODES, [
|
|
'optical',
|
|
'crt',
|
|
'nvg',
|
|
'thermal',
|
|
'anime',
|
|
'noir',
|
|
]);
|
|
assert.equal(normalizeCockpitVisionMode('none'), 'optical');
|
|
assert.equal(normalizeCockpitVisionMode('unknown'), 'optical');
|
|
});
|
|
|
|
test('Cockpit entry selects the vision mode equivalent to the active map style', () => {
|
|
assert.equal(cockpitVisionModeForStyle('normal'), 'optical');
|
|
assert.equal(cockpitVisionModeForStyle('retro'), 'crt');
|
|
assert.equal(cockpitVisionModeForStyle('surveillance'), 'nvg');
|
|
assert.equal(cockpitVisionModeForStyle('thermal'), 'thermal');
|
|
assert.equal(cockpitVisionModeForStyle('anime'), 'anime');
|
|
assert.equal(cockpitVisionModeForStyle('noir'), 'noir');
|
|
assert.equal(cockpitVisionModeForStyle('snow'), 'optical');
|
|
assert.equal(cockpitVisionModeForStyle('unsupported'), 'optical');
|
|
});
|
|
|
|
test('Cockpit settles pending map crossfades before a temporary preset takes ownership', () => {
|
|
const stages = createStages();
|
|
const transitions = new Map([
|
|
['noir', { from: 0, to: 1, start: 10 }],
|
|
['retro', { from: 1, to: 0, start: 10 }],
|
|
]);
|
|
const restore = captureCockpitVisionBaseline(stages, transitions);
|
|
assert.deepEqual(restore, { noir: 1, retro: 0, surveillance: 0, thermal: 0 });
|
|
assert.equal(transitions.size, 0);
|
|
applyCockpitVisionStageIntensities(stages, 'nvg');
|
|
assert.equal(stages.surveillance.uniforms.intensity, 1);
|
|
applyCockpitVisionStageIntensities(stages, 'optical');
|
|
assert.equal(stages.noir.uniforms.intensity, 0);
|
|
assert.equal(stages.retro.uniforms.intensity, 0);
|
|
});
|
|
|
|
test('Normal clears every temporary and inherited visual stage', () => {
|
|
const stages = createStages();
|
|
const restore = Object.fromEntries(
|
|
Object.entries(stages).map(([name, stage]) => [
|
|
name,
|
|
stage.uniforms.intensity,
|
|
]),
|
|
);
|
|
applyCockpitVisionStageIntensities(stages, 'thermal');
|
|
applyCockpitVisionStageIntensities(stages, 'optical');
|
|
assert.deepEqual(
|
|
Object.fromEntries(
|
|
Object.entries(stages).map(([name, stage]) => [
|
|
name,
|
|
stage.uniforms.intensity,
|
|
]),
|
|
),
|
|
{ noir: 0, retro: 0, surveillance: 0, thermal: 0 },
|
|
);
|
|
assert.deepEqual(restore, {
|
|
noir: 0.72,
|
|
retro: 0.18,
|
|
surveillance: 0,
|
|
thermal: 0,
|
|
});
|
|
});
|
|
|
|
test('temporary styles replace each other without changing the inherited restore snapshot', () => {
|
|
const stages = createStages();
|
|
const restore = Object.fromEntries(
|
|
Object.entries(stages).map(([name, stage]) => [
|
|
name,
|
|
stage.uniforms.intensity,
|
|
]),
|
|
);
|
|
applyCockpitVisionStageIntensities(stages, 'thermal');
|
|
assert.equal(applyCockpitVisionStageIntensities(stages, 'crt'), 'retro');
|
|
assert.equal(stages.retro.uniforms.intensity, 1);
|
|
assert.equal(stages.noir.uniforms.intensity, 0);
|
|
applyCockpitVisionStageIntensities(stages, 'optical');
|
|
assert.equal(stages.noir.uniforms.intensity, 0);
|
|
assert.equal(stages.retro.uniforms.intensity, 0);
|
|
assert.deepEqual(restore, {
|
|
noir: 0.72,
|
|
retro: 0.18,
|
|
surveillance: 0,
|
|
thermal: 0,
|
|
});
|
|
});
|
|
|
|
test('NOIR is a temporary Cockpit override and Normal clears it', () => {
|
|
const stages = createStages();
|
|
const restore = Object.fromEntries(
|
|
Object.entries(stages).map(([name, stage]) => [
|
|
name,
|
|
stage.uniforms.intensity,
|
|
]),
|
|
);
|
|
assert.equal(applyCockpitVisionStageIntensities(stages, 'noir'), 'noir');
|
|
assert.equal(stages.noir.uniforms.intensity, 1);
|
|
assert.equal(stages.retro.uniforms.intensity, 0);
|
|
applyCockpitVisionStageIntensities(stages, 'optical');
|
|
assert.equal(stages.noir.uniforms.intensity, 0);
|
|
assert.equal(stages.retro.uniforms.intensity, 0);
|
|
assert.deepEqual(restore, {
|
|
noir: 0.72,
|
|
retro: 0.18,
|
|
surveillance: 0,
|
|
thermal: 0,
|
|
});
|
|
});
|