This commit is contained in:
Applevangelist 2023-12-06 08:43:43 +01:00
parent 1f5f08a9ea
commit 58fa533f79
6 changed files with 1617 additions and 6 deletions

View File

@ -3377,11 +3377,11 @@ function SPAWN:_Prepare( SpawnTemplatePrefix, SpawnIndex ) -- R2.2
end
end
-- VoiceCallsignNumber
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber then
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber and type( Callsign ) ~= "number" then
SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignNumber = SpawnTemplate.units[UnitID].callsign[2] .. SpawnTemplate.units[UnitID].callsign[3]
end
-- VoiceCallsignLabel
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignLabel then
if SpawnTemplate.units[UnitID].AddPropAircraft.VoiceCallsignLabel and type( Callsign ) ~= "number" then
local CallsignName = SpawnTemplate.units[UnitID].callsign["name"] -- #string
CallsignName = string.match(CallsignName,"^(%a+)") -- 2.8 - only the part w/o numbers
local label = "NY" -- Navy One exception

View File

@ -111,6 +111,7 @@ __Moose.Include( 'Ops\\Operation.lua' )
__Moose.Include( 'Ops\\FlightControl.lua' )
__Moose.Include( 'Ops\\PlayerRecce.lua' )
__Moose.Include( 'Ops\\EasyGCICAP.lua' )
__Moose.Include( 'Ops\\EasyA2G.lua' )
__Moose.Include( 'AI\\AI_Balancer.lua' )
__Moose.Include( 'AI\\AI_Air.lua' )

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -1080,7 +1080,7 @@ function INTEL:CreateDetectedItems(DetectedGroups, DetectedStatics, RecceDetecti
end
--- (Internal) Return the detected target groups of the controllable as a @{SET_GROUP}.
-- The optional parametes specify the detection methods that can be applied.
-- The optional parameters specify the detection methods that can be applied.
-- If no detection method is given, the detection will use all the available methods by default.
-- @param #INTEL self
-- @param Wrapper.Unit#UNIT Unit The unit detecting.
@ -1093,11 +1093,14 @@ end
-- @param #boolean DetectRWR (Optional) If *false*, do not include targets detected by RWR.
-- @param #boolean DetectDLINK (Optional) If *false*, do not include targets detected by data link.
function INTEL:GetDetectedUnits(Unit, DetectedUnits, RecceDetecting, DetectVisual, DetectOptical, DetectRadar, DetectIRST, DetectRWR, DetectDLINK)
--self:T(self.lid.."GetDetectedUnits "..Unit:GetName())
-- Get detected DCS units.
local reccename = Unit:GetName()
local detectedtargets=Unit:GetDetectedTargets(DetectVisual, DetectOptical, DetectRadar, DetectIRST, DetectRWR, DetectDLINK)
--UTILS.PrintTableToLog(detectedtargets,1)
for DetectionObjectID, Detection in pairs(detectedtargets or {}) do
local DetectedObject=Detection.object -- DCS#Object

View File

@ -2937,7 +2937,7 @@ function CONTROLLABLE:CopyRoute( Begin, End, Randomize, Radius )
end
--- Return the detected targets of the controllable.
-- The optional parametes specify the detection methods that can be applied.
-- The optional parameters specify the detection methods that can be applied.
-- If no detection method is given, the detection will use all the available methods by default.
-- @param #CONTROLLABLE self
-- @param #boolean DetectVisual (optional)