diff --git a/Moose Development/Moose/Ops/Awacs.lua b/Moose Development/Moose/Ops/Awacs.lua index 617cff753..451d35f8f 100644 --- a/Moose Development/Moose/Ops/Awacs.lua +++ b/Moose Development/Moose/Ops/Awacs.lua @@ -91,6 +91,8 @@ do -- @field #boolean PlayerGuidance if true additional callouts to guide/warn players -- @field #boolean ModernEra if true we get more intel on targets, and EPLR on the AIC -- @field #boolean callsignshort if true use short (group) callsigns, e.g. "Ghost 1", else "Ghost 1 1" +-- @field #boolean keepnumber if true, use the full string after # for a player custom callsign +-- @field #table callsignTranslations optional translations for callsigns -- @field #number MeldDistance 25nm - distance for "Meld" Call , usually shortly before the actual engagement -- @field #number TacDistance 30nm - distance for "TAC" Call -- @field #number ThreatDistance 15nm - distance to declare untargeted (new) threats @@ -561,6 +563,8 @@ AWACS = { PlayerGuidance = true, ModernEra = true, callsignshort = true, + keepnumber = true, + callsignTranslations = nil, TacDistance = 45, MeldDistance = 35, ThreatDistance = 25, @@ -2222,39 +2226,29 @@ function AWACS:_GetCallSign(Group,GID, IsPlayer) 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+)') - self:I("CallSign = " .. callsignroot) - local groupname = Group:GetName() - local callnumber = string.match(shortcallsign, "(%d+)$" ) or "unknown11" - local callnumbermajor = string.char(string.byte(callnumber,1)) - local callnumberminor = string.char(string.byte(callnumber,2)) - local personalized = false - if IsPlayer and string.find(groupname,"#") then - -- personalized flight name in group naming - shortcallsign = string.match(groupname,"#([%a]+)") - personalized = true - end - if IsPlayer and string.find(Group:GetPlayerName(),"|") then - -- personalized flight name in group naming - shortcallsign = string.match(Group:GetPlayerName(),"| ([%a]+)") - personalized = true - end - if (not personalized) and self.callsignTranslations and self.callsignTranslations[callsignroot] then - shortcallsign = string.gsub(shortcallsign, callsignroot, self.callsignTranslations[callsignroot]) - end - - if self.callsignshort then - callsign = string.gsub(shortcallsign,callnumber,"").." "..callnumbermajor - else - callsign = string.gsub(shortcallsign,callnumber,"").." "..callnumbermajor.." "..callnumberminor - end - self:T("Generated Callsign for TTS = " .. callsign) - end - + callsign = Group:GetCustomCallSign(self.callsignshort,self.keepnumber,self.callsignTranslations) + end return callsign end +--- [User] Set player callsign options for TTS output. See @{Wrapper.Group#GROUP.GetCustomCallSign}() on how to set customized callsigns. +-- @param #AWACS self +-- @param #boolean ShortCallsign If true, only call out the major flight number +-- @param #boolean Keepnumber If true, keep the **customized callsign** in the #GROUP name as-is, no amendments or numbers. +-- @param #table CallsignTranslations (optional) Table to translate between DCS standard callsigns and bespoke ones. Does not apply if using customized +-- callsigns from playername or group name. +-- @return #AWACS self +function AWACS:SetCallSignOptions(ShortCallsign,Keepnumber,CallsignTranslations) + if not ShortCallsign or ShortCallsign == false then + self.callsignshort = false + else + self.callsignshort = true + end + self.keepnumber = Keepnumber or false + self.callsignTranslations = CallsignTranslations + return self +end + --- [Internal] Update contact from cluster data -- @param #AWACS self -- @param #number CID Contact ID @@ -4303,55 +4297,7 @@ function AWACS:_ReadAssignedGroupFromTID(TaskID) end return nil end - ---- [Internal] Create new idle task from contact to pick up later --- @param #AWACS self --- @param #string Description Task Type --- @param #table Object Object of TARGET --- @param Ops.Intelligence#INTEL.Contact Contact --- @return #AWACS self -function AWACS:_CreateIdleTaskForContact(Description,Object,Contact) - self:T(self.lid.."_CreateIdleTaskForContact "..Description) - local task = {} -- #AWACS.ManagedTask - self.ManagedTaskID = self.ManagedTaskID + 1 - task.TID = self.ManagedTaskID - task.AssignedGroupID = 0 - task.Status = AWACS.TaskStatus.IDLE - task.ToDo = Description - task.Target = TARGET:New(Object) - task.Contact = Contact - task.ScreenText = Description - if Description == AWACS.TaskDescription.ANCHOR or Description == AWACS.TaskDescription.REANCHOR then - task.Target.Type = TARGET.ObjectType.ZONE - end - self.ManagedTasks:Push(task,task.TID) - return self -end - ---- [Internal] Create new idle task from cluster to pick up later --- @param #AWACS self --- @param #string Description Task Type --- @param #table Object Object of TARGET --- @param Ops.Intelligence#INTEL.Cluster Cluster --- @return #AWACS self -function AWACS:_CreateIdleTaskForCluster(Description,Object,Cluster) - self:T(self.lid.."_CreateIdleTaskForCluster "..Description) - local task = {} -- #AWACS.ManagedTask - self.ManagedTaskID = self.ManagedTaskID + 1 - task.TID = self.ManagedTaskID - task.AssignedGroupID = 0 - task.Status = AWACS.TaskStatus.IDLE - task.ToDo = Description - task.Target = TARGET:New(self.intel:GetClusterCoordinate(Cluster)) - task.Cluster = Cluster - task.ScreenText = Description - if Description == AWACS.TaskDescription.ANCHOR or Description == AWACS.TaskDescription.REANCHOR then - task.Target.Type = TARGET.ObjectType.ZONE - end - self.ManagedTasks:Push(task,task.TID) - return self -end - + --- [Internal] Create radio entry to tell players that CAP is on station in Anchor -- @param #AWACS self -- @param #number GID Group ID