/** * Dev-only: HOLD oac-upgrade (the longest tutorial text) open for a clean * screenshot — the shipped roster queues it behind the welcome chain on * firstScan, so this page overrides the config at boot: the same comm, * armed on newGame with no delay (dev-only; the shipped config is untouched). * node dev/cdp-shot.mjs "http://127.0.0.1:3000/dev/comms-upgrade-hold.html" out.png \ * "window.__commsHold" 60000 "document.getElementById('report')?.remove()" */ import Phaser from '../js/vendor/phaser.js'; import { config } from '../js/config/Config.js'; import { ConfigLoader } from '../js/config/ConfigLoader.js'; import { createGameConfig } from '../js/config/GameConfig.js'; import { GameScene } from '../js/scenes/GameScene.js'; const data = await ConfigLoader.load(); data.comms = { ...(data.comms ?? {}), comms: [{ ...data.comms.comms.find((c) => c.id === 'oac-upgrade'), trigger: 'newGame', delayMs: 0 }], }; config.init(data); const gameConfig = createGameConfig(); gameConfig.scene = [GameScene]; const game = new Phaser.Game(gameConfig); window.game = game; const report = document.createElement('pre'); report.id = 'report'; report.style.cssText = 'position:fixed;left:10px;top:10px;z-index:9999;margin:0;padding:8px 12px;font:12px/1.5 monospace;color:#eaf6ff;background:rgba(6,20,16,0.9);border:1px solid #1b3a5a;max-width:50%;'; document.body.appendChild(report); const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); const until = async (fn, ms = 30000) => { const t0 = Date.now(); for (;;) { const v = fn(); if (v) return v; if (Date.now() - t0 > ms) return null; await sleep(150); } }; setTimeout(async () => { const s = () => game.scene.getScene('GameScene'); const ready = await until(() => { const sc = s(); return sc && sc.ship && sc.comms && sc.comms.active && sc.comms.box?.video ? sc : null; }); if (!ready) { report.textContent = 'FAIL — comm never came up'; window.__commsHold = { ok: false }; return; } await until(() => (s().comms.box._decFinished === true), 8000); await sleep(700); const sc = s(); const box = sc.comms.box; const el = box.video?.video; window.__commsHold = { ok: true, comm: sc.comms.current?.id, box: { x: Math.round(box.x), y: Math.round(box.y), w: box.W, h: box.H }, clip: el ? { paused: el.paused, muted: el.muted, t: el.currentTime?.toFixed(1) } : null, voice: sc.comms._voiceKey ? sc.sound.isPlaying(sc.comms._voiceKey) : null, }; report.textContent = 'COMMS HOLD: ' + (sc.comms.current?.id ?? '?') + ' box ' + box.W + '×' + box.H + ' @ ' + Math.round(box.x) + ',' + Math.round(box.y) + ' · clip ' + (el ? (el.paused ? 'PAUSED' : 'rolling') : '—') + ' · voice ' + (sc.comms._voiceKey ? 'talking' : 'done'); }, 600);