Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion scripts/smoke-secondary-journeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
18 changes: 18 additions & 0 deletions src/__tests__/LevelTraversalQualityContract.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
24 changes: 20 additions & 4 deletions src/scenes/PlatformerLevelScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -7413,6 +7428,7 @@ class PlatformerLevelScene extends Phaser.Scene {

this.currentEcologyNode = {
config,
supportId: config.supportId || null,
x,
y,
snapshot,
Expand Down
19 changes: 16 additions & 3 deletions src/scenes/levels/ReefLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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();
Expand All @@ -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],
Expand Down Expand Up @@ -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() {
Expand Down