From 7e05a93d5e5bf3dc984e11420a130f470cceceb4 Mon Sep 17 00:00:00 2001 From: Timmy Date: Mon, 13 Apr 2026 21:58:56 -0400 Subject: [PATCH] beacon: preserve the Unbuilding prompt during renders --- js/render.js | 6 ++++++ tests/dismantle.test.cjs | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/js/render.js b/js/render.js index 0452aab..aee4210 100644 --- a/js/render.js +++ b/js/render.js @@ -37,6 +37,12 @@ function renderStrategy() { function renderAlignment() { const container = document.getElementById('alignment-ui'); if (!container) return; + + if (G.dismantleTriggered && !G.dismantleActive && !G.dismantleComplete && typeof Dismantle !== 'undefined' && Dismantle.triggered) { + Dismantle.renderChoice(); + return; + } + if (G.pendingAlignment) { container.innerHTML = `
diff --git a/tests/dismantle.test.cjs b/tests/dismantle.test.cjs index cacaffc..ba1c85f 100644 --- a/tests/dismantle.test.cjs +++ b/tests/dismantle.test.cjs @@ -209,6 +209,7 @@ this.__exports = { G, Dismantle, tick, + renderAlignment: typeof renderAlignment === 'function' ? renderAlignment : null, saveGame: typeof saveGame === 'function' ? saveGame : null, loadGame: typeof loadGame === 'function' ? loadGame : null };`, context); @@ -242,6 +243,25 @@ test('tick offers the Unbuilding instead of ending the game immediately', () => assert.match(document.getElementById('alignment-ui').innerHTML, /THE UNBUILDING/); }); +test('renderAlignment does not wipe the Unbuilding prompt after it is offered', () => { + const { G, tick, renderAlignment, document } = loadBeacon({ includeRender: true }); + + G.totalCode = 1_000_000_000; + G.totalRescues = 100_000; + G.phase = 6; + G.pactFlag = 1; + G.harmony = 60; + G.beaconEnding = false; + G.running = true; + G.activeProjects = []; + G.completedProjects = []; + + tick(); + renderAlignment(); + + assert.match(document.getElementById('alignment-ui').innerHTML, /THE UNBUILDING/); +}); + test('deferring the Unbuilding clears the prompt and allows it to return later', () => { const { G, Dismantle, document } = loadBeacon();