import { findNearestPartyNavigationSurface, findPartyNavigationPath, } from "../../../src/game/partyNavigation.ts"; /** * Audits the authored entrance -> boss -> boss sequence against the packaged * navigation graph. Every leg starts at its true authored predecessor, even * when that predecessor is outside the retained runtime surface. */ export function auditOrderedObjectiveRoutes(graph, entrance, bosses) { const routes = []; let origin = entrance; let originName = "entrance"; for (const boss of bosses) { const approach = findNearestPartyNavigationSurface(graph, boss.position, 6); const route = approach ? findPartyNavigationPath(graph, origin, approach.position, { maxStartSnapDistance: 3, maxEndSnapDistance: 6, simplifyTolerance: 0.01, }) : null; routes.push({ from: originName, to: boss.name, objectiveId: boss.id, approachPosition: approach?.position ?? null, objectiveProjectionDistance: approach?.distance ?? null, reachable: Boolean(route?.length), waypointCount: route?.length ?? 0, }); // Preserve the runtime's projected approach when one exists. If the boss // has no retained-surface approach, keep its authored position so the next // leg remains truthfully anchored to that predecessor instead of silently // falling back to an older, reachable objective. origin = approach?.position ?? boss.position; originName = boss.name; } return routes; }