diff --git a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua index acc6de4e6..fecf0765e 100644 --- a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua +++ b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua @@ -566,6 +566,9 @@ do -- AI_A2A_DISPATCHER self.Detection:FilterCategories( Unit.Category.AIRPLANE, Unit.Category.HELICOPTER ) --self.Detection:InitDetectRadar( true ) self.Detection:SetDetectionInterval( 30 ) + + self:SetEngageRadius() + self:SetGciRadius() self:AddTransition( "Started", "Assign", "Started" ) @@ -736,20 +739,52 @@ do -- AI_A2A_DISPATCHER -- If too small, more intercept missions may be triggered upon detected target areas. -- If too large, any airborne cap may not be able to reach the detected target area in time, because it is too far. -- @param #AI_A2A_DISPATCHER self - -- @param #number FriendliesRadius The radius to report friendlies near the target. + -- @param #number EngageRadius (Optional, Default = 100000) The radius to report friendlies near the target. -- @return #AI_A2A_DISPATCHER -- @usage -- - -- -- Set 100km as the radius to engage any target by airborne friendlies. - -- Dispatcher:InitDetectionFriendiesRadius( 100000 ) + -- -- Set 50km as the radius to engage any target by airborne friendlies. + -- Dispatcher:SetEngageRadius( 50000 ) -- - function AI_A2A_DISPATCHER:SetEngageRadius( FriendliesRadius ) + -- -- Set 100km as the radius to engage any target by airborne friendlies. + -- Dispatcher:SetEngageRadius() -- 100000 is the default value. + -- + function AI_A2A_DISPATCHER:SetEngageRadius( EngageRadius ) - self.Detection:SetFriendliesRange( FriendliesRadius ) + self.Detection:SetFriendliesRange( EngageRadius ) return self end + --- Define the radius to check if a target can be engaged by an ground controlled intercept. + -- So, if there is a target area detected and reported, + -- and a GCI is to be executed, + -- then it will be check if the target is within the GCI from the nearest airbase. + -- For example, if 150000 is given as a value, then any airbase within 150km from the detected target, + -- will be considered to receive the command to GCI. + -- You need to evaluate the value of this parameter carefully. + -- If too small, intercept missions may be triggered too late. + -- If too large, intercept missions may be triggered when the detected target is too far. + -- @param #AI_A2A_DISPATCHER self + -- @param #number GciRadius (Optional, Default = 200000) The radius to ground control intercept detected targets from the nearest airbase. + -- @return #AI_A2A_DISPATCHER + -- @usage + -- + -- -- Set 100km as the radius to ground control intercept detected targets from the nearest airbase. + -- Dispatcher:SetGciRadius( 100000 ) + -- + -- -- Set 200km as the radius to ground control intercept. + -- Dispatcher:SetGciRadius() -- 200000 is the default value. + -- + function AI_A2A_DISPATCHER:SetGciRadius( GciRadius ) + + self.GciRadius = GciRadius or 200000 + + return self + end + + + --- Define a border area to simulate a **cold war** scenario. -- A **cold war** is one where CAP aircraft patrol their territory but will not attack enemy aircraft or launch GCI aircraft unless enemy aircraft enter their territory. In other words the EWR may detect an enemy aircraft but will only send aircraft to attack it if it crosses the border. -- A **hot war** is one where CAP aircraft will intercept any detected enemy aircraft and GCI aircraft will launch against detected enemy aircraft without regard for territory. In other words if the ground radar can detect the enemy aircraft then it will send CAP and GCI aircraft to attack it. @@ -927,7 +962,8 @@ do -- AI_A2A_DISPATCHER DefenderSquadron.Resources = Resources self:SetSquadronOverhead( SquadronName, 1 ) - self:SetSquadronTakeoffFromParkingHot( SquadronName ) + self:SetSquadronTakeoffInAir( SquadronName ) + self:SetSquadronLandingNearAirbase(SquadronName) return self end @@ -1652,9 +1688,6 @@ do -- AI_A2A_DISPATCHER -- @param #AI_A2A_DISPATCHER self function AI_A2A_DISPATCHER:onafterGCI( From, Event, To, Target, DefendersMissing, AIGroups ) - local ClosestDistance = 0 - local ClosestDefenderSquadronName = nil - local AttackerCount = Target.Set:Count() local DefendersCount = 0 @@ -1669,6 +1702,10 @@ do -- AI_A2A_DISPATCHER end DefendersCount = DefendersMissing + + local ClosestDistance = 0 + local ClosestDefenderSquadronName = nil + while( DefendersCount > 0 ) do for SquadronName, DefenderSquadron in pairs( self.DefenderSquadrons or {} ) do @@ -1677,10 +1714,14 @@ do -- AI_A2A_DISPATCHER local SpawnCoord = DefenderSquadron.Airbase:GetCoordinate() -- Core.Point#COORDINATE local TargetCoord = Target.Set:GetFirst():GetCoordinate() local Distance = SpawnCoord:Get2DDistance( TargetCoord ) - + if ClosestDistance == 0 or Distance < ClosestDistance then - ClosestDistance = Distance - ClosestDefenderSquadronName = SquadronName + + -- Only intercept if the distance to target is smaller or equal to the GciRadius limit. + if Distance <= self.GciRadius then + ClosestDistance = Distance + ClosestDefenderSquadronName = SquadronName + end end end end @@ -1752,6 +1793,9 @@ do -- AI_A2A_DISPATCHER end end end + else + -- There isn't any closest airbase anymore, break the loop. + break end end end diff --git a/docs/Documentation/AI_A2A.html b/docs/Documentation/AI_A2A.html index 2a24504d1..ee2dc9007 100644 --- a/docs/Documentation/AI_A2A.html +++ b/docs/Documentation/AI_A2A.html @@ -575,7 +575,6 @@
- #number AI_A2A.IdleCount diff --git a/docs/Documentation/AI_A2A_Dispatcher.html b/docs/Documentation/AI_A2A_Dispatcher.html index 636c554ab..e9641232d 100644 --- a/docs/Documentation/AI_A2A_Dispatcher.html +++ b/docs/Documentation/AI_A2A_Dispatcher.html @@ -258,6 +258,12 @@ AI_A2A_DISPATCHER:GCI()

GCI Trigger for AIA2ADISPATCHER

+ + + + AI_A2A_DISPATCHER.GciRadius + + @@ -441,9 +447,15 @@ - AI_A2A_DISPATCHER:SetEngageRadius(FriendliesRadius) + AI_A2A_DISPATCHER:SetEngageRadius(EngageRadius)

Define the radius to engage any target by airborne friendlies, which are executing cap or returning from an intercept mission.

+ + + + AI_A2A_DISPATCHER:SetGciRadius(GciRadius) + +

Define the radius to check if a target can be engaged by an ground controlled intercept.

@@ -1640,6 +1652,19 @@ If there are no targets to be set.

GCI Trigger for AIA2ADISPATCHER

+ +
+
+
+ + +AI_A2A_DISPATCHER.GciRadius + +
+
+ + +
@@ -2516,7 +2541,7 @@ An object derived from ZONE_BASE, that defines a zone between

-AI_A2A_DISPATCHER:SetEngageRadius(FriendliesRadius) +AI_A2A_DISPATCHER:SetEngageRadius(EngageRadius)
@@ -2537,8 +2562,8 @@ If too large, any airborne cap may not be able to reach the detected target area @@ -2549,8 +2574,57 @@ The radius to report friendlies near the target.

Usage:


+  -- Set 50km as the radius to engage any target by airborne friendlies.
+  Dispatcher:SetEngageRadius( 50000 )
+  
   -- Set 100km as the radius to engage any target by airborne friendlies.
-  Dispatcher:InitDetectionFriendiesRadius( 100000 )
+  Dispatcher:SetEngageRadius() -- 100000 is the default value.
+  
+ +
+
+
+
+ + +AI_A2A_DISPATCHER:SetGciRadius(GciRadius) + +
+
+ +

Define the radius to check if a target can be engaged by an ground controlled intercept.

+ + +

So, if there is a target area detected and reported, +and a GCI is to be executed, +then it will be check if the target is within the GCI from the nearest airbase. +For example, if 150000 is given as a value, then any airbase within 150km from the detected target, +will be considered to receive the command to GCI. +You need to evaluate the value of this parameter carefully. +If too small, intercept missions may be triggered too late. +If too large, intercept missions may be triggered when the detected target is too far.

+ +

Parameter

+ +

Return value

+ +

#AIA2ADISPATCHER:

+ + +

Usage:

+

+  -- Set 100km as the radius to ground control intercept detected targets from the nearest airbase.
+  Dispatcher:SetGciRadius( 100000 )
+  
+  -- Set 200km as the radius to ground control intercept.
+  Dispatcher:SetGciRadius() -- 200000 is the default value.
   
diff --git a/docs/Documentation/AI_Patrol.html b/docs/Documentation/AI_Patrol.html index 43392b308..93a9f8ce6 100644 --- a/docs/Documentation/AI_Patrol.html +++ b/docs/Documentation/AI_Patrol.html @@ -926,9 +926,6 @@ Use the method AIPATROLZONE.M - -

This table contains the targets detected during patrol.

-
diff --git a/docs/Documentation/Designate.html b/docs/Documentation/Designate.html index 70e3562df..c0c7ee573 100644 --- a/docs/Documentation/Designate.html +++ b/docs/Documentation/Designate.html @@ -900,7 +900,6 @@ function below will use the range 1-7 just in case

- DESIGNATE.LaserCodes diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html index 49f3c5879..141b7d951 100644 --- a/docs/Documentation/Detection.html +++ b/docs/Documentation/Detection.html @@ -607,6 +607,12 @@ The different values of Unit.Category can be:

DETECTION_BASE:GetDetectionSetGroup()

Get the detection Groups.

+ + + + DETECTION_BASE:GetFriendliesDistance(DetectedItem) + +

Returns friendly units nearby the FAC units sorted per distance ...

@@ -2971,6 +2977,32 @@ DetectedSet

Core.Set#SET_GROUP:

+ +
+
+
+ + +DETECTION_BASE:GetFriendliesDistance(DetectedItem) + +
+
+ +

Returns friendly units nearby the FAC units sorted per distance ...

+ +

Parameter

+
    +
  • + +

    DetectedItem :

    + +
  • +
+

Return value

+ +

#map:

+

number,Wrapper.Unit#UNIT> The map of Friendly UNITs.

+
diff --git a/docs/Documentation/Fsm.html b/docs/Documentation/Fsm.html index 401b60084..5267af595 100644 --- a/docs/Documentation/Fsm.html +++ b/docs/Documentation/Fsm.html @@ -1604,7 +1604,7 @@ A string defining the start state.

- + #string FSM._StartState @@ -1903,7 +1903,6 @@ A string defining the start state.

- FSM.current diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html index d5beebc4e..1183a03bf 100644 --- a/docs/Documentation/Spawn.html +++ b/docs/Documentation/Spawn.html @@ -822,12 +822,6 @@ and any spaces before and after the resulting name are removed.

SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle) - - - - SPAWN.uncontrolled - - @@ -2200,9 +2194,6 @@ The group that was spawned. You can use this group for further actions.

- -

Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.

-
@@ -2735,9 +2726,6 @@ when nothing was spawned.

- -

Overwrite unit names by default with group name.

-
@@ -3736,20 +3724,6 @@ True = Continue Scheduler

- -
-
-
- - - -SPAWN.uncontrolled - -
-
- - -
diff --git a/docs/Documentation/SpawnStatic.html b/docs/Documentation/SpawnStatic.html index d8aa5e633..bc91b9624 100644 --- a/docs/Documentation/SpawnStatic.html +++ b/docs/Documentation/SpawnStatic.html @@ -436,7 +436,6 @@ ptional) The name of the new static.

- #number SPAWNSTATIC.SpawnIndex diff --git a/docs/Documentation/Task_Cargo.html b/docs/Documentation/Task_Cargo.html index 463fdae49..686daa411 100644 --- a/docs/Documentation/Task_Cargo.html +++ b/docs/Documentation/Task_Cargo.html @@ -510,7 +510,7 @@ based on the tasking capabilities defined in Task#TA
- Core.Cargo#CARGO + Core.Cargo#CARGO_GROUP FSM_PROCESS.Cargo @@ -524,6 +524,7 @@ based on the tasking capabilities defined in Task#TA
+ FSM_PROCESS.DeployZone