mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#EASYGCICAP
* Closer turning cap routes
This commit is contained in:
parent
375a564446
commit
f28f807ee7
@ -54,7 +54,9 @@
|
|||||||
-- @field #string takeoffType Take of type.
|
-- @field #string takeoffType Take of type.
|
||||||
-- @field #boolean despawnAfterLanding Aircraft are despawned after landing.
|
-- @field #boolean despawnAfterLanding Aircraft are despawned after landing.
|
||||||
-- @field #boolean despawnAfterHolding Aircraft are despawned after holding.
|
-- @field #boolean despawnAfterHolding Aircraft are despawned after holding.
|
||||||
--
|
-- @field #boolean capOptionPatrolRaceTrack Use closer patrol race track or standard orbit auftrag.
|
||||||
|
-- @field #number capFormation If capOptionPatrolRaceTrack is true, set the formation, also.
|
||||||
|
--
|
||||||
-- @extends Ops.Legion#LEGION
|
-- @extends Ops.Legion#LEGION
|
||||||
|
|
||||||
--- *I fly because it releases my mind from the tyranny of petty things.* -- Antoine de Saint-Exupery
|
--- *I fly because it releases my mind from the tyranny of petty things.* -- Antoine de Saint-Exupery
|
||||||
@ -128,6 +130,8 @@ AIRWING = {
|
|||||||
pointsAWACS = {},
|
pointsAWACS = {},
|
||||||
pointsRecon = {},
|
pointsRecon = {},
|
||||||
markpoints = false,
|
markpoints = false,
|
||||||
|
capOptionPatrolRaceTrack = false,
|
||||||
|
capFormation = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Payload data.
|
--- Payload data.
|
||||||
@ -179,7 +183,7 @@ AIRWING = {
|
|||||||
|
|
||||||
--- AIRWING class version.
|
--- AIRWING class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AIRWING.version="0.9.3"
|
AIRWING.version="0.9.4"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- ToDo list
|
-- ToDo list
|
||||||
@ -699,6 +703,24 @@ function AIRWING:SetNumberCAP(n)
|
|||||||
return self
|
return self
|
||||||
end
|
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).
|
||||||
|
-- @return #AIRWING self
|
||||||
|
function AIRWING:SetCAPFormation(Formation)
|
||||||
|
self.capFormation = Formation
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set CAP close race track.We'll utilize the AUFTRAG PatrolRaceTrack instead of a standard race track orbit task.
|
||||||
|
-- @param #AIRWING self
|
||||||
|
-- @param #boolean OnOff If true, switch this on, else switch off. Off by default.
|
||||||
|
-- @return #AIRWING self
|
||||||
|
function AIRWING:SetCapCloseRaceTrack(OnOff)
|
||||||
|
self.capOptionPatrolRaceTrack = OnOff
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set number of TANKER flights with Boom constantly in the air.
|
--- Set number of TANKER flights with Boom constantly in the air.
|
||||||
-- @param #AIRWING self
|
-- @param #AIRWING self
|
||||||
-- @param #number Nboom Number of flights. Default 1.
|
-- @param #number Nboom Number of flights. Default 1.
|
||||||
@ -1112,13 +1134,14 @@ end
|
|||||||
-- @return #AIRWING self
|
-- @return #AIRWING self
|
||||||
function AIRWING:CheckCAP()
|
function AIRWING:CheckCAP()
|
||||||
|
|
||||||
local Ncap=0 --self:CountMissionsInQueue({AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT})
|
local Ncap=0
|
||||||
|
|
||||||
|
|
||||||
-- Count CAP missions.
|
-- Count CAP missions.
|
||||||
for _,_mission in pairs(self.missionqueue) do
|
for _,_mission in pairs(self.missionqueue) do
|
||||||
local mission=_mission --Ops.Auftrag#AUFTRAG
|
local mission=_mission --Ops.Auftrag#AUFTRAG
|
||||||
|
|
||||||
if mission:IsNotOver() and mission.type==AUFTRAG.Type.GCICAP and mission.patroldata then
|
if mission:IsNotOver() and (mission.type==AUFTRAG.Type.GCICAP or mission.type == AUFTRAG.Type.PATROLRACETRACK) and mission.patroldata then
|
||||||
Ncap=Ncap+1
|
Ncap=Ncap+1
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1130,8 +1153,18 @@ function AIRWING:CheckCAP()
|
|||||||
|
|
||||||
local altitude=patrol.altitude+1000*patrol.noccupied
|
local altitude=patrol.altitude+1000*patrol.noccupied
|
||||||
|
|
||||||
local missionCAP=AUFTRAG:NewGCICAP(patrol.coord, altitude, patrol.speed, patrol.heading, patrol.leg)
|
local missionCAP = nil -- Ops.Auftrag#AUFTRAG
|
||||||
|
|
||||||
|
if self.capOptionPatrolRaceTrack then
|
||||||
|
|
||||||
|
missionCAP=AUFTRAG:NewPATROL_RACETRACK(patrol.coord,altitude,patrol.speed,patrol.heading,patrol.leg, self.capFormation)
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
missionCAP=AUFTRAG:NewGCICAP(patrol.coord, altitude, patrol.speed, patrol.heading, patrol.leg)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
missionCAP.patroldata=patrol
|
missionCAP.patroldata=patrol
|
||||||
|
|
||||||
patrol.noccupied=patrol.noccupied+1
|
patrol.noccupied=patrol.noccupied+1
|
||||||
@ -1150,7 +1183,7 @@ end
|
|||||||
-- @return #AIRWING self
|
-- @return #AIRWING self
|
||||||
function AIRWING:CheckRECON()
|
function AIRWING:CheckRECON()
|
||||||
|
|
||||||
local Ncap=0 --self:CountMissionsInQueue({AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT})
|
local Ncap=0
|
||||||
|
|
||||||
-- Count CAP missions.
|
-- Count CAP missions.
|
||||||
for _,_mission in pairs(self.missionqueue) do
|
for _,_mission in pairs(self.missionqueue) do
|
||||||
@ -1278,7 +1311,6 @@ function AIRWING:CheckAWACS()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
for i=1,self.nflightsAWACS-N do
|
for i=1,self.nflightsAWACS-N do
|
||||||
|
|
||||||
local patrol=self:_GetPatrolData(self.pointsAWACS)
|
local patrol=self:_GetPatrolData(self.pointsAWACS)
|
||||||
|
|||||||
@ -443,6 +443,7 @@ _AUFTRAGSNR=0
|
|||||||
-- @field #string REARMING Rearming mission.
|
-- @field #string REARMING Rearming mission.
|
||||||
-- @field #string CAPTUREZONE Capture zone mission.
|
-- @field #string CAPTUREZONE Capture zone mission.
|
||||||
-- @field #string NOTHING Nothing.
|
-- @field #string NOTHING Nothing.
|
||||||
|
-- @field #string PATROLRACETRACK Patrol Racetrack.
|
||||||
AUFTRAG.Type={
|
AUFTRAG.Type={
|
||||||
ANTISHIP="Anti Ship",
|
ANTISHIP="Anti Ship",
|
||||||
AWACS="AWACS",
|
AWACS="AWACS",
|
||||||
@ -484,10 +485,10 @@ AUFTRAG.Type={
|
|||||||
RELOCATECOHORT="Relocate Cohort",
|
RELOCATECOHORT="Relocate Cohort",
|
||||||
AIRDEFENSE="Air Defence",
|
AIRDEFENSE="Air Defence",
|
||||||
EWR="Early Warning Radar",
|
EWR="Early Warning Radar",
|
||||||
--RECOVERYTANKER="Recovery Tanker",
|
|
||||||
REARMING="Rearming",
|
REARMING="Rearming",
|
||||||
CAPTUREZONE="Capture Zone",
|
CAPTUREZONE="Capture Zone",
|
||||||
NOTHING="Nothing",
|
NOTHING="Nothing",
|
||||||
|
PATROLRACETRACK="Patrol Racetrack",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Special task description.
|
--- Special task description.
|
||||||
@ -511,6 +512,7 @@ AUFTRAG.Type={
|
|||||||
-- @field #string REARMING Rearming.
|
-- @field #string REARMING Rearming.
|
||||||
-- @field #string CAPTUREZONE Capture OPS zone.
|
-- @field #string CAPTUREZONE Capture OPS zone.
|
||||||
-- @field #string NOTHING Nothing.
|
-- @field #string NOTHING Nothing.
|
||||||
|
-- @field #string PATROLRACETRACK Patrol Racetrack.
|
||||||
AUFTRAG.SpecialTask={
|
AUFTRAG.SpecialTask={
|
||||||
FORMATION="Formation",
|
FORMATION="Formation",
|
||||||
PATROLZONE="PatrolZone",
|
PATROLZONE="PatrolZone",
|
||||||
@ -532,6 +534,7 @@ AUFTRAG.SpecialTask={
|
|||||||
REARMING="Rearming",
|
REARMING="Rearming",
|
||||||
CAPTUREZONE="Capture Zone",
|
CAPTUREZONE="Capture Zone",
|
||||||
NOTHING="Nothing",
|
NOTHING="Nothing",
|
||||||
|
PATROLRACETRACK="Patrol Racetrack",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Mission status.
|
--- Mission status.
|
||||||
@ -652,7 +655,7 @@ AUFTRAG.Category={
|
|||||||
|
|
||||||
--- AUFTRAG class version.
|
--- AUFTRAG class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AUFTRAG.version="1.2.0"
|
AUFTRAG.version="1.2.1"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@ -1017,7 +1020,7 @@ end
|
|||||||
-- @param #number Altitude Hover altitude in feet AGL. Default is 50 feet above ground.
|
-- @param #number Altitude Hover altitude in feet AGL. Default is 50 feet above ground.
|
||||||
-- @param #number Time Time in seconds to hold the hover. Default 300 seconds.
|
-- @param #number Time Time in seconds to hold the hover. Default 300 seconds.
|
||||||
-- @param #number Speed Speed in knots to fly to the target coordinate. Default 150kn.
|
-- @param #number Speed Speed in knots to fly to the target coordinate. Default 150kn.
|
||||||
-- @param #number MissionAlt Altitide to fly towards the mission in feet AGL. Default 1000ft.
|
-- @param #number MissionAlt Altitude to fly towards the mission in feet AGL. Default 1000ft.
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
function AUFTRAG:NewHOVER(Coordinate, Altitude, Time, Speed, MissionAlt)
|
function AUFTRAG:NewHOVER(Coordinate, Altitude, Time, Speed, MissionAlt)
|
||||||
|
|
||||||
@ -1049,6 +1052,58 @@ function AUFTRAG:NewHOVER(Coordinate, Altitude, Time, Speed, MissionAlt)
|
|||||||
return mission
|
return mission
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- **[AIR]** Create an enhanced orbit race track mission. Planes will keep closer to the track.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @param Core.Point#COORDINATE Coordinate Where to start the race track.
|
||||||
|
-- @param #number Altitude (Optional) Altitude in feet. Defaults to 20,000ft.
|
||||||
|
-- @param #number Speed (Optional) Speed in knots. Defaults to 300kn.
|
||||||
|
-- @param #number Heading (Optional) Heading in degrees, 0 to 360. Defaults to 90 degree (East).
|
||||||
|
-- @param #number Leg (Optional) Leg of the race track in NM. Defaults to 10nm.
|
||||||
|
-- @param #number Formation (Optional) Formation to take, e.g. ENUMS.Formation.FixedWing.Trail.Close, also see [Hoggit Wiki](https://wiki.hoggitworld.com/view/DCS_option_formation).
|
||||||
|
-- @return #AUFTRAG self
|
||||||
|
function AUFTRAG:NewPATROL_RACETRACK(Coordinate,Altitude,Speed,Heading,Leg,Formation)
|
||||||
|
|
||||||
|
local mission = AUFTRAG:New(AUFTRAG.Type.PATROLRACETRACK)
|
||||||
|
|
||||||
|
-- Target.
|
||||||
|
mission:_TargetFromObject(Coordinate)
|
||||||
|
|
||||||
|
-- Set Altitude.
|
||||||
|
if Altitude then
|
||||||
|
mission.TrackAltitude=UTILS.FeetToMeters(Altitude)
|
||||||
|
else
|
||||||
|
mission.TrackAltitude=UTILS.FeetToMeters(20000)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Points
|
||||||
|
mission.TrackPoint1 = Coordinate
|
||||||
|
|
||||||
|
local leg = UTILS.NMToMeters(Leg) or UTILS.NMToMeters(10)
|
||||||
|
|
||||||
|
local heading = Heading or 90
|
||||||
|
|
||||||
|
if heading < 0 or heading > 360 then heading = 90 end
|
||||||
|
|
||||||
|
mission.TrackPoint2 = Coordinate:Translate(leg,heading,true)
|
||||||
|
|
||||||
|
-- Orbit speed in m/s TAS.
|
||||||
|
mission.TrackSpeed = UTILS.IasToTas(UTILS.KnotsToKmph(Speed or 300), mission.TrackAltitude)
|
||||||
|
|
||||||
|
-- Mission speed in km/h and altitude
|
||||||
|
mission.missionSpeed = UTILS.KnotsToKmph(Speed or 300)
|
||||||
|
mission.missionAltitude = mission.TrackAltitude * 0.9
|
||||||
|
mission.missionTask=ENUMS.MissionTask.CAP
|
||||||
|
mission.optionROE=ENUMS.ROE.ReturnFire
|
||||||
|
mission.optionROT=ENUMS.ROT.PassiveDefense
|
||||||
|
|
||||||
|
mission.categories={AUFTRAG.Category.AIRCRAFT}
|
||||||
|
|
||||||
|
mission.DCStask=mission:GetDCSMissionTask()
|
||||||
|
|
||||||
|
return mission
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- **[AIR]** Create an ORBIT mission, which can be either a circular orbit or a race-track pattern.
|
--- **[AIR]** Create an ORBIT mission, which can be either a circular orbit or a race-track pattern.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Core.Point#COORDINATE Coordinate Where to orbit.
|
-- @param Core.Point#COORDINATE Coordinate Where to orbit.
|
||||||
@ -1181,7 +1236,7 @@ function AUFTRAG:NewORBIT_GROUP(Group, Altitude, Speed, Leg, Heading, OffsetVec2
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- **[AIR]** Create a Ground Controlled CAP (GCICAP) mission. Flights with this task are considered for A2A INTERCEPT missions by the CHIEF class. They will perform a compat air patrol but not engage by
|
--- **[AIR]** Create a Ground Controlled CAP (GCICAP) mission. Flights with this task are considered for A2A INTERCEPT missions by the CHIEF class. They will perform a combat air patrol but not engage by
|
||||||
-- themselfs. They wait for the CHIEF to tell them whom to engage.
|
-- themselfs. They wait for the CHIEF to tell them whom to engage.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Core.Point#COORDINATE Coordinate Where to orbit.
|
-- @param Core.Point#COORDINATE Coordinate Where to orbit.
|
||||||
@ -2688,6 +2743,8 @@ function AUFTRAG:NewAUTO(EngageGroup)
|
|||||||
mission=AUFTRAG:NewTANKER(Coordinate,Altitude,Speed,Heading,Leg,RefuelSystem)
|
mission=AUFTRAG:NewTANKER(Coordinate,Altitude,Speed,Heading,Leg,RefuelSystem)
|
||||||
elseif auftrag==AUFTRAG.Type.TROOPTRANSPORT then
|
elseif auftrag==AUFTRAG.Type.TROOPTRANSPORT then
|
||||||
mission=AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet,DropoffCoordinate,PickupCoordinate)
|
mission=AUFTRAG:NewTROOPTRANSPORT(TransportGroupSet,DropoffCoordinate,PickupCoordinate)
|
||||||
|
elseif auftrag==AUFTRAG.Type.PATROLRACETRACK then
|
||||||
|
mission=AUFTRAG:NewPATROL_RACETRACK(Coordinate,Altitude,Speed,Heading,Leg,Formation)
|
||||||
else
|
else
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -6343,8 +6400,32 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
|
|
||||||
DCStask.params=param
|
DCStask.params=param
|
||||||
|
|
||||||
table.insert(DCStasks, DCStask)
|
table.insert(DCStasks, DCStask)
|
||||||
|
|
||||||
|
elseif self.type==AUFTRAG.Type.PATROLRACETRACK then
|
||||||
|
|
||||||
|
---------------------
|
||||||
|
-- Enhanced Orbit Racetrack --
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
local DCStask={}
|
||||||
|
DCStask.id=AUFTRAG.SpecialTask.PATROLRACETRACK
|
||||||
|
|
||||||
|
local param={}
|
||||||
|
-- ONTROLLABLE:PatrolRaceTrack(Point1, Point2, Altitude, Speed, Formation, Delay)
|
||||||
|
|
||||||
|
param.TrackAltitude = self.TrackAltitude
|
||||||
|
param.TrackSpeed = self.TrackSpeed
|
||||||
|
param.TrackPoint1 = self.TrackPoint1
|
||||||
|
param.TrackPoint2 = self.TrackPoint2
|
||||||
|
param.missionSpeed = self.missionSpeed
|
||||||
|
param.missionAltitude = self.missionAltitude
|
||||||
|
param.TrackFormation = self.TrackFormation
|
||||||
|
|
||||||
|
DCStask.params=param
|
||||||
|
|
||||||
|
table.insert(DCStasks, DCStask)
|
||||||
|
|
||||||
elseif self.type==AUFTRAG.Type.HOVER then
|
elseif self.type==AUFTRAG.Type.HOVER then
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
@ -6619,6 +6700,8 @@ function AUFTRAG:GetMissionTaskforMissionType(MissionType)
|
|||||||
mtask=ENUMS.MissionTask.NOTHING
|
mtask=ENUMS.MissionTask.NOTHING
|
||||||
elseif MissionType==AUFTRAG.Type.HOVER then
|
elseif MissionType==AUFTRAG.Type.HOVER then
|
||||||
mtask=ENUMS.MissionTask.NOTHING
|
mtask=ENUMS.MissionTask.NOTHING
|
||||||
|
elseif MissionType==AUFTRAG.Type.PATROLRACETRACK then
|
||||||
|
mtask=ENUMS.MissionTask.CAP
|
||||||
end
|
end
|
||||||
|
|
||||||
return mtask
|
return mtask
|
||||||
|
|||||||
@ -75,7 +75,7 @@ COHORT = {
|
|||||||
livery = nil,
|
livery = nil,
|
||||||
skill = nil,
|
skill = nil,
|
||||||
legion = nil,
|
legion = nil,
|
||||||
Ngroups = nil,
|
--Ngroups = nil,
|
||||||
Ngroups = 0,
|
Ngroups = 0,
|
||||||
engageRange = nil,
|
engageRange = nil,
|
||||||
tacanChannel = {},
|
tacanChannel = {},
|
||||||
@ -1098,7 +1098,7 @@ function COHORT:RecruitAssets(MissionType, Npayloads)
|
|||||||
-- Assets on mission NOTHING are considered.
|
-- Assets on mission NOTHING are considered.
|
||||||
table.insert(assets, asset)
|
table.insert(assets, asset)
|
||||||
|
|
||||||
elseif self.legion:IsAssetOnMission(asset, AUFTRAG.Type.GCICAP) and MissionType==AUFTRAG.Type.INTERCEPT then
|
elseif self.legion:IsAssetOnMission(asset, {AUFTRAG.Type.GCICAP, AUFTRAG.Type.PATROLRACETRACK}) and MissionType==AUFTRAG.Type.INTERCEPT then
|
||||||
|
|
||||||
-- Check if the payload of this asset is compatible with the mission.
|
-- Check if the payload of this asset is compatible with the mission.
|
||||||
-- Note: we do not check the payload as an asset that is on a GCICAP mission should be able to do an INTERCEPT as well!
|
-- Note: we do not check the payload as an asset that is on a GCICAP mission should be able to do an INTERCEPT as well!
|
||||||
@ -1595,4 +1595,3 @@ end
|
|||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,7 @@
|
|||||||
-- @field Core.Set#SET_ZONE NoGoZoneSet
|
-- @field Core.Set#SET_ZONE NoGoZoneSet
|
||||||
-- @field #boolean Monitor
|
-- @field #boolean Monitor
|
||||||
-- @field #boolean TankerInvisible
|
-- @field #boolean TankerInvisible
|
||||||
|
-- @field #number CapFormation
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
--- *“Airspeed, altitude, and brains. Two are always needed to successfully complete the flight.”* -- Unknown.
|
--- *“Airspeed, altitude, and brains. Two are always needed to successfully complete the flight.”* -- Unknown.
|
||||||
@ -207,6 +208,7 @@ EASYGCICAP = {
|
|||||||
NoGoZoneSet = nil,
|
NoGoZoneSet = nil,
|
||||||
Monitor = false,
|
Monitor = false,
|
||||||
TankerInvisible = true,
|
TankerInvisible = true,
|
||||||
|
CapFormation = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Internal Squadron data type
|
--- Internal Squadron data type
|
||||||
@ -242,7 +244,7 @@ EASYGCICAP = {
|
|||||||
|
|
||||||
--- EASYGCICAP class version.
|
--- EASYGCICAP class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
EASYGCICAP.version="0.0.8"
|
EASYGCICAP.version="0.0.9"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@ -289,6 +291,7 @@ function EASYGCICAP:New(Alias, AirbaseName, Coalition, EWRName)
|
|||||||
self.repeatsonfailure = 3
|
self.repeatsonfailure = 3
|
||||||
self.Monitor = false
|
self.Monitor = false
|
||||||
self.TankerInvisible = true
|
self.TankerInvisible = true
|
||||||
|
self.CapFormation = ENUMS.Formation.FixedWing.FingerFour.Group
|
||||||
|
|
||||||
-- Set some string id for output to DCS.log file.
|
-- Set some string id for output to DCS.log file.
|
||||||
self.lid=string.format("EASYGCICAP %s | ", self.alias)
|
self.lid=string.format("EASYGCICAP %s | ", self.alias)
|
||||||
@ -313,6 +316,14 @@ end
|
|||||||
-- Functions
|
-- Functions
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
--- Set CAP formation.
|
||||||
|
-- @param #EASYGCICAP self
|
||||||
|
-- @param #number Formation Formation to fly, defaults to ENUMS.Formation.FixedWing.FingerFour.Group
|
||||||
|
-- @return #EASYGCICAP self
|
||||||
|
function EASYGCICAP:SetCAPFormation(Formation)
|
||||||
|
self.CapFormation = Formation
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set Tanker and AWACS to be invisible to enemy AI eyes
|
--- Set Tanker and AWACS to be invisible to enemy AI eyes
|
||||||
-- @param #EASYGCICAP self
|
-- @param #EASYGCICAP self
|
||||||
@ -476,6 +487,8 @@ end
|
|||||||
function EASYGCICAP:_AddAirwing(Airbasename, Alias)
|
function EASYGCICAP:_AddAirwing(Airbasename, Alias)
|
||||||
self:T(self.lid.."_AddAirwing "..Airbasename)
|
self:T(self.lid.."_AddAirwing "..Airbasename)
|
||||||
|
|
||||||
|
local CapFormation = self.CapFormation
|
||||||
|
|
||||||
-- Create Airwing
|
-- Create Airwing
|
||||||
local CAP_Wing = AIRWING:New(Airbasename,Alias)
|
local CAP_Wing = AIRWING:New(Airbasename,Alias)
|
||||||
CAP_Wing:SetVerbosityLevel(3)
|
CAP_Wing:SetVerbosityLevel(3)
|
||||||
@ -484,11 +497,15 @@ function EASYGCICAP:_AddAirwing(Airbasename, Alias)
|
|||||||
CAP_Wing:SetAirbase(AIRBASE:FindByName(Airbasename))
|
CAP_Wing:SetAirbase(AIRBASE:FindByName(Airbasename))
|
||||||
CAP_Wing:SetRespawnAfterDestroyed()
|
CAP_Wing:SetRespawnAfterDestroyed()
|
||||||
CAP_Wing:SetNumberCAP(self.capgrouping)
|
CAP_Wing:SetNumberCAP(self.capgrouping)
|
||||||
|
CAP_Wing:SetCapCloseRaceTrack(true)
|
||||||
|
if CapFormation then
|
||||||
|
CAP_Wing:SetCAPFormation(CapFormation)
|
||||||
|
end
|
||||||
if #self.ManagedTK > 0 then
|
if #self.ManagedTK > 0 then
|
||||||
CAP_Wing:SetNumberTankerBoom(1)
|
CAP_Wing:SetNumberTankerBoom(1)
|
||||||
CAP_Wing:SetNumberTankerProbe(1)
|
CAP_Wing:SetNumberTankerProbe(1)
|
||||||
end
|
end
|
||||||
if #self.ManagedAW > 0 then
|
if #self.ManagedEWR > 0 then
|
||||||
CAP_Wing:SetNumberAWACS(1)
|
CAP_Wing:SetNumberAWACS(1)
|
||||||
end
|
end
|
||||||
if #self.ManagedREC > 0 then
|
if #self.ManagedREC > 0 then
|
||||||
@ -515,6 +532,9 @@ function EASYGCICAP:_AddAirwing(Airbasename, Alias)
|
|||||||
flightgroup:SetDetection(true)
|
flightgroup:SetDetection(true)
|
||||||
flightgroup:SetEngageDetectedOn(self.engagerange,{"Air"},self.GoZoneSet,self.NoGoZoneSet)
|
flightgroup:SetEngageDetectedOn(self.engagerange,{"Air"},self.GoZoneSet,self.NoGoZoneSet)
|
||||||
flightgroup:SetOutOfAAMRTB()
|
flightgroup:SetOutOfAAMRTB()
|
||||||
|
if CapFormation then
|
||||||
|
flightgroup:GetGroup():SetOption(AI.Option.Air.id.FORMATION,CapFormation)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if Mission.type == AUFTRAG.Type.TANKER or Mission.type == AUFTRAG.Type.AWACS or Mission.type == AUFTRAG.Type.RECON then
|
if Mission.type == AUFTRAG.Type.TANKER or Mission.type == AUFTRAG.Type.AWACS or Mission.type == AUFTRAG.Type.RECON then
|
||||||
if TankerInvisible then
|
if TankerInvisible then
|
||||||
@ -888,7 +908,7 @@ function EASYGCICAP:_AddSquadron(TemplateName, SquadName, AirbaseName, AirFrames
|
|||||||
self:T(self.lid.."_AddSquadron "..SquadName)
|
self:T(self.lid.."_AddSquadron "..SquadName)
|
||||||
-- Add Squadrons
|
-- Add Squadrons
|
||||||
local Squadron_One = SQUADRON:New(TemplateName,AirFrames,SquadName)
|
local Squadron_One = SQUADRON:New(TemplateName,AirFrames,SquadName)
|
||||||
Squadron_One:AddMissionCapability({AUFTRAG.Type.CAP, AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.ALERT5})
|
Squadron_One:AddMissionCapability({AUFTRAG.Type.CAP, AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.PATROLRACETRACK, AUFTRAG.Type.ALERT5})
|
||||||
--Squadron_One:SetFuelLowRefuel(true)
|
--Squadron_One:SetFuelLowRefuel(true)
|
||||||
Squadron_One:SetFuelLowThreshold(0.3)
|
Squadron_One:SetFuelLowThreshold(0.3)
|
||||||
Squadron_One:SetTurnoverTime(10,20)
|
Squadron_One:SetTurnoverTime(10,20)
|
||||||
@ -900,7 +920,7 @@ function EASYGCICAP:_AddSquadron(TemplateName, SquadName, AirbaseName, AirFrames
|
|||||||
local wing = self.wings[AirbaseName][1] -- Ops.AirWing#AIRWING
|
local wing = self.wings[AirbaseName][1] -- Ops.AirWing#AIRWING
|
||||||
|
|
||||||
wing:AddSquadron(Squadron_One)
|
wing:AddSquadron(Squadron_One)
|
||||||
wing:NewPayload(TemplateName,-1,{AUFTRAG.Type.CAP, AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.ALERT5},75)
|
wing:NewPayload(TemplateName,-1,{AUFTRAG.Type.CAP, AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.PATROLRACETRACK, AUFTRAG.Type.ALERT5},75)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -1234,12 +1254,16 @@ function EASYGCICAP:onafterStatus(From,Event,To)
|
|||||||
local capmission = 0
|
local capmission = 0
|
||||||
local interceptmission = 0
|
local interceptmission = 0
|
||||||
local reconmission = 0
|
local reconmission = 0
|
||||||
|
local awacsmission = 0
|
||||||
|
local tankermission = 0
|
||||||
for _,_wing in pairs(self.wings) do
|
for _,_wing in pairs(self.wings) do
|
||||||
local count = _wing[1]:CountAssetsOnMission(MissionTypes,Cohort)
|
local count = _wing[1]:CountAssetsOnMission(MissionTypes,Cohort)
|
||||||
local count2 = _wing[1]:CountAssets(true,MissionTypes,Attributes)
|
local count2 = _wing[1]:CountAssets(true,MissionTypes,Attributes)
|
||||||
capmission = capmission + _wing[1]:CountMissionsInQueue({AUFTRAG.Type.GCICAP})
|
capmission = capmission + _wing[1]:CountMissionsInQueue({AUFTRAG.Type.GCICAP,AUFTRAG.Type.PATROLRACETRACK})
|
||||||
interceptmission = interceptmission + _wing[1]:CountMissionsInQueue({AUFTRAG.Type.INTERCEPT})
|
interceptmission = interceptmission + _wing[1]:CountMissionsInQueue({AUFTRAG.Type.INTERCEPT})
|
||||||
reconmission = reconmission + _wing[1]:CountMissionsInQueue({AUFTRAG.Type.RECON})
|
reconmission = reconmission + _wing[1]:CountMissionsInQueue({AUFTRAG.Type.RECON})
|
||||||
|
awacsmission = awacsmission + _wing[1]:CountMissionsInQueue({AUFTRAG.Type.AWACS})
|
||||||
|
tankermission = tankermission + _wing[1]:CountMissionsInQueue({AUFTRAG.Type.TANKER})
|
||||||
assets = assets + count
|
assets = assets + count
|
||||||
instock = instock + count2
|
instock = instock + count2
|
||||||
end
|
end
|
||||||
@ -1251,6 +1275,8 @@ function EASYGCICAP:onafterStatus(From,Event,To)
|
|||||||
text = text.."\nMissions: "..capmission+interceptmission
|
text = text.."\nMissions: "..capmission+interceptmission
|
||||||
text = text.."\n - CAP: "..capmission
|
text = text.."\n - CAP: "..capmission
|
||||||
text = text.."\n - Intercept: "..interceptmission
|
text = text.."\n - Intercept: "..interceptmission
|
||||||
|
text = text.."\n - AWACS: "..awacsmission
|
||||||
|
text = text.."\n - TANKER: "..tankermission
|
||||||
text = text.."\n - Recon: "..reconmission
|
text = text.."\n - Recon: "..reconmission
|
||||||
MESSAGE:New(text,15,"GCICAP"):ToAll():ToLogIf(self.debug)
|
MESSAGE:New(text,15,"GCICAP"):ToAll():ToLogIf(self.debug)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2605,6 +2605,9 @@ function FLIGHTGROUP:onbeforeUpdateRoute(From, Event, To, n, N)
|
|||||||
elseif task.dcstask.id==AUFTRAG.SpecialTask.RECON then
|
elseif task.dcstask.id==AUFTRAG.SpecialTask.RECON then
|
||||||
-- For recon missions, we need to allow the update as we insert new waypoints.
|
-- For recon missions, we need to allow the update as we insert new waypoints.
|
||||||
self:T2(self.lid.."Allowing update route for Task: ReconMission")
|
self:T2(self.lid.."Allowing update route for Task: ReconMission")
|
||||||
|
elseif task.dcstask.id==AUFTRAG.SpecialTask.PATROLRACETRACK then
|
||||||
|
-- For recon missions, we need to allow the update as we insert new waypoints.
|
||||||
|
self:T2(self.lid.."Allowing update route for Task: Patrol Race Track")
|
||||||
elseif task.dcstask.id==AUFTRAG.SpecialTask.HOVER then
|
elseif task.dcstask.id==AUFTRAG.SpecialTask.HOVER then
|
||||||
-- For recon missions, we need to allow the update as we insert new waypoints.
|
-- For recon missions, we need to allow the update as we insert new waypoints.
|
||||||
self:T2(self.lid.."Allowing update route for Task: Hover")
|
self:T2(self.lid.."Allowing update route for Task: Hover")
|
||||||
|
|||||||
@ -965,7 +965,7 @@ function LEGION:onafterMissionRequest(From, Event, To, Mission, Assets)
|
|||||||
local pause=false
|
local pause=false
|
||||||
|
|
||||||
-- Check if mission is INTERCEPT and asset is currently on GCI mission. If so, GCI is paused.
|
-- Check if mission is INTERCEPT and asset is currently on GCI mission. If so, GCI is paused.
|
||||||
if currM.type==AUFTRAG.Type.GCICAP and Mission.type==AUFTRAG.Type.INTERCEPT then
|
if (currM.type==AUFTRAG.Type.GCICAP or currM.type==AUFTRAG.Type.PATROLRACETRACK) and Mission.type==AUFTRAG.Type.INTERCEPT then
|
||||||
pause=true
|
pause=true
|
||||||
elseif (currM.type==AUFTRAG.Type.ONGUARD or currM.type==AUFTRAG.Type.PATROLZONE) and (Mission.type==AUFTRAG.Type.ARTY or Mission.type==AUFTRAG.Type.GROUNDATTACK) then
|
elseif (currM.type==AUFTRAG.Type.ONGUARD or currM.type==AUFTRAG.Type.PATROLZONE) and (Mission.type==AUFTRAG.Type.ARTY or Mission.type==AUFTRAG.Type.GROUNDATTACK) then
|
||||||
pause=true
|
pause=true
|
||||||
@ -1445,7 +1445,7 @@ end
|
|||||||
-- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The asset that returned.
|
-- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The asset that returned.
|
||||||
function LEGION:onafterLegionAssetReturned(From, Event, To, Cohort, Asset)
|
function LEGION:onafterLegionAssetReturned(From, Event, To, Cohort, Asset)
|
||||||
-- Debug message.
|
-- Debug message.
|
||||||
self:I(self.lid..string.format("Asset %s from Cohort %s returned! asset.assignment=\"%s\"", Asset.spawngroupname, Cohort.name, tostring(Asset.assignment)))
|
self:T(self.lid..string.format("Asset %s from Cohort %s returned! asset.assignment=\"%s\"", Asset.spawngroupname, Cohort.name, tostring(Asset.assignment)))
|
||||||
|
|
||||||
-- Stop flightgroup.
|
-- Stop flightgroup.
|
||||||
if Asset.flightgroup and not Asset.flightgroup:IsStopped() then
|
if Asset.flightgroup and not Asset.flightgroup:IsStopped() then
|
||||||
@ -2557,9 +2557,10 @@ function LEGION._CohortCan(Cohort, MissionType, Categories, Attributes, Properti
|
|||||||
|
|
||||||
-- Distance to target.
|
-- Distance to target.
|
||||||
local TargetDistance=TargetVec2 and UTILS.VecDist2D(TargetVec2, cohort.legion:GetVec2()) or 0
|
local TargetDistance=TargetVec2 and UTILS.VecDist2D(TargetVec2, cohort.legion:GetVec2()) or 0
|
||||||
|
|
||||||
-- Is in range?
|
-- Is in range?
|
||||||
local Rmax=cohort:GetMissionRange(WeaponTypes)
|
local Rmax=cohort:GetMissionRange(WeaponTypes)
|
||||||
|
local RangeMax = RangeMax or 0
|
||||||
local InRange=(RangeMax and math.max(RangeMax, Rmax) or Rmax) >= TargetDistance
|
local InRange=(RangeMax and math.max(RangeMax, Rmax) or Rmax) >= TargetDistance
|
||||||
|
|
||||||
return InRange
|
return InRange
|
||||||
@ -2610,6 +2611,7 @@ function LEGION._CohortCan(Cohort, MissionType, Categories, Attributes, Properti
|
|||||||
-- Is capable of the mission type?
|
-- Is capable of the mission type?
|
||||||
local can=AUFTRAG.CheckMissionCapability(MissionType, Cohort.missiontypes)
|
local can=AUFTRAG.CheckMissionCapability(MissionType, Cohort.missiontypes)
|
||||||
|
|
||||||
|
|
||||||
if can then
|
if can then
|
||||||
can=CheckCategory(Cohort)
|
can=CheckCategory(Cohort)
|
||||||
else
|
else
|
||||||
@ -2687,7 +2689,7 @@ function LEGION._CohortCan(Cohort, MissionType, Categories, Attributes, Properti
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Recruit assets from Cohorts for the given parameters. **NOTE** that we set the `asset.isReserved=true` flag so it cant be recruited by anyone else.
|
--- Recruit assets from Cohorts for the given parameters. **NOTE** that we set the `asset.isReserved=true` flag so it cannot be recruited by anyone else.
|
||||||
-- @param #table Cohorts Cohorts included.
|
-- @param #table Cohorts Cohorts included.
|
||||||
-- @param #string MissionTypeRecruit Mission type for recruiting the cohort assets.
|
-- @param #string MissionTypeRecruit Mission type for recruiting the cohort assets.
|
||||||
-- @param #string MissionTypeOpt Mission type for which the assets are optimized. Default is the same as `MissionTypeRecruit`.
|
-- @param #string MissionTypeOpt Mission type for which the assets are optimized. Default is the same as `MissionTypeRecruit`.
|
||||||
@ -3181,7 +3183,7 @@ function LEGION.CalculateAssetMissionScore(asset, MissionType, TargetVec2, Inclu
|
|||||||
if currmission.type==AUFTRAG.Type.ALERT5 and currmission.alert5MissionType==MissionType then
|
if currmission.type==AUFTRAG.Type.ALERT5 and currmission.alert5MissionType==MissionType then
|
||||||
-- Prefer assets that are on ALERT5 for this mission type.
|
-- Prefer assets that are on ALERT5 for this mission type.
|
||||||
score=score+25
|
score=score+25
|
||||||
elseif currmission.type==AUFTRAG.Type.GCICAP and MissionType==AUFTRAG.Type.INTERCEPT then
|
elseif (currmission.type==AUFTRAG.Type.GCICAP or currmission.type==AUFTRAG.Type.PATROLRACETRACK) and MissionType==AUFTRAG.Type.INTERCEPT then
|
||||||
-- Prefer assets that are on GCICAP to perform INTERCEPTS. We set this even higher than alert5 because they are already in the air.
|
-- Prefer assets that are on GCICAP to perform INTERCEPTS. We set this even higher than alert5 because they are already in the air.
|
||||||
score=score+35
|
score=score+35
|
||||||
elseif (currmission.type==AUFTRAG.Type.ONGUARD or currmission.type==AUFTRAG.Type.PATROLZONE) and (MissionType==AUFTRAG.Type.ARTY or MissionType==AUFTRAG.Type.GROUNDATTACK) then
|
elseif (currmission.type==AUFTRAG.Type.ONGUARD or currmission.type==AUFTRAG.Type.PATROLZONE) and (MissionType==AUFTRAG.Type.ARTY or MissionType==AUFTRAG.Type.GROUNDATTACK) then
|
||||||
|
|||||||
@ -4463,6 +4463,26 @@ function OPSGROUP:_UpdateTask(Task, Mission)
|
|||||||
if target then
|
if target then
|
||||||
self:EngageTarget(target, speed, Task.dcstask.params.formation)
|
self:EngageTarget(target, speed, Task.dcstask.params.formation)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elseif Task.dcstask.id==AUFTRAG.SpecialTask.PATROLRACETRACK then
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Task "Patrol Race Track" Mission.
|
||||||
|
---
|
||||||
|
|
||||||
|
if self.isFlightgroup then
|
||||||
|
self:T("We are Special Auftrag Patrol Race Track, starting now ...")
|
||||||
|
--self:I({Task.dcstask.params})
|
||||||
|
--[[
|
||||||
|
Task.dcstask.params.TrackAltitude = self.TrackAltitude
|
||||||
|
Task.dcstask.params.TrackSpeed = self.TrackSpeed
|
||||||
|
Task.dcstask.params.TrackPoint1 = self.TrackPoint1
|
||||||
|
Task.dcstask.params.TrackPoint2 = self.TrackPoint2
|
||||||
|
Task.dcstask.params.TrackFormation = self.TrackFormation
|
||||||
|
--]]
|
||||||
|
local aircraft = self:GetGroup()
|
||||||
|
aircraft:PatrolRaceTrack(Task.dcstask.params.TrackPoint1,Task.dcstask.params.TrackPoint2,Task.dcstask.params.TrackAltitude,Task.dcstask.params.TrackSpeed,Task.dcstask.params.TrackFormation,1)
|
||||||
|
end
|
||||||
|
|
||||||
elseif Task.dcstask.id==AUFTRAG.SpecialTask.HOVER then
|
elseif Task.dcstask.id==AUFTRAG.SpecialTask.HOVER then
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user