feat(vega-gnn): suppress ranking/relations pages during espionage alerts

When a fresh espionage notification is pending, skip ranking metrics and
relations pages so the alert reads as a focused notification rather than
being interleaved with unrelated charts. Reopening GNN without pending
events (using history) always shows the full experience, providing an
escape hatch for players who want the charts.
This commit is contained in:
Brian Fertig 2026-08-13 16:45:53 -06:00
parent 57a8a14ade
commit 8f0b079fa4
1 changed files with 14 additions and 5 deletions

View File

@ -583,11 +583,20 @@ export function openGnnScreen(scene, rules, state, art, opts = {}) {
const storyEvents = usingHistory ? (state.gnn?.history ?? []) : pending;
const storyPages = storyEvents.map((ev) => ({ kind: 'story', desc: Gnn.describeGnnStory(rules, state, ev) }));
const rankingPages = Gnn.RANKING_METRICS.map((metric) => ({ kind: 'ranking', metric }));
// Always-accessible: present every time GNN opens, independent of
// whether there's a pending story — same footing as the ranking pages.
const relationsPage = { kind: 'relations' };
const pages = [...storyPages, ...rankingPages, relationsPage];
// A spying/sabotage notification is a targeted alert, not a newscast —
// skip the ranking/relations pages so it reads as "here's what just
// happened," not "here's what just happened, now flip through five
// unrelated charts" (Brian's ask). Only suppresses on a FRESH pending
// notification; reopening GNN on demand with nothing pending
// (usingHistory) always gets the full experience back — that reopen IS
// the escape hatch for a player who does want the charts.
const isEspionageAlert = !usingHistory
&& storyPages.some((p) => p.desc.kind === 'espionage' || p.desc.kind === 'espionageResult');
const rankingPages = isEspionageAlert ? [] : Gnn.RANKING_METRICS.map((metric) => ({ kind: 'ranking', metric }));
// Always-accessible otherwise: present every time GNN opens, independent
// of whether there's a pending story — same footing as the ranking pages.
const relationsPage = isEspionageAlert ? null : { kind: 'relations' };
const pages = [...storyPages, ...rankingPages, ...(relationsPage ? [relationsPage] : [])];
const root = scene.add.container(0, 0).setDepth(D.gnn);
root.add(scene.add.rectangle(0, 0, GAME_WIDTH, GAME_HEIGHT, 0x030509, 0.99)