AWACS - added the ability to use custom callsigns with TTS/messaging (#1745)

* AWACS - added the ability to use custom callsigns with TTS. Revised section 5.1 of documentation to demonstrate

* AWACS - Added nil check to callsign construction when looking for replacement
This commit is contained in:
Anthony De Vellis 2022-07-12 02:13:24 -04:00 committed by GitHub
parent 5ad88be997
commit 0e4d731068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -252,6 +252,14 @@ do
-- testawacs:SetAwacsDetails(CALLSIGN.AWACS.Wizard)
-- -- And start as GCI using a group name "Blue EWR" as main EWR station
-- testawacs:SetAsGCI(GROUP:FindByName("Blue EWR"),2)
-- -- Set Custom Callsigns for use with TTS
-- testawacs:SetCustomCallsigns({
-- Devil = 'Bengal',
-- Snake = 'Winder',
-- Colt = 'Camelot',
-- Enfield = 'Victory',
-- Uzi = 'Evil Eye'
-- })
-- testawacs:__Start(4)
--
-- ## 6 Menu entries
@ -944,6 +952,7 @@ function AWACS:New(Name,AirWing,Coalition,AirbaseName,AwacsOrbit,OpsZone,Station
-- managed groups
self.ManagedGrps = {} -- #table of #AWACS.ManagedGroup entries
self.ManagedGrpID = 0
self.callsignTranslations = nil
-- Anchor stacks init
self.AnchorStacks = FIFO:New() -- Utilities.FiFo#FIFO
@ -960,7 +969,7 @@ function AWACS:New(Name,AirWing,Coalition,AirbaseName,AwacsOrbit,OpsZone,Station
-- Task lists
self.ManagedTasks = FIFO:New() -- Utilities.FiFo#FIFO
--self.OpenTasks = FIFO:New() -- Utilities.FiFo#FIFO
-- Monitoring, init
local MonitoringData = {} -- #AWACS.MonitoringData
MonitoringData.AICAPCurrent = 0
@ -1265,6 +1274,14 @@ function AWACS:ZipLip()
return self
end
--- [User] Replace ME callsigns with user-defined callsigns for use with TTS and on-screen messaging
-- @param #AWACS self
-- @param #table table with DCS callsigns as keys and replacements as values
-- @return #AWACS self
function AWACS:SetCustomCallsigns(translationTable)
self.callsignTranslations = translationTable
end
--- [Internal] Event handler
-- @param #AWACS self
-- @param Wrapper.Group#GROUP Group Group, can also be passed as #string group name
@ -1933,6 +1950,11 @@ function AWACS:_GetCallSign(Group,GID)
local callsign = "Ghost 1"
if Group and Group:IsAlive() then
local shortcallsign = Group:GetCallsign() or "unknown11"-- e.g.Uzi11, but we want Uzi 1 1
local callsignroot = string.match(shortcallsign, '(%a+)')
if self.callsignTranslations and self.callsignTranslations[callsignroot] then
shortcallsign = string.gsub(shortcallsign, callsignroot, self.callsignTranslations[callsignroot])
end
local groupname = Group:GetName()
local callnumber = string.match(shortcallsign, "(%d+)$" ) or "unknown11"
local callnumbermajor = string.char(string.byte(callnumber,1))
@ -1948,6 +1970,7 @@ function AWACS:_GetCallSign(Group,GID)
end
self:T("Generated Callsign for TTS = " .. callsign)
end
return callsign
end