* Minor Enhancements
This commit is contained in:
Applevangelist 2022-11-08 17:24:32 +01:00
parent bad17c39d1
commit e348bbc344

View File

@ -17,7 +17,7 @@
-- === -- ===
-- --
-- ### Author: **applevangelist** -- ### Author: **applevangelist**
-- @date Last Update September 2022 -- @date Last Update November 2022
-- @module Ops.AWACS -- @module Ops.AWACS
-- @image OPS_AWACS.jpg -- @image OPS_AWACS.jpg
@ -497,7 +497,7 @@ do
-- @field #AWACS -- @field #AWACS
AWACS = { AWACS = {
ClassName = "AWACS", -- #string ClassName = "AWACS", -- #string
version = "0.2.46", -- #string version = "0.2.47", -- #string
lid = "", -- #string lid = "", -- #string
coalition = coalition.side.BLUE, -- #number coalition = coalition.side.BLUE, -- #number
coalitiontxt = "blue", -- #string coalitiontxt = "blue", -- #string
@ -1980,22 +1980,16 @@ function AWACS:_MessageVector(GID,Tag,Coordinate,Angels)
local group = managedgroup.Group local group = managedgroup.Group
local groupposition = group:GetCoordinate() local groupposition = group:GetCoordinate()
--local BRtext = Coordinate:ToStringBR(groupposition)
local BRtext,BRtextTTS = self:_ToStringBR(groupposition,Coordinate) local BRtext,BRtextTTS = self:_ToStringBR(groupposition,Coordinate)
local vector = self.gettext:GetEntry("VECTORTO",self.locale) local vector = self.gettext:GetEntry("VECTORTO",self.locale)
local vectortts = self.gettext:GetEntry("VECTORTOTTS",self.locale) local vectortts = self.gettext:GetEntry("VECTORTOTTS",self.locale)
local angelstxt = self.gettext:GetEntry("ANGELS",self.locale) local angelstxt = self.gettext:GetEntry("ANGELS",self.locale)
--local text = string.format("%s, %s. Vector%s %s",tocallsign, self.callsigntxt,Tag,BRtextTTS)
--local textScreen = string.format("%s, %s, Vector%s %s",tocallsign, self.callsigntxt,Tag,BRtext)
local text = string.format(vectortts,tocallsign, self.callsigntxt,Tag,BRtextTTS) local text = string.format(vectortts,tocallsign, self.callsigntxt,Tag,BRtextTTS)
local textScreen = string.format(vector,tocallsign, self.callsigntxt,Tag,BRtext) local textScreen = string.format(vector,tocallsign, self.callsigntxt,Tag,BRtext)
if Angels then if Angels then
--text = text .. ". Angels "..tostring(Angels).."."
--textScreen = textScreen .. ". Angels "..tostring(Angels).."."
text = text .. angelstxt ..tostring(Angels).."." text = text .. angelstxt ..tostring(Angels).."."
textScreen = textScreen ..angelstxt..tostring(Angels).."." textScreen = textScreen ..angelstxt..tostring(Angels).."."
end end
@ -2215,7 +2209,7 @@ end
-- @param #AWACS self -- @param #AWACS self
-- @param Wrapper.Group#GROUP Group Group to use -- @param Wrapper.Group#GROUP Group Group to use
-- @param #number GID GID to use -- @param #number GID GID to use
-- @param #booean IsPlayer Check in player if true -- @param #boolean IsPlayer Check in player if true
-- @return #string Callsign -- @return #string Callsign
function AWACS:_GetCallSign(Group,GID, IsPlayer) function AWACS:_GetCallSign(Group,GID, IsPlayer)
self:T(self.lid.."_GetCallSign - GID "..tostring(GID)) self:T(self.lid.."_GetCallSign - GID "..tostring(GID))
@ -2326,14 +2320,13 @@ function AWACS:_CleanUpContacts()
self.Contacts:ForEach( self.Contacts:ForEach(
function (Contact) function (Contact)
local contact = Contact -- #AWACS.ManagedContact local contact = Contact -- #AWACS.ManagedContact
if not contact.Contact.group:IsAlive() or contact.Target:IsDead() then if not contact.Contact.group:IsAlive() or contact.Target:IsDead() or contact.Target:IsDestroyed() or contact.Target:CountTargets() == 0 then
deadcontacts:Push(contact,contact.CID) deadcontacts:Push(contact,contact.CID)
self:T("DEAD contact CID="..contact.CID) self:T("DEAD contact CID="..contact.CID)
end end
end end
) )
--local aliveclusters = FIFO:New()
-- announce VANISHED -- announce VANISHED
if deadcontacts:Count() > 0 and (not self.NoGroupTags) then if deadcontacts:Count() > 0 and (not self.NoGroupTags) then
@ -2460,16 +2453,12 @@ function AWACS:_TargetSelectionProcess(Untargeted)
self:T(self.lid..string.format("Looking at group %s type %s",contactname,typename)) self:T(self.lid..string.format("Looking at group %s type %s",contactname,typename))
local contactcoord = contact.Cluster.coordinate or contact.Contact.position or contact.Contact.group:GetCoordinate() local contactcoord = contact.Cluster.coordinate or contact.Contact.position or contact.Contact.group:GetCoordinate()
local contactvec2 = contactcoord:GetVec2() local contactvec2 = contactcoord:GetVec2()
-- self:T({contactcoord:ToStringMGRS()})
-- self:T({contactvec2})
-- Bucket 0 - NOT in Rejection Zone :) -- Bucket 0 - NOT in Rejection Zone :)
if self.RejectZone then if self.RejectZone then
local isinrejzone = self.RejectZone:IsVec2InZone(contactvec2) local isinrejzone = self.RejectZone:IsVec2InZone(contactvec2)
--local distance = self.OpsZone:Get2DDistance(contactcoord)
if isinrejzone then if isinrejzone then
self:T(self.lid.."Across Border = YES - ignore") self:T(self.lid.."Across Border = YES - ignore")
--targettable:Push(contact,distance)
checked = true checked = true
end end
end end
@ -2517,7 +2506,6 @@ function AWACS:_TargetSelectionProcess(Untargeted)
if (AOdist2 < 75) or (aspect == "Hot") then if (AOdist2 < 75) or (aspect == "Hot") then
local text = string.format("In AO(Adj) dist = %d(%d) NM",AOdist,AOdist2) local text = string.format("In AO(Adj) dist = %d(%d) NM",AOdist,AOdist2)
self:T(self.lid..text) self:T(self.lid..text)
--if sizing > 2 then distance = math.floor(distance / sizing)+1 end
targettable:Push(contact,distance) targettable:Push(contact,distance)
checked = true checked = true
end end
@ -2602,7 +2590,7 @@ function AWACS:_CreatePicture(AO,Callsign,GID,MaxEntries,IsGeneral)
local contact = fifo:Pull() -- #AWACS.ManagedContact local contact = fifo:Pull() -- #AWACS.ManagedContact
self:T({contact}) self:T({contact})
if contact and contact.Contact.group and contact.Contact.group:IsAlive() then if contact and contact.Contact.group and contact.Contact.group:IsAlive() then
--local coordinate = contact.Contact.group:GetCoordinate()
local coordinate = contact.Cluster.coordinate or contact.Contact.position or contact.Contact.group:GetCoordinate() -- Core.Point#COORDINATE local coordinate = contact.Cluster.coordinate or contact.Contact.position or contact.Contact.group:GetCoordinate() -- Core.Point#COORDINATE
if not coordinate then if not coordinate then
self:E(self.lid.."NO Coordinate for this cluster! CID="..contact.CID) self:E(self.lid.."NO Coordinate for this cluster! CID="..contact.CID)
@ -2633,9 +2621,7 @@ function AWACS:_CreatePicture(AO,Callsign,GID,MaxEntries,IsGeneral)
local alt = contact.Contact.group:GetAltitude() or 8000 local alt = contact.Contact.group:GetAltitude() or 8000
alt = UTILS.Round(UTILS.MetersToFeet(alt)/1000,0) alt = UTILS.Round(UTILS.MetersToFeet(alt)/1000,0)
-- Alpha Group. Bulls eye 0 2 1, 16 miles, 25 thousand. -- Alpha Group. Bulls eye 0 2 1, 16 miles, 25 thousand.
--text = text .. " "..refBRAATTS.." miles, "..alt.." thousand." -- Alpha Group. Bulls eye 0 2 1, 16 miles, 25 thousand.
text = string.format("%s %s %s, %d %s.",text,refBRAATTS,milestxt,alt,thsdtxt) text = string.format("%s %s %s, %d %s.",text,refBRAATTS,milestxt,alt,thsdtxt)
--textScreen = textScreen .. " "..refBRAA.." miles, "..alt.." thousand." -- Alpha Group, Bullseye 021, 16 miles, 25 thousand,
textScreen = string.format("%s %s %s, %d %s.",textScreen,refBRAA,milestxt,alt,thsdtxt) textScreen = string.format("%s %s %s, %d %s.",textScreen,refBRAA,milestxt,alt,thsdtxt)
else else
-- pilot reference -- pilot reference
@ -2705,7 +2691,6 @@ function AWACS:_CreateBogeyDope(Callsign,GID)
local groupcoord = group:GetCoordinate() local groupcoord = group:GetCoordinate()
local fifo = self.ContactsAO -- Utilities.FiFo#FIFO local fifo = self.ContactsAO -- Utilities.FiFo#FIFO
--local maxentries = self.maxspeakentries
local maxentries = 1 local maxentries = 1
local counter = 0 local counter = 0
@ -2745,7 +2730,6 @@ function AWACS:_Picture(Group,IsGeneral)
local textScreen = text local textScreen = text
local general = IsGeneral local general = IsGeneral
local GID, Outcome, gcallsign = self:_GetManagedGrpID(Group) local GID, Outcome, gcallsign = self:_GetManagedGrpID(Group)
--local gcallsign = ""
if general then if general then
local allst = self.gettext:GetEntry("ALLSTATIONS",self.locale) local allst = self.gettext:GetEntry("ALLSTATIONS",self.locale)
@ -2772,7 +2756,6 @@ function AWACS:_Picture(Group,IsGeneral)
-- get clusters from Intel -- get clusters from Intel
local contactstable = self.Contacts:GetDataTable() local contactstable = self.Contacts:GetDataTable()
--local clustertable = self.intel:GetClusterTable() or {}
-- sort into buckets -- sort into buckets
for _,_contact in pairs(contactstable) do for _,_contact in pairs(contactstable) do
@ -2824,15 +2807,11 @@ function AWACS:_Picture(Group,IsGeneral)
local grptxt = self.gettext:GetEntry("GROUP",self.locale) local grptxt = self.gettext:GetEntry("GROUP",self.locale)
local groupstxt = self.gettext:GetEntry("GROUPMULTI",self.locale) local groupstxt = self.gettext:GetEntry("GROUPMULTI",self.locale)
if clustersAO == 1 then if clustersAO == 1 then
--text = text .. "One group. "
text = string.format("%s%s %s. ",text,onetxt,grptxt) text = string.format("%s%s %s. ",text,onetxt,grptxt)
--textScreen = textScreen .. "One group.\n"
textScreen = string.format("%s%s %s.\n",textScreen,onetxt,grptxt) textScreen = string.format("%s%s %s.\n",textScreen,onetxt,grptxt)
else else
text = string.format("%s%d %s. ",text,clustersAO,groupstxt) text = string.format("%s%d %s. ",text,clustersAO,groupstxt)
--text = text .. clustersAO .. " groups. "
textScreen = string.format("%s%d %s.\n",textScreen,clustersAO,groupstxt) textScreen = string.format("%s%d %s.\n",textScreen,clustersAO,groupstxt)
--textScreen = textScreen .. clustersAO .. " groups.\n"
end end
self:_NewRadioEntry(text,textScreen,GID,Outcome,true,true,false) self:_NewRadioEntry(text,textScreen,GID,Outcome,true,true,false)
@ -2917,28 +2896,15 @@ function AWACS:_BogeyDope(Group)
if contactsAO > 0 then if contactsAO > 0 then
local dope = self.gettext:GetEntry("DOPE",self.locale) local dope = self.gettext:GetEntry("DOPE",self.locale)
text = string.format(dope,self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt) text = string.format(dope,self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt)
--[[
if contactsAO == 1 then
text = text .. "One group. "
textScreen = text .. "\n"
else
text = text .. contactsAO .. " groups. "
textScreen = textScreen .. contactsAO .. " groups.\n"
end
--]]
local onetxt = self.gettext:GetEntry("ONE",self.locale) local onetxt = self.gettext:GetEntry("ONE",self.locale)
local grptxt = self.gettext:GetEntry("GROUP",self.locale) local grptxt = self.gettext:GetEntry("GROUP",self.locale)
local groupstxt = self.gettext:GetEntry("GROUPMULTI",self.locale) local groupstxt = self.gettext:GetEntry("GROUPMULTI",self.locale)
if contactsAO == 1 then if contactsAO == 1 then
--text = text .. "One group. "
text = string.format("%s%s %s. ",text,onetxt,grptxt) text = string.format("%s%s %s. ",text,onetxt,grptxt)
--textScreen = textScreen .. "One group.\n"
textScreen = string.format("%s%s %s.\n",textScreen,onetxt,grptxt) textScreen = string.format("%s%s %s.\n",textScreen,onetxt,grptxt)
else else
text = string.format("%s%d %s. ",text,contactsAO,groupstxt) text = string.format("%s%d %s. ",text,contactsAO,groupstxt)
--text = text .. clustersAO .. " groups. "
textScreen = string.format("%s%d %s.\n",textScreen,contactsAO,groupstxt) textScreen = string.format("%s%d %s.\n",textScreen,contactsAO,groupstxt)
--textScreen = textScreen .. clustersAO .. " groups.\n"
end end
self:_NewRadioEntry(text,textScreen,GID,Outcome,true,true,false,true) self:_NewRadioEntry(text,textScreen,GID,Outcome,true,true,false,true)
@ -2949,7 +2915,6 @@ function AWACS:_BogeyDope(Group)
elseif self.AwacsFG then elseif self.AwacsFG then
-- no, unknown -- no, unknown
--text = string.format("%s. %s. Negative. You are not checked in.",self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt)
local nocheckin = self.gettext:GetEntry("NOTCHECKEDIN",self.locale) local nocheckin = self.gettext:GetEntry("NOTCHECKEDIN",self.locale)
text = string.format(nocheckin,self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt) text = string.format(nocheckin,self:_GetCallSign(Group,GID) or "Ghost 1", self.callsigntxt)
self:_NewRadioEntry(text,text,GID,Outcome,true,true,false) self:_NewRadioEntry(text,text,GID,Outcome,true,true,false)
@ -3248,7 +3213,6 @@ function AWACS:_Unable(Group)
if managedtask.Status == AWACS.TaskStatus.REQUESTED then if managedtask.Status == AWACS.TaskStatus.REQUESTED then
-- ok let's commit this one -- ok let's commit this one
managedtask = self.ManagedTasks:PullByID(currtaskid) managedtask = self.ManagedTasks:PullByID(currtaskid)
--managedtask.AssignedGroupID = 0
managedtask.IsUnassigned = true managedtask.IsUnassigned = true
managedtask.Status = AWACS.TaskStatus.FAILED managedtask.Status = AWACS.TaskStatus.FAILED
self.ManagedTasks:Push(managedtask,currtaskid) self.ManagedTasks:Push(managedtask,currtaskid)
@ -3284,7 +3248,6 @@ end
-- @return #AWACS self -- @return #AWACS self
function AWACS:_TaskAbort(Group) function AWACS:_TaskAbort(Group)
self:T(self.lid.."_TaskAbort") self:T(self.lid.."_TaskAbort")
--local GID, Outcome = self:_GetManagedGrpID(Group)
local Outcome,GID = self:_GetGIDFromGroupOrName(Group) local Outcome,GID = self:_GetGIDFromGroupOrName(Group)
local text = "" local text = ""
if Outcome then if Outcome then
@ -3300,7 +3263,6 @@ function AWACS:_TaskAbort(Group)
-- ok let's un-commit this one -- ok let's un-commit this one
managedtask = self.ManagedTasks:PullByID(currtaskid) managedtask = self.ManagedTasks:PullByID(currtaskid)
managedtask.Status = AWACS.TaskStatus.FAILED managedtask.Status = AWACS.TaskStatus.FAILED
--managedtask.AssignedGroupID = 0
managedtask.IsUnassigned = true managedtask.IsUnassigned = true
self.ManagedTasks:Push(managedtask,currtaskid) self.ManagedTasks:Push(managedtask,currtaskid)
-- unlink group -- unlink group
@ -3432,7 +3394,6 @@ function AWACS:_CheckIn(Group)
local alphacheckbulls = self:_ToStringBULLS(Group:GetCoordinate()) local alphacheckbulls = self:_ToStringBULLS(Group:GetCoordinate())
local alphacheckbullstts = self:_ToStringBULLS(Group:GetCoordinate(),false,true) local alphacheckbullstts = self:_ToStringBULLS(Group:GetCoordinate(),false,true)
--self.ManagedGrps[self.ManagedGrpID]=managedgroup
local alpha = self.gettext:GetEntry("ALPHACHECK",self.locale) local alpha = self.gettext:GetEntry("ALPHACHECK",self.locale)
text = string.format("%s. %s. %s. %s",managedgroup.CallSign,self.callsigntxt,alpha,alphacheckbulls) text = string.format("%s. %s. %s. %s",managedgroup.CallSign,self.callsigntxt,alpha,alphacheckbulls)
textTTS = text textTTS = text
@ -3555,11 +3516,9 @@ function AWACS:_CheckOut(Group,GID,dead)
local Angels = managedgroup.AnchorStackAngels local Angels = managedgroup.AnchorStackAngels
-- remove menus -- remove menus
if managedgroup.IsPlayer then if managedgroup.IsPlayer then
-- DONE Move to FIFO
if self.clientmenus:HasUniqueID(managedgroup.GroupName) then if self.clientmenus:HasUniqueID(managedgroup.GroupName) then
local menus = self.clientmenus:PullByID(managedgroup.GroupName) --#AWACS.MenuStructure local menus = self.clientmenus:PullByID(managedgroup.GroupName) --#AWACS.MenuStructure
menus.basemenu:Remove() menus.basemenu:Remove()
--self.clientmenus[AnchorAssigned.GroupName] = nil
end end
end end
-- delete open tasks -- delete open tasks
@ -3591,7 +3550,6 @@ function AWACS:_SetClientMenus()
self:T(self.lid.."_SetClientMenus") self:T(self.lid.."_SetClientMenus")
local clientset = self.clientset -- Core.Set#SET_CLIENT local clientset = self.clientset -- Core.Set#SET_CLIENT
local aliveset = clientset:GetSetObjects() or {}-- #table of #CLIENT objects local aliveset = clientset:GetSetObjects() or {}-- #table of #CLIENT objects
--local clientmenus = {}
local clientcount = 0 local clientcount = 0
local clientcheckedin = 0 local clientcheckedin = 0
for _,_group in pairs(aliveset) do for _,_group in pairs(aliveset) do
@ -3603,7 +3561,6 @@ function AWACS:_SetClientMenus()
cgrpname = cgrp:GetName() cgrpname = cgrp:GetName()
self:T(cgrpname) self:T(cgrpname)
end end
--cgrpname = string.match(cgrpname,"([%a%s]+)#")
if self.MenuStrict then if self.MenuStrict then
-- check if pilot has checked in -- check if pilot has checked in
if cgrp and cgrp:IsAlive() then if cgrp and cgrp:IsAlive() then
@ -3612,9 +3569,7 @@ function AWACS:_SetClientMenus()
if checkedin then if checkedin then
-- full menu minus checkin -- full menu minus checkin
clientcheckedin = clientcheckedin + 1 clientcheckedin = clientcheckedin + 1
--self.clientmenus:Flush()
local hasclientmenu = self.clientmenus:ReadByID(cgrpname) -- #AWACS.MenuStructure local hasclientmenu = self.clientmenus:ReadByID(cgrpname) -- #AWACS.MenuStructure
--self:T({hasclientmenu})
local basemenu = hasclientmenu.basemenu -- Core.Menu#MENU_GROUP local basemenu = hasclientmenu.basemenu -- Core.Menu#MENU_GROUP
if hasclientmenu and (not hasclientmenu.menuset) then if hasclientmenu and (not hasclientmenu.menuset) then
@ -3622,7 +3577,6 @@ function AWACS:_SetClientMenus()
self:T(self.lid.."Setting Menus for "..cgrpname) self:T(self.lid.."Setting Menus for "..cgrpname)
basemenu:RemoveSubMenus() basemenu:RemoveSubMenus()
--basemenu:Refresh()
local bogeydope = MENU_GROUP_COMMAND:New(cgrp,"Bogey Dope",basemenu,self._BogeyDope,self,cgrp) local bogeydope = MENU_GROUP_COMMAND:New(cgrp,"Bogey Dope",basemenu,self._BogeyDope,self,cgrp)
local picture = MENU_GROUP_COMMAND:New(cgrp,"Picture",basemenu,self._Picture,self,cgrp) local picture = MENU_GROUP_COMMAND:New(cgrp,"Picture",basemenu,self._Picture,self,cgrp)
local declare = MENU_GROUP_COMMAND:New(cgrp,"Declare",basemenu,self._Declare,self,cgrp) local declare = MENU_GROUP_COMMAND:New(cgrp,"Declare",basemenu,self._Declare,self,cgrp)
@ -3665,10 +3619,8 @@ function AWACS:_SetClientMenus()
elseif not self.clientmenus:HasUniqueID(cgrpname) then elseif not self.clientmenus:HasUniqueID(cgrpname) then
-- check in only -- check in only
local basemenu = MENU_GROUP:New(cgrp,self.Name,nil) local basemenu = MENU_GROUP:New(cgrp,self.Name,nil)
--basemenu:RemoveSubMenus()
local checkin = MENU_GROUP_COMMAND:New(cgrp,"Check In",basemenu,self._CheckIn,self,cgrp) local checkin = MENU_GROUP_COMMAND:New(cgrp,"Check In",basemenu,self._CheckIn,self,cgrp)
checkin:SetTag(cgrp:GetName()) checkin:SetTag(cgrp:GetName())
--basemenu:Set()
basemenu:Refresh() basemenu:Refresh()
local menus = { -- #AWACS.MenuStructure local menus = { -- #AWACS.MenuStructure
groupname = cgrpname, groupname = cgrpname,
@ -3682,8 +3634,6 @@ function AWACS:_SetClientMenus()
else else
if cgrp and cgrp:IsAlive() and not self.clientmenus:HasUniqueID(cgrpname) then if cgrp and cgrp:IsAlive() and not self.clientmenus:HasUniqueID(cgrpname) then
local basemenu = MENU_GROUP:New(cgrp,self.Name,nil) local basemenu = MENU_GROUP:New(cgrp,self.Name,nil)
--basemenu:RemoveSubMenus()
--basemenu:Refresh()
local picture = MENU_GROUP_COMMAND:New(cgrp,"Picture",basemenu,self._Picture,self,cgrp) local picture = MENU_GROUP_COMMAND:New(cgrp,"Picture",basemenu,self._Picture,self,cgrp)
local bogeydope = MENU_GROUP_COMMAND:New(cgrp,"Bogey Dope",basemenu,self._BogeyDope,self,cgrp) local bogeydope = MENU_GROUP_COMMAND:New(cgrp,"Bogey Dope",basemenu,self._BogeyDope,self,cgrp)
local declare = MENU_GROUP_COMMAND:New(cgrp,"Declare",basemenu,self._Declare,self,cgrp) local declare = MENU_GROUP_COMMAND:New(cgrp,"Declare",basemenu,self._Declare,self,cgrp)
@ -3885,7 +3835,6 @@ function AWACS:_CreateAnchorStack()
AnchorStackOne.StationName = newname AnchorStackOne.StationName = newname
--push to AnchorStacks --push to AnchorStacks
if self.debug then if self.debug then
--self.AnchorStacks:Flush()
AnchorStackOne.StationZone:DrawZone(self.coalition,{0,0,1},1,{0,0,1},0.2,5,true) AnchorStackOne.StationZone:DrawZone(self.coalition,{0,0,1},1,{0,0,1},0.2,5,true)
local stationtag = string.format("Station: %s\nCoordinate: %s",newname,self.StationZone:GetCoordinate():ToStringLLDDM()) local stationtag = string.format("Station: %s\nCoordinate: %s",newname,self.StationZone:GetCoordinate():ToStringLLDDM())
AnchorStackOne.AnchorMarker=MARKER:New(AnchorStackOne.StationZone:GetCoordinate(),stationtag):ToCoalition(self.coalition) AnchorStackOne.AnchorMarker=MARKER:New(AnchorStackOne.StationZone:GetCoordinate(),stationtag):ToCoalition(self.coalition)
@ -4023,7 +3972,6 @@ function AWACS:_StartIntel(awacs)
acceptzoneset:AddZone(self.BorderZone) acceptzoneset:AddZone(self.BorderZone)
end end
--self.AwacsInZone
intel:SetAcceptZones(acceptzoneset) intel:SetAcceptZones(acceptzoneset)
if self.NoHelos then if self.NoHelos then
@ -4475,8 +4423,8 @@ function AWACS:_CheckTaskQueue()
end end
elseif entry.IsPlayerTask then elseif entry.IsPlayerTask then
-- Player task -- Player task
-- TODO -- DONE
if entry.Target:IsDead() or entry.Target:IsDestroyed() then if entry.Target:IsDead() or entry.Target:IsDestroyed() or entry.Target:CountTargets() == 0 then
-- success! -- success!
entry.Status = AWACS.TaskStatus.SUCCESS entry.Status = AWACS.TaskStatus.SUCCESS
elseif entry.Target:IsAlive() then elseif entry.Target:IsAlive() then
@ -4593,7 +4541,7 @@ function AWACS:_CheckTaskQueue()
end end
-- target dead or out of bounds? -- target dead or out of bounds?
if entry.Target:IsDead() or entry.Target:IsDestroyed() then if entry.Target:IsDead() or entry.Target:IsDestroyed() or entry.Target:CountTargets() == 0 then
-- success! -- success!
entry.Status = AWACS.TaskStatus.SUCCESS entry.Status = AWACS.TaskStatus.SUCCESS
elseif entry.Target:IsAlive() then elseif entry.Target:IsAlive() then
@ -4819,7 +4767,6 @@ function AWACS:AddCAPAirWing(AirWing,Zone)
AnchorStackOne.StationName = newname AnchorStackOne.StationName = newname
--push to AnchorStacks --push to AnchorStacks
if self.debug then if self.debug then
--self.AnchorStacks:Flush()
AnchorStackOne.StationZone:DrawZone(self.coalition,{0,0,1},1,{0,0,1},0.2,5,true) AnchorStackOne.StationZone:DrawZone(self.coalition,{0,0,1},1,{0,0,1},0.2,5,true)
local stationtag = string.format("Station: %s\nCoordinate: %s",newname,self.StationZone:GetCoordinate():ToStringLLDDM()) local stationtag = string.format("Station: %s\nCoordinate: %s",newname,self.StationZone:GetCoordinate():ToStringLLDDM())
AnchorStackOne.AnchorMarker=MARKER:New(AnchorStackOne.StationZone:GetCoordinate(),stationtag):ToCoalition(self.coalition) AnchorStackOne.AnchorMarker=MARKER:New(AnchorStackOne.StationZone:GetCoordinate(),stationtag):ToCoalition(self.coalition)
@ -4914,24 +4861,16 @@ function AWACS:_AnnounceContact(Contact,IsNew,Group,IsBogeyDope,Tag,IsPopup,Repo
local popup = self.gettext:GetEntry("POPUP",self.locale) local popup = self.gettext:GetEntry("POPUP",self.locale)
if IsNew and self.PlayerGuidance then if IsNew and self.PlayerGuidance then
--BRAText = BRAText .. " New group."
BRAText = string.format("%s %s.",BRAText,newgrp) BRAText = string.format("%s %s.",BRAText,newgrp)
--TextScreen = TextScreen .. " New group."
TextScreen = string.format("%s %s.",TextScreen,newgrp) TextScreen = string.format("%s %s.",TextScreen,newgrp)
elseif IsPopup then elseif IsPopup then
--BRAText = BRAText .. " Pop-up group."
BRAText = string.format("%s %s %s.",BRAText,popup,grptxt) BRAText = string.format("%s %s %s.",BRAText,popup,grptxt)
--TextScreen = TextScreen .. " Pop-up group."
TextScreen = string.format("%s %s %s.",TextScreen,popup,grptxt) TextScreen = string.format("%s %s %s.",TextScreen,popup,grptxt)
elseif IsBogeyDope and Tag and Tag ~= "" then elseif IsBogeyDope and Tag and Tag ~= "" then
--BRAText = BRAText .. " "..Tag.." group."
BRAText = string.format("%s %s %s.",BRAText,Tag,grptxt) BRAText = string.format("%s %s %s.",BRAText,Tag,grptxt)
--TextScreen = TextScreen .. " "..Tag.." group."
TextScreen = string.format("%s %s %s.",TextScreen,Tag,grptxt) TextScreen = string.format("%s %s %s.",TextScreen,Tag,grptxt)
else else
--BRAText = BRAText .. " Group."
BRAText = string.format("%s %s.",BRAText,GRPtxt) BRAText = string.format("%s %s.",BRAText,GRPtxt)
--TextScreen = TextScreen .. " Group."
TextScreen = string.format("%s %s.",TextScreen,GRPtxt) TextScreen = string.format("%s %s.",TextScreen,GRPtxt)
end end
@ -5205,7 +5144,6 @@ function AWACS:_CheckAICAPOnStation()
local OpsGroup = self:_GetAliveOpsGroupFromTable(OpsGroups) -- Ops.OpsGroup#OPSGROUP local OpsGroup = self:_GetAliveOpsGroupFromTable(OpsGroups) -- Ops.OpsGroup#OPSGROUP
if OpsGroup then if OpsGroup then
local OpsName = OpsGroup:GetName() or "Unknown" local OpsName = OpsGroup:GetName() or "Unknown"
--local OpsCallSign = OpsGroup:GetCallsignName() or "Unknown"
local found,GID,OpsCallSign = self:_GetGIDFromGroupOrName(OpsGroup) local found,GID,OpsCallSign = self:_GetGIDFromGroupOrName(OpsGroup)
report:Add(string.format("Mission FG %s",OpsName)) report:Add(string.format("Mission FG %s",OpsName))
report:Add(string.format("Callsign %s",OpsCallSign)) report:Add(string.format("Callsign %s",OpsCallSign))
@ -5485,7 +5423,7 @@ function AWACS:_AssignPilotToTarget(Pilots,Targets)
-- BASE:I("AUFTRAG Condition Succes Eval Running") -- BASE:I("AUFTRAG Condition Succes Eval Running")
local success = true local success = true
local target = target -- Ops.Target#TARGET local target = target -- Ops.Target#TARGET
if target:IsDestroyed() then return true end if target:IsDestroyed() or target:IsDead() or target:CountTargets() == 0 then return true end
local tgtcoord = target:GetCoordinate() local tgtcoord = target:GetCoordinate()
local tgtvec2 = nil local tgtvec2 = nil
if tgtcoord then if tgtcoord then
@ -5496,7 +5434,6 @@ function AWACS:_AssignPilotToTarget(Pilots,Targets)
if tgtvec2 then if tgtvec2 then
zones:ForEachZone( zones:ForEachZone(
function(zone) function(zone)
-- BASE:I("AUFTRAG Condition Succes ZONE Eval Running")
if zone:IsVec2InZone(tgtvec2) then if zone:IsVec2InZone(tgtvec2) then
success = false success = false
end end
@ -5504,7 +5441,6 @@ function AWACS:_AssignPilotToTarget(Pilots,Targets)
) )
rzones:ForEachZone( rzones:ForEachZone(
function(zone) function(zone)
-- BASE:I("AUFTRAG Condition Succes REJECT ZONE Eval Running")
if zone:IsVec2InZone(tgtvec2) then if zone:IsVec2InZone(tgtvec2) then
success = true success = true
end end
@ -5603,7 +5539,6 @@ function AWACS:onafterStart(From, Event, To)
self.ControlZone = ZONE_RADIUS:New(controlzonename,self.OpsZone:GetVec2(),UTILS.NMToMeters(self.ControlZoneRadius)) self.ControlZone = ZONE_RADIUS:New(controlzonename,self.OpsZone:GetVec2(),UTILS.NMToMeters(self.ControlZoneRadius))
if self.debug then if self.debug then
self.ControlZone:DrawZone(self.coalition,{0,1,0},1,{1,0,0},0.05,3,true) self.ControlZone:DrawZone(self.coalition,{0,1,0},1,{1,0,0},0.05,3,true)
--MARKER:New(self.ControlZone:GetCoordinate(),"Radar Zone"):ToAll()
self.OpsZone:DrawZone(self.coalition,{1,0,0},1,{1,0,0},0.2,5,true) self.OpsZone:DrawZone(self.coalition,{1,0,0},1,{1,0,0},0.2,5,true)
local AOCoordString = self.AOCoordinate:ToStringLLDDM() local AOCoordString = self.AOCoordinate:ToStringLLDDM()
local Rocktag = string.format("FEZ: %s\nBulls Coordinate: %s",self.AOName,AOCoordString) local Rocktag = string.format("FEZ: %s\nBulls Coordinate: %s",self.AOName,AOCoordString)
@ -5658,7 +5593,6 @@ function AWACS:onafterStart(From, Event, To)
return self return self
end end
--self.AwacsFG:SetSRS(self.PathToSRS,self.Gender,self.Culture,self.Voice,self.Port,self.PathToGoogleKey,"AWACS",self.Volume)
self.callsigntxt = string.format("%s",self.CallSignClear[self.CallSign]) self.callsigntxt = string.format("%s",self.CallSignClear[self.CallSign])
self:__CheckRadioQueue(-10) self:__CheckRadioQueue(-10)
@ -5717,17 +5651,14 @@ function AWACS:onafterStart(From, Event, To)
-- Event functions -- Event functions
function MarkerOps:OnAfterMarkAdded(From,Event,To,Text,Keywords,Coord) function MarkerOps:OnAfterMarkAdded(From,Event,To,Text,Keywords,Coord)
--local m = MESSAGE:New(string.format("AWACS %s Mark Added.", self.Tag),10,"Info",true):ToAllIf(self.debug)
Handler(Keywords,Coord,Text) Handler(Keywords,Coord,Text)
end end
function MarkerOps:OnAfterMarkChanged(From,Event,To,Text,Keywords,Coord) function MarkerOps:OnAfterMarkChanged(From,Event,To,Text,Keywords,Coord)
--BASE:I(string.format("%s Mark Changed.", self.Tag))
Handler(Keywords,Coord,Text) Handler(Keywords,Coord,Text)
end end
function MarkerOps:OnAfterMarkDeleted(From,Event,To) function MarkerOps:OnAfterMarkDeleted(From,Event,To)
--BASE:I(string.format("%s Mark Deleted.", self.Tag))
end end
self.MarkerOps = MarkerOps self.MarkerOps = MarkerOps
@ -5788,7 +5719,6 @@ function AWACS:_CheckAwacsStatus()
local sunrise = self.gettext:GetEntry("SUNRISE",self.locale) local sunrise = self.gettext:GetEntry("SUNRISE",self.locale)
local text = string.format(sunrise,self.callsigntxt,self.callsigntxt) local text = string.format(sunrise,self.callsigntxt,self.callsigntxt)
self:_NewRadioEntry(text,text,0,false,false,false,false,true) self:_NewRadioEntry(text,text,0,false,false,false,false,true)
--self.AwacsFG:RadioTransmission(text,1,false)
self:T(self.lid..text) self:T(self.lid..text)
self.sunrisedone = true self.sunrisedone = true
end end
@ -5925,13 +5855,10 @@ function AWACS:_CheckAwacsStatus()
local ESTOSLeft = UTILS.Round((((self.EscortsTimeOnStation+self.ShiftChangeTime)*3600) - ESmissiontime),0) -- seconds local ESTOSLeft = UTILS.Round((((self.EscortsTimeOnStation+self.ShiftChangeTime)*3600) - ESmissiontime),0) -- seconds
ESTOSLeft = UTILS.Round(ESTOSLeft/60,0) -- minutes ESTOSLeft = UTILS.Round(ESTOSLeft/60,0) -- minutes
local ChangeTime = UTILS.Round(((self.ShiftChangeTime * 3600)/60),0) local ChangeTime = UTILS.Round(((self.ShiftChangeTime * 3600)/60),0)
--local Changedue = "No"
--report:Add("====================")
report:Add("ESCORTS REPLACEMENT:") report:Add("ESCORTS REPLACEMENT:")
report:Add(string.format("Auftrag Status: %s",esstatus)) report:Add(string.format("Auftrag Status: %s",esstatus))
report:Add(string.format("TOS Left: %d min",ESTOSLeft)) report:Add(string.format("TOS Left: %d min",ESTOSLeft))
--report:Add(string.format("Needs ShiftChange: %s",Changedue))
local OpsGroups = ESmission:GetOpsGroups() local OpsGroups = ESmission:GetOpsGroups()
local OpsGroup = self:_GetAliveOpsGroupFromTable(OpsGroups) -- Ops.OpsGroup#OPSGROUP local OpsGroup = self:_GetAliveOpsGroupFromTable(OpsGroups) -- Ops.OpsGroup#OPSGROUP
@ -6016,17 +5943,13 @@ function AWACS:onafterStatus(From, Event, To)
self:_CheckMerges() self:_CheckMerges()
if self.debug then
--local outcome, targets = self:_TargetSelectionProcess() -- TODO for debug ATM
end
local outcome, targets = self:_TargetSelectionProcess(true) local outcome, targets = self:_TargetSelectionProcess(true)
self:_CheckTaskQueue() self:_CheckTaskQueue()
local AI, Humans = self:_GetIdlePilots() local AI, Humans = self:_GetIdlePilots()
-- assign Pilot if there are targets and available Pilots, prefer Humans to AI -- assign Pilot if there are targets and available Pilots, prefer Humans to AI
-- TODO - Implemented AI First, Humans laters - need to work out how to loop the targets to assign a pilot -- DONE - Implemented AI First, Humans laters - need to work out how to loop the targets to assign a pilot
if outcome and #Humans > 0 and self.PlayerCapAssigment then if outcome and #Humans > 0 and self.PlayerCapAssigment then
-- add a task for AI -- add a task for AI
self:_AssignPilotToTarget(Humans,targets) self:_AssignPilotToTarget(Humans,targets)
@ -6163,7 +6086,6 @@ function AWACS:onafterAssignedAnchor(From, Event, To, GID, Anchor, AnchorStackNo
local isAI = managedgroup.IsAI local isAI = managedgroup.IsAI
local Group = managedgroup.Group local Group = managedgroup.Group
local CallSign = managedgroup.CallSign or "Ghost 1" local CallSign = managedgroup.CallSign or "Ghost 1"
--local AnchorName = Anchor.StationZone:GetName() or "unknown"
local AnchorName = Anchor.StationName or "unknown" local AnchorName = Anchor.StationName or "unknown"
local AnchorCoordTxt = Anchor.StationZoneCoordinateText or "unknown" local AnchorCoordTxt = Anchor.StationZoneCoordinateText or "unknown"
local Angels = AnchorAngels or 25 local Angels = AnchorAngels or 25
@ -6345,7 +6267,6 @@ end
-- @return #AWACS self -- @return #AWACS self
function AWACS:onafterLostContact(From,Event,To,Contact) function AWACS:onafterLostContact(From,Event,To,Contact)
self:T({From, Event, To, Contact}) self:T({From, Event, To, Contact})
--self:_CleanUpContacts()
return self return self
end end
@ -6359,7 +6280,6 @@ end
-- @return #AWACS self -- @return #AWACS self
function AWACS:onafterLostCluster(From,Event,To,Cluster,Mission) function AWACS:onafterLostCluster(From,Event,To,Cluster,Mission)
self:T({From, Event, To}) self:T({From, Event, To})
--self:_CleanUpContacts()
return self return self
end end
@ -6396,10 +6316,8 @@ function AWACS:onafterCheckRadioQueue(From,Event,To)
if self.PathToGoogleKey then if self.PathToGoogleKey then
local gtext = RadioEntry.TextTTS local gtext = RadioEntry.TextTTS
gtext = string.format("<speak><prosody rate='medium'>%s</prosody></speak>",gtext) gtext = string.format("<speak><prosody rate='medium'>%s</prosody></speak>",gtext)
--self.AwacsFG:RadioTransmission(gtext,1,false)
self.AwacsSRS:PlayTextExt(gtext,nil,self.MultiFrequency,self.MultiModulation,self.Gender,self.Culture,self.Voice,self.Volume,"AWACS") self.AwacsSRS:PlayTextExt(gtext,nil,self.MultiFrequency,self.MultiModulation,self.Gender,self.Culture,self.Voice,self.Volume,"AWACS")
else else
--self.AwacsFG:RadioTransmission(RadioEntry.TextTTS,1,false)
self.AwacsSRS:PlayTextExt(RadioEntry.TextTTS,nil,self.MultiFrequency,self.MultiModulation,self.Gender,self.Culture,self.Voice,self.Volume,"AWACS") self.AwacsSRS:PlayTextExt(RadioEntry.TextTTS,nil,self.MultiFrequency,self.MultiModulation,self.Gender,self.Culture,self.Voice,self.Volume,"AWACS")
end end
self:T(RadioEntry.TextTTS) self:T(RadioEntry.TextTTS)
@ -6647,9 +6565,6 @@ function AWACS:onafterReAnchor(From, Event, To, GID)
local lastknown = UTILS.DeepCopy(managedgroup.LastKnownPosition) local lastknown = UTILS.DeepCopy(managedgroup.LastKnownPosition)
local brtext = self:_ToStringBULLS(lastknown) local brtext = self:_ToStringBULLS(lastknown)
local brtexttts = self:_ToStringBULLS(lastknown,false,true) local brtexttts = self:_ToStringBULLS(lastknown,false,true)
--if self.PathToGoogleKey then
--brtexttts = self:_ToStringBULLS(lastknown,true)
--end
text = text .. " "..brtexttts.." "..milestxt.."." text = text .. " "..brtexttts.." "..milestxt.."."
textScreen = textScreen .. " "..brtext.." "..milestxt.."." textScreen = textScreen .. " "..brtext.." "..milestxt.."."