mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
xxx
This commit is contained in:
@@ -36,12 +36,14 @@
|
||||
-- @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 nflightsCAS 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 pointsCAS Table of CAS points.
|
||||
-- @field #table pointsTANKER Table of Tanker points.
|
||||
-- @field #table pointsAWACS Table of AWACS points.
|
||||
-- @field #table pointsRecon Table of RECON points.
|
||||
@@ -126,6 +128,7 @@ AIRWING = {
|
||||
payloads = {},
|
||||
payloadcounter = 0,
|
||||
pointsCAP = {},
|
||||
pointsCAS = {},
|
||||
pointsTANKER = {},
|
||||
pointsAWACS = {},
|
||||
pointsRecon = {},
|
||||
@@ -226,6 +229,7 @@ function AIRWING:New(warehousename, airwingname)
|
||||
|
||||
-- Defaults:
|
||||
self.nflightsCAP=0
|
||||
self.nflightsCAS=0
|
||||
self.nflightsAWACS=0
|
||||
self.nflightsRecon=0
|
||||
self.nflightsTANKERboom=0
|
||||
@@ -703,6 +707,24 @@ function AIRWING:SetNumberCAP(n)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set number of CAS flights constantly carried out.
|
||||
-- @param #AIRWING self
|
||||
-- @param #number n Number of flights. Default 1.
|
||||
-- @return #AIRWING self
|
||||
function AIRWING:SetNumberCAS(n)
|
||||
self.nflightsCAS=n or 1
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set CAS flight formation.
|
||||
-- @param #AIRWING self
|
||||
-- @param #number Formation Formation to take, e.g. ENUMS.Formation.FixedWing.Trail.Close, also see [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_option_formation).
|
||||
-- @return #AIRWING self
|
||||
function AIRWING:SetCASFormation(Formation)
|
||||
self.casFormation = Formation
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set CAP flight formation.
|
||||
-- @param #AIRWING self
|
||||
-- @param #number Formation Formation to take, e.g. ENUMS.Formation.FixedWing.Trail.Close, also see [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_option_formation).
|
||||
@@ -855,6 +877,37 @@ function AIRWING:AddPatrolPointCAP(Coordinate, Altitude, Speed, Heading, LegLeng
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add a patrol Point for CAS missions.
|
||||
-- @param #AIRWING self
|
||||
-- @param Core.Zone#ZONE_BASE Zone Zone to patrol.
|
||||
-- @param #number Altitude Orbit altitude in feet.
|
||||
-- @param #number Speed Orbit speed in knots.
|
||||
-- @param #number RangeMax Max Range in NM.
|
||||
-- @param Core.Set#SET_ZONE NoEngageZoneSet (Optional) Non engagement zone set
|
||||
-- @param #table TargetTypes (Optional) Types of target attributes that will be engaged. See DCS enum attributes. Default {"Helicopters", "Ground Units", "Light armed ships"}.
|
||||
-- @return #AIRWING self
|
||||
function AIRWING:AddPatrolPointCAS(Zone, Altitude, Speed, RangeMax, NoEngageZoneSet, TargetTypes)
|
||||
|
||||
local patrolpoint={} --#AIRWING.PatrolData
|
||||
patrolpoint.type = "CAS"
|
||||
patrolpoint.zone = Zone
|
||||
patrolpoint.altitude=Altitude or math.random(10,20)*1000
|
||||
patrolpoint.speed=Speed or 250
|
||||
patrolpoint.noccupied=0
|
||||
patrolpoint.NoEngageZoneSet=NoEngageZoneSet
|
||||
patrolpoint.TargetTypes=TargetTypes
|
||||
patrolpoint.RangeMax=RangeMax or 100
|
||||
|
||||
if self.markpoints then
|
||||
patrolpoint.marker=MARKER:New(Coordinate, "New Patrol Point"):ToAll()
|
||||
AIRWING.UpdatePatrolPointMarker(patrolpoint)
|
||||
end
|
||||
|
||||
table.insert(self.pointsCAS, patrolpoint)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Add a patrol Point for RECON missions.
|
||||
-- @param #AIRWING self
|
||||
-- @param Core.Point#COORDINATE Coordinate Coordinate of the patrol point.
|
||||
@@ -1014,6 +1067,9 @@ function AIRWING:onafterStatus(From, Event, To)
|
||||
|
||||
-- Check CAP missions.
|
||||
self:CheckCAP()
|
||||
|
||||
-- Check CAP missions.
|
||||
self:CheckCAS()
|
||||
|
||||
-- Check TANKER missions.
|
||||
self:CheckTANKER()
|
||||
@@ -1178,6 +1234,47 @@ function AIRWING:CheckCAP()
|
||||
return self
|
||||
end
|
||||
|
||||
--- Check how many CAS missions are assigned and add number of missing missions.
|
||||
-- @param #AIRWING self
|
||||
-- @return #AIRWING self
|
||||
function AIRWING:CheckCAS()
|
||||
|
||||
local Ncap=0
|
||||
|
||||
|
||||
-- Count CAP missions.
|
||||
for _,_mission in pairs(self.missionqueue) do
|
||||
local mission=_mission --Ops.Auftrag#AUFTRAG
|
||||
|
||||
if mission:IsNotOver() and (mission.type==AUFTRAG.Type.CASENHANCED or mission.type == AUFTRAG.Type.PATROLRACETRACK) and mission.patroldata then
|
||||
Ncap=Ncap+1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
for i=1,self.nflightsCAS-Ncap do
|
||||
|
||||
local patrol=self:_GetPatrolData(self.pointsCAS)
|
||||
|
||||
local altitude=patrol.altitude+500*patrol.noccupied
|
||||
|
||||
local missionCAS = nil -- Ops.Auftrag#AUFTRAG
|
||||
|
||||
missionCAS=AUFTRAG:NewCASENHANCED(patrol.zone,altitude,patrol.speed,patrol.RangeMax,patrol.NoEngageZoneSet,patrol.TargetTypes)
|
||||
|
||||
missionCAS.patroldata=patrol
|
||||
|
||||
patrol.noccupied=patrol.noccupied+1
|
||||
|
||||
if self.markpoints then AIRWING.UpdatePatrolPointMarker(patrol) end
|
||||
|
||||
self:AddMission(missionCAS)
|
||||
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Check how many RECON missions are assigned and add number of missing missions.
|
||||
-- @param #AIRWING self
|
||||
-- @return #AIRWING self
|
||||
|
||||
Reference in New Issue
Block a user