- COMMANDER: Added GCICAP zones
- AIRWING: Improved patrol zone counting, fixed bug in NewPatrolPoint
- OPSGROUP: mission speed acknowledged
This commit is contained in:
Frank 2021-11-17 17:15:44 +01:00
parent a3a7464a29
commit c1c97a86b7
3 changed files with 69 additions and 10 deletions

View File

@ -701,7 +701,7 @@ end
function AIRWING:NewPatrolPoint(Type, Coordinate, Altitude, Speed, Heading, LegLength, RefuelSystem) function AIRWING:NewPatrolPoint(Type, Coordinate, Altitude, Speed, Heading, LegLength, RefuelSystem)
-- Check if a zone was passed instead of a coordinate. -- Check if a zone was passed instead of a coordinate.
if Coordinate:IsInstanceOf("ZONE_BASE") then if Coordinate and Coordinate:IsInstanceOf("ZONE_BASE") then
Coordinate=Coordinate:GetCoordinate() Coordinate=Coordinate:GetCoordinate()
end end
@ -919,7 +919,17 @@ end
-- @return #AIRWING self -- @return #AIRWING self
function AIRWING:CheckCAP() function AIRWING:CheckCAP()
local Ncap=self:CountMissionsInQueue({AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT}) 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.GCICAP and mission.patroldata then
Ncap=Ncap+1
end
end
for i=1,self.nflightsCAP-Ncap do for i=1,self.nflightsCAP-Ncap do
@ -1011,7 +1021,18 @@ end
-- @return #AIRWING self -- @return #AIRWING self
function AIRWING:CheckAWACS() function AIRWING:CheckAWACS()
local N=self:CountMissionsInQueue({AUFTRAG.Type.AWACS}) local N=0 --self:CountMissionsInQueue({AUFTRAG.Type.AWACS})
-- Count AWACS missions.
for _,_mission in pairs(self.missionqueue) do
local mission=_mission --Ops.Auftrag#AUFTRAG
if mission:IsNotOver() and mission.type==AUFTRAG.Type.AWACS and mission.patroldata then
N=N+1
end
end
for i=1,self.nflightsAWACS-N do for i=1,self.nflightsAWACS-N do

View File

@ -25,6 +25,7 @@
-- @field #table rearmingZones Rearming zones. Each element is of type `#BRIGADE.SupplyZone`. -- @field #table rearmingZones Rearming zones. Each element is of type `#BRIGADE.SupplyZone`.
-- @field #table refuellingZones Refuelling zones. Each element is of type `#BRIGADE.SupplyZone`. -- @field #table refuellingZones Refuelling zones. Each element is of type `#BRIGADE.SupplyZone`.
-- @field #table capZones CAP zones. Each element is of type `#AIRWING.PatrolZone`. -- @field #table capZones CAP zones. Each element is of type `#AIRWING.PatrolZone`.
-- @field #table gcicapZones GCICAP zones. Each element is of type `#AIRWING.PatrolZone`.
-- @field #table awacsZones AWACS zones. Each element is of type `#AIRWING.PatrolZone`. -- @field #table awacsZones AWACS zones. Each element is of type `#AIRWING.PatrolZone`.
-- @field #table tankerZones Tanker zones. Each element is of type `#AIRWING.TankerZone`. -- @field #table tankerZones Tanker zones. Each element is of type `#AIRWING.TankerZone`.
-- @field Ops.Chief#CHIEF chief Chief of staff. -- @field Ops.Chief#CHIEF chief Chief of staff.
@ -124,6 +125,7 @@ COMMANDER = {
rearmingZones = {}, rearmingZones = {},
refuellingZones = {}, refuellingZones = {},
capZones = {}, capZones = {},
gcicapZones = {},
awacsZones = {}, awacsZones = {},
tankerZones = {}, tankerZones = {},
} }
@ -489,7 +491,7 @@ function COMMANDER:AddRearmingZone(RearmingZone)
rearmingzone.zone=RearmingZone rearmingzone.zone=RearmingZone
rearmingzone.mission=nil rearmingzone.mission=nil
rearmingzone.marker=MARKER:New(rearmingzone.zone:GetCoordinate(), "Rearming Zone"):ToCoalition(self:GetCoalition()) --rearmingzone.marker=MARKER:New(rearmingzone.zone:GetCoordinate(), "Rearming Zone"):ToCoalition(self:GetCoalition())
table.insert(self.rearmingZones, rearmingzone) table.insert(self.rearmingZones, rearmingzone)
@ -506,7 +508,7 @@ function COMMANDER:AddRefuellingZone(RefuellingZone)
rearmingzone.zone=RefuellingZone rearmingzone.zone=RefuellingZone
rearmingzone.mission=nil rearmingzone.mission=nil
rearmingzone.marker=MARKER:New(rearmingzone.zone:GetCoordinate(), "Refuelling Zone"):ToCoalition(self:GetCoalition()) --rearmingzone.marker=MARKER:New(rearmingzone.zone:GetCoordinate(), "Refuelling Zone"):ToCoalition(self:GetCoalition())
table.insert(self.refuellingZones, rearmingzone) table.insert(self.refuellingZones, rearmingzone)
@ -531,13 +533,38 @@ function COMMANDER:AddCapZone(Zone, Altitude, Speed, Heading, Leg)
patrolzone.speed=UTILS.KnotsToAltKIAS(Speed or 350, patrolzone.altitude) patrolzone.speed=UTILS.KnotsToAltKIAS(Speed or 350, patrolzone.altitude)
patrolzone.leg=Leg or 30 patrolzone.leg=Leg or 30
patrolzone.mission=nil patrolzone.mission=nil
patrolzone.marker=MARKER:New(patrolzone.zone:GetCoordinate(), "AWACS Zone"):ToCoalition(self:GetCoalition()) --patrolzone.marker=MARKER:New(patrolzone.zone:GetCoordinate(), "CAP Zone"):ToCoalition(self:GetCoalition())
table.insert(self.capZones, patrolzone) table.insert(self.capZones, patrolzone)
return patrolzone return patrolzone
end end
--- Add a GCICAP zone.
-- @param #COMMANDER self
-- @param Core.Zone#ZONE CapZone Zone.
-- @param #number Altitude Orbit altitude in feet. Default is 12,0000 feet.
-- @param #number Speed Orbit speed in KIAS. Default 350 kts.
-- @param #number Heading Heading of race-track pattern in degrees. Default 270 (East to West).
-- @param #number Leg Length of race-track in NM. Default 30 NM.
-- @return Ops.AirWing#AIRWING.PatrolZone The CAP zone data.
function COMMANDER:AddGciCapZone(Zone, Altitude, Speed, Heading, Leg)
local patrolzone={} --Ops.AirWing#AIRWING.PatrolZone
patrolzone.zone=Zone
patrolzone.altitude=Altitude or 12000
patrolzone.heading=Heading or 270
patrolzone.speed=UTILS.KnotsToAltKIAS(Speed or 350, patrolzone.altitude)
patrolzone.leg=Leg or 30
patrolzone.mission=nil
--patrolzone.marker=MARKER:New(patrolzone.zone:GetCoordinate(), "GCICAP Zone"):ToCoalition(self:GetCoalition())
table.insert(self.gcicapZones, patrolzone)
return patrolzone
end
--- Add an AWACS zone. --- Add an AWACS zone.
-- @param #COMMANDER self -- @param #COMMANDER self
-- @param Core.Zone#ZONE Zone Zone. -- @param Core.Zone#ZONE Zone Zone.
@ -556,7 +583,7 @@ function COMMANDER:AddAwacsZone(Zone, Altitude, Speed, Heading, Leg)
awacszone.speed=UTILS.KnotsToAltKIAS(Speed or 350, awacszone.altitude) awacszone.speed=UTILS.KnotsToAltKIAS(Speed or 350, awacszone.altitude)
awacszone.leg=Leg or 30 awacszone.leg=Leg or 30
awacszone.mission=nil awacszone.mission=nil
awacszone.marker=MARKER:New(awacszone.zone:GetCoordinate(), "AWACS Zone"):ToCoalition(self:GetCoalition()) --awacszone.marker=MARKER:New(awacszone.zone:GetCoordinate(), "AWACS Zone"):ToCoalition(self:GetCoalition())
table.insert(self.awacsZones, awacszone) table.insert(self.awacsZones, awacszone)
@ -687,6 +714,17 @@ function COMMANDER:onafterStatus(From, Event, To)
self:AddMission(patrolzone.mission) self:AddMission(patrolzone.mission)
end end
end end
-- Check GCICAP zones.
for _,_patrolzone in pairs(self.gcicapZones) do
local patrolzone=_patrolzone --Ops.AirWing#AIRWING.PatrolZone
-- Check if mission is nil or over.
if (not patrolzone.mission) or patrolzone.mission:IsOver() then
local Coordinate=patrolzone.zone:GetCoordinate()
patrolzone.mission=AUFTRAG:NewGCICAP(Coordinate, patrolzone.altitude, patrolzone.speed, patrolzone.heading, patrolzone.leg)
self:AddMission(patrolzone.mission)
end
end
-- Check AWACS zones. -- Check AWACS zones.
for _,_awacszone in pairs(self.awacsZones) do for _,_awacszone in pairs(self.awacsZones) do

View File

@ -4551,7 +4551,7 @@ function OPSGROUP:RouteToMission(mission, delay)
end end
-- Speed to mission waypoint. -- Speed to mission waypoint.
local SpeedToMission=UTILS.KmphToKnots(self.speedCruise) local SpeedToMission=mission.missionSpeed and UTILS.KmphToKnots(mission.missionSpeed) or self:GetSpeedCruise() --UTILS.KmphToKnots(self.speedCruise)
-- Special for Troop transport. -- Special for Troop transport.
if mission.type==AUFTRAG.Type.TROOPTRANSPORT then if mission.type==AUFTRAG.Type.TROOPTRANSPORT then
@ -4667,9 +4667,9 @@ function OPSGROUP:RouteToMission(mission, delay)
self:_SetMissionOptions(mission) self:_SetMissionOptions(mission)
if self:IsArmygroup() then if self:IsArmygroup() then
self:Cruise(mission.missionSpeed and UTILS.KmphToKnots(mission.missionSpeed) or self:GetSpeedCruise()) self:Cruise(SpeedToMission)
elseif self:IsNavygroup() then elseif self:IsNavygroup() then
self:Cruise(mission.missionSpeed and UTILS.KmphToKnots(mission.missionSpeed) or self:GetSpeedCruise()) self:Cruise(SpeedToMission)
elseif self:IsFlightgroup() then elseif self:IsFlightgroup() then
self:UpdateRoute() self:UpdateRoute()
end end