mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-11 12:05:33 +08:00
feat(frequency): offer the destination's stations, and mark what is out of range
The radio only ever held one airport's frequencies, loaded once at the start, so on a departure the destination's Tower never appeared however close you got — there was no way to dial ahead. Both ends of the flight are now listed: the field being flown first and unlabelled, the far end after it, tagged with its ICAO and drawn with a dashed border so it reads as somewhere else. The destination's stations are kept in their own list rather than merged into the primary one, because everything that resolves *which frequency this phase expects* — the frequency map, the expected frequency, the wrong-frequency gate, the ATIS wiring — reads that list, and folding a second airport's Tower into it would let the gate accept the wrong field's frequency. Out-of-range stations are dimmed rather than removed: VHF is line-of-sight, so a station unreachable on the ground is workable from the cruise, and it should come back as you climb. The distances come from the backend, which already derives them and now returns them — the browser does not need its own copy of the airport coordinates for this. With no bridge connected, nothing is dimmed at all. That is the normal case for someone practising without a simulator, and a station that cannot be *proven* out of range must not be taken away.
This commit is contained in:
@@ -92,6 +92,7 @@ export function useLiveAtcSession(
|
||||
expectedFrequencyForState, acceptedFrequenciesForState,
|
||||
runwayInUse, informationLetter, atisReport,
|
||||
fetchAirportFrequencies, setActiveFrequencyFromList,
|
||||
fetchDestinationFrequencies, applyDerivedPosition,
|
||||
} = freq
|
||||
|
||||
const {
|
||||
@@ -337,6 +338,10 @@ export function useLiveAtcSession(
|
||||
currentScreen.value = 'complete'
|
||||
}
|
||||
|
||||
// Position-derived distances, used to work out which ground stations are
|
||||
// still within VHF range. Absent without a bridge — then nothing is ranged.
|
||||
applyDerivedPosition((response as any).derived_position)
|
||||
|
||||
// Re-arm (or clear) the silence auto-advance for whatever state we're now on.
|
||||
armSilenceTimer()
|
||||
// And dial in the new frequency if this decision handed us to one.
|
||||
@@ -629,6 +634,13 @@ export function useLiveAtcSession(
|
||||
// Fetch real airport frequencies BEFORE building backendVariables so that
|
||||
// all freq vars are resolved from live VATSIM/OpenAIP data.
|
||||
await fetchAirportFrequencies(scenarioIcao)
|
||||
// The other end of the flight, so its stations can be dialled ahead of time.
|
||||
// Best-effort and not awaited on the critical path: the flight is entirely
|
||||
// flyable without them.
|
||||
const otherIcao = scenario.airport === 'arr'
|
||||
? (flightPlan.dep || flightPlan.departure)
|
||||
: (flightPlan.arr || flightPlan.arrival)
|
||||
void fetchDestinationFrequencies(otherIcao)
|
||||
|
||||
// Runway and information letter from the resolved ATIS (the flight plan
|
||||
// carries neither). The report always has a letter, and has a runway
|
||||
|
||||
Reference in New Issue
Block a user