mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-05-14 19:25:37 +08:00
Refine pilot monitoring communication flow
This commit is contained in:
@@ -472,6 +472,10 @@ export default function useCommunicationsEngine() {
|
||||
communicationLog.value.push(entry)
|
||||
}
|
||||
|
||||
function renderATCMessage(tpl: string) {
|
||||
return renderTpl(tpl, exposeCtx())
|
||||
}
|
||||
|
||||
function exposeCtx() {
|
||||
return { variables: variables.value, flags: flags.value }
|
||||
}
|
||||
@@ -490,6 +494,12 @@ export default function useCommunicationsEngine() {
|
||||
return flags.value.current_unit
|
||||
}
|
||||
|
||||
function getStateDetails(stateId: string) {
|
||||
const s = states.value[stateId]
|
||||
if (!s) return null
|
||||
return { ...s, id: stateId }
|
||||
}
|
||||
|
||||
function genStand() {
|
||||
const arr = ['A12','B15','C23','D8','E41','F18','G7','H33']
|
||||
return arr[Math.floor(Math.random() * arr.length)]
|
||||
@@ -568,6 +578,8 @@ export default function useCommunicationsEngine() {
|
||||
resumePriorFlow,
|
||||
|
||||
// Utilities
|
||||
normalizeATCText
|
||||
normalizeATCText,
|
||||
renderATCMessage,
|
||||
getStateDetails
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user