From 693a67f17a8d7345c87b4d8ed40e9b12bb7932d1 Mon Sep 17 00:00:00 2001 From: TechEvolveAI Date: Fri, 14 Aug 2026 13:46:42 +0100 Subject: [PATCH] Clarify the Stellar Reef opening --- scripts/smoke-secondary-journeys.js | 43 ++++++++++++++++++- .../LevelTraversalQualityContract.test.js | 18 ++++++++ src/scenes/PlatformerLevelScene.js | 24 +++++++++-- src/scenes/levels/ReefLevel.js | 19 ++++++-- 4 files changed, 96 insertions(+), 8 deletions(-) diff --git a/scripts/smoke-secondary-journeys.js b/scripts/smoke-secondary-journeys.js index 106f6a6f..b4901338 100644 --- a/scripts/smoke-secondary-journeys.js +++ b/scripts/smoke-secondary-journeys.js @@ -2366,6 +2366,35 @@ async function smokeLevel(session, route, sceneName, exceptions, { item => item === scene.entryCosmicParticleLayer ).length || 0 } : null, + currentEcologyPlacement: scene?.currentEcologyNode ? (() => { + const node = scene.currentEcologyNode; + const support = node.supportId + ? scene.getTraversalSupport?.(node.supportId) + : null; + return { + supportId: node.supportId || null, + x: Number(node.x), + y: Number(node.y), + supportLeft: Number(support?.body?.left), + supportRight: Number(support?.body?.right), + supportTop: Number(support?.body?.top), + spawnDistance: Math.hypot( + Number(node.x) - Number(scene.playerSpawnX || 200), + Number(node.y) - Number(scene.playerSpawnY || ( + scene.levelHeight - 290 + )) + ) + }; + })() : null, + reefOpeningGuidance: scene?.openingSignalCurrent ? { + departureCueX: Number( + scene.openingSignalCurrent.departureCue?.x + ), + departureCueY: Number( + scene.openingSignalCurrent.departureCue?.y + ), + active: scene.openingSignalCurrent.visual?.active !== false + } : null, peaksAmbientRendering: Array.isArray(scene?.peakStarField) ? { starCount: scene.peakStarField.filter( star => star?.batched @@ -2456,7 +2485,19 @@ async function smokeLevel(session, route, sceneName, exceptions, { state.reefAmbientRendering?.riftLayerCount !== 1 || state.reefAmbientRendering?.dustLayerCount !== 1 || state.reefAmbientRendering?.dustParticleCount > 12 || - state.reefAmbientRendering?.entryLayerCount > 1 + state.reefAmbientRendering?.entryLayerCount > 1 || + state.currentEcologyPlacement?.supportId !== 'reef-opening-3' || + state.currentEcologyPlacement?.x < + state.currentEcologyPlacement?.supportLeft || + state.currentEcologyPlacement?.x > + state.currentEcologyPlacement?.supportRight || + Math.abs( + state.currentEcologyPlacement?.y - + state.currentEcologyPlacement?.supportTop + ) > 8 || + state.currentEcologyPlacement?.spawnDistance < 450 || + state.reefOpeningGuidance?.active !== true || + state.reefOpeningGuidance?.departureCueX > 360 ) ) { throw new Error( diff --git a/src/__tests__/LevelTraversalQualityContract.test.js b/src/__tests__/LevelTraversalQualityContract.test.js index b52734b3..8001d4c1 100644 --- a/src/__tests__/LevelTraversalQualityContract.test.js +++ b/src/__tests__/LevelTraversalQualityContract.test.js @@ -2264,12 +2264,30 @@ describe('campaign traversal quality contracts', () => { test('Stellar Reef visibly links its spawn to the first drift signal', () => { const source = read('levels/ReefLevel.js'); + const shared = read('PlatformerLevelScene.js'); expect(source).toContain('this.createOpeningSignalCurrent();'); expect(source).toContain('DRIFT SIGNAL 01 →'); + expect(source).toContain('x: 335'); + expect(source).toContain('[departureCue.x, departureCue.y]'); + expect(source).toContain('const isMobile = this.isMobile || ('); + expect(source).toContain('JOYSTICK MOVES + DIVES'); + expect(source).toContain('↑ BUTTON SWIMS UP'); expect(source).toContain('visual.lineTo(destinationX, destinationY);'); expect(source).toContain('this.retireOpeningSignalCurrent();'); expect(source).toContain("current.label?.setText?.('DRIFT SIGNAL LINKED')"); + expect(shared).toContain("supportId: 'reef-opening-3'"); + expect(shared).toContain('this.getTraversalSupportCheckpoint?.('); + expect(shared).toContain('supportTop + 5'); + + const smoke = fs.readFileSync( + path.join(__dirname, '../../scripts/smoke-secondary-journeys.js'), + 'utf8' + ); + expect(smoke).toContain('currentEcologyPlacement'); + expect(smoke).toContain("supportId !== 'reef-opening-3'"); + expect(smoke).toContain('spawnDistance < 450'); + expect(smoke).toContain('departureCueX > 360'); }); test('Stellar Reef binds every required waypoint to a distinct relay support', () => { diff --git a/src/scenes/PlatformerLevelScene.js b/src/scenes/PlatformerLevelScene.js index 6e9ceb62..69ff2141 100644 --- a/src/scenes/PlatformerLevelScene.js +++ b/src/scenes/PlatformerLevelScene.js @@ -96,8 +96,9 @@ const CURRENT_NODE_LEVEL_CONFIG = Object.freeze({ label: 'CRYSTAL CURRENT' }), reef_1: Object.freeze({ - x: 260, - groundOffset: 145, + x: 850, + groundOffset: 445, + supportId: 'reef-opening-3', label: 'REEF CURRENT' }), void_peaks_1: Object.freeze({ @@ -7334,8 +7335,22 @@ class PlatformerLevelScene extends Phaser.Scene { const snapshot = ecology.getCurrentRegionSnapshot(window.GameState, this.levelId); if (!snapshot) return null; - const x = config.x; - const y = this.levelHeight - config.groundOffset; + const support = config.supportId + ? this.getTraversalSupport?.(config.supportId) + : null; + const supportCheckpoint = support?.body + ? this.getTraversalSupportCheckpoint?.( + config.supportId, + support.x + ) + : null; + const supportTop = Number(support?.body?.top); + const x = Number.isFinite(Number(supportCheckpoint?.x)) + ? Number(supportCheckpoint.x) + : config.x; + const y = Number.isFinite(supportTop) + ? supportTop + 5 + : this.levelHeight - config.groundOffset; const compactNodeLayout = this.isMobile || this.cameras.main.height < 620; const fieldWash = this.add.rectangle( @@ -7413,6 +7428,7 @@ class PlatformerLevelScene extends Phaser.Scene { this.currentEcologyNode = { config, + supportId: config.supportId || null, x, y, snapshot, diff --git a/src/scenes/levels/ReefLevel.js b/src/scenes/levels/ReefLevel.js index 56d27d99..b6bd130b 100644 --- a/src/scenes/levels/ReefLevel.js +++ b/src/scenes/levels/ReefLevel.js @@ -467,10 +467,12 @@ class ReefLevel extends PlatformerLevelScene { }).setScrollFactor(0).setDepth(3002); // Controls hint - mobile-aware - const isMobile = 'ontouchstart' in window && window.innerWidth < 768; + const isMobile = this.isMobile || ( + 'ontouchstart' in window && window.innerWidth < 768 + ); const controlsHint = this.add.text(width / 2, y(420), isMobile - ? 'STEER IN ANY DIRECTION\nJUMP also swims upward' + ? 'JOYSTICK MOVES + DIVES\n↑ BUTTON SWIMS UP' : 'ARROWS / WASD TO SWIM // SPACE ASCENDS', { fontSize: isMobile ? font(13, 12) : font(11, 10), color: '#9370DB', @@ -1438,6 +1440,10 @@ class ReefLevel extends PlatformerLevelScene { const firstWaypoint = this.beaconAnchors[0]; const destinationX = firstWaypoint?.x || 1250; const destinationY = firstWaypoint?.y || 700; + const departureCue = { + x: 335, + y: this.levelHeight - 300 + }; const visual = this.add.graphics().setDepth(114); visual.lineStyle(5, 0x8FE3CF, 0.58); visual.beginPath(); @@ -1450,6 +1456,7 @@ class ReefLevel extends PlatformerLevelScene { visual.fillStyle(0xF2C94C, 0.92); [ + [departureCue.x, departureCue.y], [430, this.levelHeight - 338], [690, this.levelHeight - 465], [950, this.levelHeight - 520], @@ -1479,7 +1486,13 @@ class ReefLevel extends PlatformerLevelScene { repeat: -1, ease: 'Sine.easeInOut' }); - this.openingSignalCurrent = { visual, label, pulseTween, retired: false }; + this.openingSignalCurrent = { + visual, + label, + pulseTween, + departureCue, + retired: false + }; } retireOpeningSignalCurrent() {