diff --git a/js/scenes/GameScene.js b/js/scenes/GameScene.js index 1f50b56..3da13f8 100644 --- a/js/scenes/GameScene.js +++ b/js/scenes/GameScene.js @@ -9737,6 +9737,29 @@ export class GameScene extends Phaser.Scene { } } + /** + * The MAX effects.mining.capacity across a restore's build records + * (r.builds.built — planet → build ids — the same source + * _restoreMiningUpgrades reads once those records are back in + * buildState). applyRestore calls this to raise the hold cap BEFORE + * setMinerals, so a save holding more minerals than the base cap (250) + * survives the load / jump-cut instead of being clamped to 250. Returns + * the ship's current cap when no record expands it. + */ + _miningCapacityFromBuilds(builds) { + let cap = Number(this.ship?.stats?.mineralStorage) || 0; + const built = builds?.built; + if (built && typeof built === 'object') { + for (const ids of Object.values(built)) { + for (const id of Array.isArray(ids) ? ids : []) { + const c = Number(defById(id)?.effects?.mining?.capacity); + if (Number.isFinite(c) && c > cap) cap = c; + } + } + } + return cap; + } + /** * Re-derive the ship's mining upgrades from the build RECORDS (the * save carries the records, not the ship's derived stats): the MAX @@ -10230,8 +10253,17 @@ export class GameScene extends Phaser.Scene { this.ship.setPosition(Number(r.ship.x) || 0, Number(r.ship.y) || 0); if (typeof r.ship.heading === 'number') this.ship.rotation = r.ship.heading; // The hold — saves that predate minerals have no field (stay at 0); - // setMinerals clamps to the ship's capacity. - if (typeof r.ship.minerals === 'number') this.ship.setMinerals(r.ship.minerals); + // setMinerals clamps to the ship's capacity. The hold CAP's source + // of truth is the save's build records (effects.mining.capacity — + // restored into buildState below, re-asserted by + // _restoreMiningUpgrades after create), so raise it BEFORE the + // minerals land: a save with more minerals than the base cap (250) + // must not be clamped away. + if (typeof r.ship.minerals === 'number') { + const cap = this._miningCapacityFromBuilds(r.builds); + if (cap > (Number(this.ship.stats?.mineralStorage) || 0)) this.ship.stats.mineralStorage = cap; + this.ship.setMinerals(r.ship.minerals); + } // The credit ledger (data/economy.json) — a save predating credits // has no field; setCredits floors a missing/invalid value at 0. this.ship.setCredits(r.ship.credits ?? 0); diff --git a/js/scenes/SurfaceScene.js b/js/scenes/SurfaceScene.js index 418d870..c35d825 100644 --- a/js/scenes/SurfaceScene.js +++ b/js/scenes/SurfaceScene.js @@ -387,6 +387,10 @@ export class SurfaceScene extends Phaser.Scene { if (!s.live || s.id === 'shop') continue; // SHOP is the way out bar.setSlotEnabled(s.id, !locked); } + // Re-assert the EXPLORE story gate (idempotent): the blanket re-arm + // above would lift its standby underneath the gate (open the shop, + // leave it, and Explore would come back live pre-'Special Delivery'). + this._syncExploreLock(); } /** @@ -536,6 +540,9 @@ export class SurfaceScene extends Phaser.Scene { if (!s.live) continue; deck.setSlotEnabled(s.id, !locked); } + // Re-assert the EXPLORE story gate (idempotent): the blanket + // re-arm above must not lift its standby underneath the gate. + this._syncExploreLock(); } const drawer = this.exploreSubBar; if (drawer && Array.isArray(drawer.buttons)) { diff --git a/js/ui/BuildWindow.js b/js/ui/BuildWindow.js index 285c17b..15fe480 100644 --- a/js/ui/BuildWindow.js +++ b/js/ui/BuildWindow.js @@ -369,6 +369,7 @@ export class BuildWindow extends Phaser.GameObjects.Container { }); this.closeG.on('pointerover', () => { this.closeBtn.hover = true; + this.sfx('ui_hover'); this._paintClose(); }); this.closeG.on('pointerout', () => { @@ -781,7 +782,6 @@ export class BuildWindow extends Phaser.GameObjects.Container { }); g.on('pointerover', () => { row.hover = true; - this.sfx('ui_hover'); this._paintRow(row); }); g.on('pointerout', () => { diff --git a/js/ui/ResearchWindow.js b/js/ui/ResearchWindow.js index 8e33e6a..ab5d59f 100644 --- a/js/ui/ResearchWindow.js +++ b/js/ui/ResearchWindow.js @@ -351,6 +351,7 @@ export class ResearchWindow extends Phaser.GameObjects.Container { }); this.closeG.on('pointerover', () => { this.closeBtn.hover = true; + this.sfx('ui_hover'); this._paintClose(); }); this.closeG.on('pointerout', () => { @@ -887,7 +888,6 @@ export class ResearchWindow extends Phaser.GameObjects.Container { }); g.on('pointerover', () => { node.hover = true; - this.sfx('ui_hover'); this._paintNode(node); }); g.on('pointerout', () => {