feat(atc): integrate OSM taxi routing into engine

Fetches taxi route from /api/service/tools/taxiroute when request_taxi
or contact_ground_arrival interactions are chosen. Populates vars.taxi_route
or vars.arrival_taxi_route before ATC template is rendered.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
itsrubberduck
2026-02-15 00:03:06 +01:00
parent b27cffd8d1
commit c5e9e6e75b

View File

@@ -190,6 +190,29 @@ export function useAtcEngine() {
const interaction = phase.interactions.find(i => i.id === res.chosen)
if (!interaction) throw new Error(`Interaction not found: ${res.chosen}`)
// 4b. Fetch taxi route if needed (before rendering template)
if (
(interaction.id === 'request_taxi' || interaction.id === 'contact_ground_arrival')
&& state.vars.dep
) {
try {
const taxiField = interaction.id === 'request_taxi' ? 'taxi_route' : 'arrival_taxi_route'
const originName = interaction.id === 'request_taxi' ? state.vars.stand : state.vars.arrival_runway
const destName = interaction.id === 'request_taxi' ? state.vars.runway : state.vars.arrival_stand
const airport = interaction.id === 'request_taxi' ? state.vars.dep : state.vars.dest
if (originName && destName && airport) {
const taxiRes = await $fetch<any>('/api/service/tools/taxiroute', {
params: { airport, origin_name: originName, dest_name: destName },
})
if (taxiRes?.names_collapsed?.length) {
state.vars[taxiField] = taxiRes.names_collapsed.join(' ')
}
}
} catch (e) {
console.warn('[engine] Taxi route fetch failed, using fallback:', e)
}
}
// 5. Apply updates
let variablesUpdated: Record<string, any> = {}
if (interaction.updates) {