#EasyGCICAP

* Added Recon Patrol points
This commit is contained in:
Applevangelist
2023-10-06 11:31:35 +02:00
parent ffea9708d1
commit 8c44cf8fca
3 changed files with 226 additions and 32 deletions

View File

@@ -34,14 +34,17 @@
-- @field Core.Set#SET_ZONE zonesetCAP Set of CAP zones.
-- @field Core.Set#SET_ZONE zonesetTANKER Set of TANKER zones.
-- @field Core.Set#SET_ZONE zonesetAWACS Set of AWACS zones.
-- @field Core.Set#SET_ZONE zonesetRECON Set of RECON zones.
-- @field #number nflightsCAP Number of CAP flights constantly in the air.
-- @field #number nflightsAWACS Number of AWACS flights constantly in the air.
-- @field #number nflightsTANKERboom Number of TANKER flights with BOOM constantly in the air.
-- @field #number nflightsTANKERprobe Number of TANKER flights with PROBE constantly in the air.
-- @field #number nflightsRescueHelo Number of Rescue helo flights constantly in the air.
-- @field #number nflightsRecon Number of Recon flights constantly in the air.
-- @field #table pointsCAP Table of CAP points.
-- @field #table pointsTANKER Table of Tanker points.
-- @field #table pointsAWACS Table of AWACS points.
-- @field #table pointsRecon Table of RECON points.
-- @field #boolean markpoints Display markers on the F10 map.
-- @field Ops.Airboss#AIRBOSS airboss Airboss attached to this wing.
--
@@ -123,6 +126,7 @@ AIRWING = {
pointsCAP = {},
pointsTANKER = {},
pointsAWACS = {},
pointsRecon = {},
markpoints = false,
}
@@ -175,7 +179,7 @@ AIRWING = {
--- AIRWING class version.
-- @field #string version
AIRWING.version="0.9.2"
AIRWING.version="0.9.3"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ToDo list
@@ -219,6 +223,7 @@ function AIRWING:New(warehousename, airwingname)
-- Defaults:
self.nflightsCAP=0
self.nflightsAWACS=0
self.nflightsRecon=0
self.nflightsTANKERboom=0
self.nflightsTANKERprobe=0
self.nflightsRecoveryTanker=0
@@ -734,6 +739,15 @@ function AIRWING:SetNumberAWACS(n)
return self
end
--- Set number of RECON flights constantly in the air.
-- @param #AIRWING self
-- @param #number n Number of flights. Default 1.
-- @return #AIRWING self
function AIRWING:SetNumberRecon(n)
self.nflightsRecon=n or 1
return self
end
--- Set number of Rescue helo flights constantly in the air.
-- @param #AIRWING self
-- @param #number n Number of flights. Default 1.
@@ -819,6 +833,23 @@ function AIRWING:AddPatrolPointCAP(Coordinate, Altitude, Speed, Heading, LegLeng
return self
end
--- Add a patrol Point for RECON missions.
-- @param #AIRWING self
-- @param Core.Point#COORDINATE Coordinate Coordinate of the patrol point.
-- @param #number Altitude Orbit altitude in feet.
-- @param #number Speed Orbit speed in knots.
-- @param #number Heading Heading in degrees.
-- @param #number LegLength Length of race-track orbit in NM.
-- @return #AIRWING self
function AIRWING:AddPatrolPointRecon(Coordinate, Altitude, Speed, Heading, LegLength)
local patrolpoint=self:NewPatrolPoint("RECON", Coordinate, Altitude, Speed, Heading, LegLength)
table.insert(self.pointsRecon, patrolpoint)
return self
end
--- Add a patrol Point for TANKER missions.
-- @param #AIRWING self
-- @param Core.Point#COORDINATE Coordinate Coordinate of the patrol point.
@@ -971,6 +1002,9 @@ function AIRWING:onafterStatus(From, Event, To)
-- Check Rescue Helo missions.
self:CheckRescuhelo()
-- Check Recon missions.
self:CheckRECON()
----------------
-- Transport ---
----------------
@@ -1111,6 +1145,58 @@ function AIRWING:CheckCAP()
return self
end
--- Check how many RECON missions are assigned and add number of missing missions.
-- @param #AIRWING self
-- @return #AIRWING self
function AIRWING:CheckRECON()
local Ncap=0 --self:CountMissionsInQueue({AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT})
-- Count CAP missions.
for _,_mission in pairs(self.missionqueue) do
local mission=_mission --Ops.Auftrag#AUFTRAG
if mission:IsNotOver() and mission.type==AUFTRAG.Type.RECON and mission.patroldata then
Ncap=Ncap+1
end
end
--self:I(self.lid.."Number of active RECON Missions: "..Ncap)
for i=1,self.nflightsRecon-Ncap do
--self:I(self.lid.."Creating RECON Missions: "..i)
local patrol=self:_GetPatrolData(self.pointsRecon)
local altitude=patrol.altitude --+1000*patrol.noccupied
local ZoneSet = SET_ZONE:New()
local Zone = ZONE_RADIUS:New(self.alias.." Recon "..math.random(1,10000),patrol.coord:GetVec2(),UTILS.NMToMeters(patrol.leg/2))
ZoneSet:AddZone(Zone)
if self.Debug then
Zone:DrawZone(self.coalition,{0,0,1},Alpha,FillColor,FillAlpha,2,true)
end
local missionRECON=AUFTRAG:NewRECON(ZoneSet,patrol.speed,patrol.altitude,true)
missionRECON.patroldata=patrol
missionRECON.categories={AUFTRAG.Category.AIRCRAFT}
patrol.noccupied=patrol.noccupied+1
if self.markpoints then AIRWING.UpdatePatrolPointMarker(patrol) end
self:AddMission(missionRECON)
end
return self
end
--- Check how many TANKER missions are assigned and add number of missing missions.
-- @param #AIRWING self
-- @return #AIRWING self