/** * Dev-only: HOLD Trestle's intro comm open (no ACK) for a clean * screenshot — the pair armed through the REAL discovery path * (foreign system + a planet), the box live (video rolling, text * decoded, button armed + pulsing). * * node dev/cdp-shot.mjs "http://127.0.0.1:3000/dev/comms-trestle-hold.html" out.png \ * "window.__trestleHold" 90000 "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(); const shipped = data.comms; data.comms = { ...shipped, comms: (shipped?.comms ?? []).filter((c) => c.trigger === 'firstForeignPlanet') }; 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);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 : null; }); if (!ready) { report.textContent = 'FAIL — scene never ready'; window.__trestleHold = { ok: false }; return; } const planet = (s().systemPlanets ?? [])[0]; if (!planet) { report.textContent = 'FAIL — no planet'; window.__trestleHold = { ok: false }; return; } // The real arm: a foreign system, a planet discovery. s().isHomeSystem = false; s().celebrateDiscovery({ id: planet.discoveryId, x: planet.x, y: planet.y, radius: planet.radius, name: planet.discoveryName, typeLabel: 'Rocky World', }); const up = await until(() => { const sc = s(); return sc.comms.active && sc.comms.current?.id === 'trestle-meetup' && sc.comms.box?.video && sc.comms.box?._decFinished === true ? sc : null; }, 30000); if (!up) { report.textContent = 'FAIL — trestle-meetup never came up'; window.__trestleHold = { ok: false }; return; } const box = s().comms.box; // Catch a visible pulse phase for the shot. await until(() => (box?._ringA?.alpha ?? 0) > 0.5, 4000); const el = box.video?.video; window.__trestleHold = { ok: true, box: { x: box.x, y: box.y, w: box.W, h: box.H }, clip: el ? { paused: el.paused, muted: el.muted, loop: el.loop, src: (el.currentSrc ?? '').split('/').pop() } : null, voice: s().sound?.isPlaying('comms_au_trestle-intro-01'), }; report.textContent = 'TRESTLE HOLD: box ' + box.W + '×' + box.H + ' clip=' + (el ? el.currentSrc.split('/').pop() : '—'); }, 600);