This commit is contained in:
Applevangelist 2024-01-17 12:13:41 +01:00
parent 48f81d90cc
commit 90d825c809
3 changed files with 70 additions and 100 deletions

View File

@ -36,14 +36,12 @@
-- @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.
@ -58,6 +56,8 @@
-- @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.
-- @field #number capOptionVaryStartTime If set, vary mission start time for CAP missions generated random between capOptionVaryStartTime and capOptionVaryEndTime
-- @field #number capOptionVaryEndTime If set, vary mission start time for CAP missions generated random between capOptionVaryStartTime and capOptionVaryEndTime
--
-- @extends Ops.Legion#LEGION
@ -128,13 +128,14 @@ AIRWING = {
payloads = {},
payloadcounter = 0,
pointsCAP = {},
pointsCAS = {},
pointsTANKER = {},
pointsAWACS = {},
pointsRecon = {},
markpoints = false,
capOptionPatrolRaceTrack = false,
capFormation = nil,
capOptionVaryStartTime = nil,
capOptionVaryEndTime = nil,
}
--- Payload data.
@ -186,7 +187,7 @@ AIRWING = {
--- AIRWING class version.
-- @field #string version
AIRWING.version="0.9.4"
AIRWING.version="0.9.5"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ToDo list
@ -229,7 +230,6 @@ function AIRWING:New(warehousename, airwingname)
-- Defaults:
self.nflightsCAP=0
self.nflightsCAS=0
self.nflightsAWACS=0
self.nflightsRecon=0
self.nflightsTANKERboom=0
@ -707,24 +707,6 @@ 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).
@ -743,6 +725,17 @@ function AIRWING:SetCapCloseRaceTrack(OnOff)
return self
end
--- Set CAP mission start to vary randomly between Start end End seconds.
-- @param #AIRWING self
-- @param #number Start
-- @param #number End
-- @return #AIRWING self
function AIRWING:SetCapStartTimeVariation(Start, End)
self.capOptionVaryStartTime = Start or 5
self.capOptionVaryEndTime = End or 60
return self
end
--- Set number of TANKER flights with Boom constantly in the air.
-- @param #AIRWING self
-- @param #number Nboom Number of flights. Default 1.
@ -877,37 +870,6 @@ 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.
@ -1067,9 +1029,6 @@ function AIRWING:onafterStatus(From, Event, To)
-- Check CAP missions.
self:CheckCAP()
-- Check CAP missions.
self:CheckCAS()
-- Check TANKER missions.
self:CheckTANKER()
@ -1221,6 +1180,14 @@ function AIRWING:CheckCAP()
end
if self.capOptionVaryStartTime then
local ClockStart = math.random(self.capOptionVaryStartTime, self.capOptionVaryEndTime)
missionCAP:SetTime(ClockStart)
end
missionCAP.patroldata=patrol
patrol.noccupied=patrol.noccupied+1
@ -1234,47 +1201,6 @@ 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

View File

@ -458,6 +458,17 @@ function EASYGCICAP:SetDefaultOverhead(Overhead)
return self
end
--- Set CAP mission start to vary randomly between Start end End seconds.
-- @param #EASYGCICAP self
-- @param #number Start
-- @param #number End
-- @return #EASYGCICAP self
function EASYGCICAP:SetCapStartTimeVariation(Start, End)
self.capOptionVaryStartTime = Start or 5
self.capOptionVaryEndTime = End or 60
return self
end
--- Add an AirWing to the manager
-- @param #EASYGCICAP self
-- @param #string Airbasename
@ -511,6 +522,11 @@ function EASYGCICAP:_AddAirwing(Airbasename, Alias)
CAP_Wing:SetRespawnAfterDestroyed()
CAP_Wing:SetNumberCAP(self.capgrouping)
CAP_Wing:SetCapCloseRaceTrack(true)
if self.capOptionVaryStartTime then
CAP_Wing:SetCapStartTimeVariation(self.capOptionVaryStartTime,self.capOptionVaryEndTime)
end
if CapFormation then
CAP_Wing:SetCAPFormation(CapFormation)
end

View File

@ -938,20 +938,22 @@ end
-- @param #CONTROLLABLE self
-- @param #number Frequency Radio frequency in MHz.
-- @param #number Modulation Radio modulation. Default `radio.modulation.AM`.
-- @param #number Power (Optional) Power of the Radio in Watts. Defaults to 10.
-- @param #number Delay (Optional) Delay in seconds before the frequency is set. Default is immediately.
-- @return #CONTROLLABLE self
function CONTROLLABLE:CommandSetFrequency( Frequency, Modulation, Delay )
function CONTROLLABLE:CommandSetFrequency( Frequency, Modulation, Power, Delay )
local CommandSetFrequency = {
id = 'SetFrequency',
params = {
frequency = Frequency * 1000000,
modulation = Modulation or radio.modulation.AM,
power=Power or 10,
},
}
if Delay and Delay > 0 then
SCHEDULER:New( nil, self.CommandSetFrequency, { self, Frequency, Modulation }, Delay )
SCHEDULER:New( nil, self.CommandSetFrequency, { self, Frequency, Modulation, Power } )
else
self:SetCommand( CommandSetFrequency )
end
@ -959,6 +961,32 @@ function CONTROLLABLE:CommandSetFrequency( Frequency, Modulation, Delay )
return self
end
--- [AIR] Set radio frequency. See [DCS command EPLRS](https://wiki.hoggitworld.com/view/DCS_command_setFrequencyForUnit)
-- @param #CONTROLLABLE self
-- @param #number Frequency Radio frequency in MHz.
-- @param #number Modulation Radio modulation. Default `radio.modulation.AM`.
-- @param #number Power (Optional) Power of the Radio in Watts. Defaults to 10.
-- @param #UnitID UnitID (Optional, if your object is a UNIT) The UNIT ID this is for.
-- @param #number Delay (Optional) Delay in seconds before the frequency is set. Default is immediately.
-- @return #CONTROLLABLE self
function CONTROLLABLE:CommandSetFrequencyForUnit(Frequency,Modulation,Power,UnitID,Delay)
local CommandSetFrequencyForUnit={
id='SetFrequencyForUnit',
params={
frequency=Frequency*1000000,
modulation=Modulation or radio.modulation.AM,
unitId=UnitID or self:GetID(),
power=Power or 10,
},
}
if Delay and Delay>0 then
SCHEDULER:New(nil,self.CommandSetFrequencyForUnit,{self,Frequency,Modulation,Power,UnitID})
else
self:SetCommand(CommandSetFrequencyForUnit)
end
return self
end
--- Set EPLRS data link on/off.
-- @param #CONTROLLABLE self
-- @param #boolean SwitchOnOff If true (or nil) switch EPLRS on. If false switch off.