Added infinite resources implementation.

This commit is contained in:
FlightControl_Master 2017-08-05 16:26:32 +02:00
parent 2ccfe27401
commit cc1b34937c
9 changed files with 376 additions and 70 deletions

View File

@ -354,7 +354,7 @@ do -- AI_A2A_DISPATCHER
-- * Have name (string) that is the identifier or key of the squadron.
-- * Have specific plane types.
-- * Are located at one airbase.
-- * Have a limited set of resources.
-- * Optionally have a limited set of resources. The default is that squadrons have **unlimited resources**.
--
-- The name of the squadron given acts as the **squadron key** in the AI\_A2A\_DISPATCHER:Squadron...() methods.
--
@ -1348,7 +1348,7 @@ do -- AI_A2A_DISPATCHER
-- * Have a **name or key** that is the identifier or key of the squadron.
-- * Have **specific plane types** defined by **templates**.
-- * Are **located at one specific airbase**. Multiple squadrons can be located at one airbase through.
-- * Have a limited set of **resources**.
-- * Optionally have a limited set of **resources**. The default is that squadrons have unlimited resources.
--
-- The name of the squadron given acts as the **squadron key** in the AI\_A2A\_DISPATCHER:Squadron...() methods.
--
@ -1383,24 +1383,34 @@ do -- AI_A2A_DISPATCHER
-- Just remember that your template (groups late activated) need to start with the prefix you have specified in your code.
-- If you have only one prefix name for a squadron, you don't need to use the `{ }`, otherwise you need to use the brackets.
--
-- @param #number Resources A number that specifies how many resources are in stock of the squadron. It is still a bit buggy, this part. Just make this a large number for the moment. This will be fine tuned later.
-- @param #number Resources (optional) A number that specifies how many resources are in stock of the squadron. If not specified, the squadron will have infinite resources available.
--
-- @usage
-- -- Now Setup the A2A dispatcher, and initialize it using the Detection object.
-- A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )
--
-- @usage
-- -- This will create squadron "Squadron1" at "Batumi" airbase, and will use plane types "SQ1" and has 40 planes in stock...
-- A2ADispatcher:SetSquadron( "Squadron1", "Batumi", "SQ1", 40 )
--
-- @usage
-- -- This will create squadron "Sq 1" at "Batumi" airbase, and will use plane types "Mig-29" and "Su-27" and has 20 planes in stock...
-- -- Note that in this implementation, the A2A dispatcher will select a random plane when a new plane (group) needs to be spawned for defenses.
-- -- Note that in this implementation, the A2A dispatcher will select a random plane type when a new plane (group) needs to be spawned for defenses.
-- -- Note the usage of the {} for the airplane templates list.
-- A2ADispatcher:SetSquadron( "Sq 1", "Batumi", { "Mig-29", "Su-27" }, 40 )
--
-- @usage
-- -- This will create 2 squadrons "104th" and "23th" at "Batumi" airbase, and will use plane types "Mig-29" and "Su-27" respectively and each squadron has 10 planes in stock...
-- -- Note that in this implementation, the A2A dispatcher will select a random plane when a new plane (group) needs to be spawned for defenses.
-- A2ADispatcher:SetSquadron( "104th", "Batumi", "Mig-29", 10 )
-- A2ADispatcher:SetSquadron( "23th", "Batumi", "Su-27", 10 )
--
-- @usage
-- -- This is an example like the previous, but now with infinite resources.
-- -- The Resources parameter is not given in the SetSquadron method.
-- A2ADispatcher:SetSquadron( "104th", "Batumi", "Mig-29" )
-- A2ADispatcher:SetSquadron( "23th", "Batumi", "Su-27" )
--
--
-- @return #AI_A2A_DISPATCHER
function AI_A2A_DISPATCHER:SetSquadron( SquadronName, AirbaseName, SpawnTemplates, Resources )
@ -1577,7 +1587,7 @@ do -- AI_A2A_DISPATCHER
local DefenderSquadron = self:GetSquadron( SquadronName )
if DefenderSquadron.Resources > 0 then
if ( not DefenderSquadron.Resources ) or ( DefenderSquadron.Resources and DefenderSquadron.Resources > 0 ) then
local Cap = DefenderSquadron.Cap
if Cap then
@ -1606,7 +1616,7 @@ do -- AI_A2A_DISPATCHER
local DefenderSquadron = self:GetSquadron( SquadronName )
if DefenderSquadron.Resources > 0 then
if ( not DefenderSquadron.Resources ) or ( DefenderSquadron.Resources and DefenderSquadron.Resources > 0 ) then
local Gci = DefenderSquadron.Gci
if Gci then
return DefenderSquadron
@ -2358,20 +2368,24 @@ do -- AI_A2A_DISPATCHER
--- @param #AI_A2A_DISPATCHER self
function AI_A2A_DISPATCHER:AddDefenderToSquadron( Squadron, Defender, Size )
self.Defenders = self.Defenders or {}
local DefenderName = Defender:GetName()
self.Defenders[ DefenderName ] = Squadron
Squadron.Resources = Squadron.Resources - Size
self:F( { DefenderName = DefenderName, SquadronResources = Squadron.Resources } )
if Squadron.Resources then
self.Defenders = self.Defenders or {}
local DefenderName = Defender:GetName()
self.Defenders[ DefenderName ] = Squadron
Squadron.Resources = Squadron.Resources - Size
self:F( { DefenderName = DefenderName, SquadronResources = Squadron.Resources } )
end
end
--- @param #AI_A2A_DISPATCHER self
function AI_A2A_DISPATCHER:RemoveDefenderFromSquadron( Squadron, Defender )
self.Defenders = self.Defenders or {}
local DefenderName = Defender:GetName()
Squadron.Resources = Squadron.Resources + Defender:GetSize()
self.Defenders[ DefenderName ] = nil
self:F( { DefenderName = DefenderName, SquadronResources = Squadron.Resources } )
if Squadron.Resources then
self.Defenders = self.Defenders or {}
local DefenderName = Defender:GetName()
Squadron.Resources = Squadron.Resources + Defender:GetSize()
self.Defenders[ DefenderName ] = nil
self:F( { DefenderName = DefenderName, SquadronResources = Squadron.Resources } )
end
end
function AI_A2A_DISPATCHER:GetSquadronFromDefender( Defender )
@ -3300,15 +3314,82 @@ do
-- For airplanes, 6000 (6km) is recommended, and is also the default value of this parameter.
-- @param #number EngageRadius The radius in meters wherein detected airplanes will be engaged by airborne defenders without a task.
-- @param #number GciRadius The radius in meters wherein detected airplanes will GCI.
-- @param #number Resources The amount of resources that will be allocated to each squadron.
-- @return #AI_A2A_GCICAP
-- @usage
--
-- -- Set a new AI A2A GCICAP object, based on an EWR network with a 30 km grouping radius
-- -- This for ground and awacs installations.
-- -- Setup a new GCICAP dispatcher object. Each squadron has unlimited resources.
-- -- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The CAP Zone prefix is "CAP Zone".
-- -- The CAP Limit is 2.
-- A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2 )
--
-- A2ADispatcher = AI_A2A_GCICAP:New( { "BlueEWRGroundRadars", "BlueEWRAwacs" }, 30000 )
-- @usage
--
function AI_A2A_GCICAP:New( EWRPrefixes, TemplatePrefixes, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius )
-- -- Setup a new GCICAP dispatcher object. Each squadron has unlimited resources.
-- -- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The CAP Zone prefix is "CAP Zone".
-- -- The CAP Limit is 2.
-- -- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2, 20000 )
--
-- @usage
--
-- -- Setup a new GCICAP dispatcher object. Each squadron has unlimited resources.
-- -- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The CAP Zone prefix is "CAP Zone".
-- -- The CAP Limit is 2.
-- -- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- -- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- -- will be considered a defense task if the target is within 60km from the defender.
-- A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2, 20000, 60000 )
--
-- @usage
--
-- -- Setup a new GCICAP dispatcher object. Each squadron has unlimited resources.
-- -- The EWR network group prefix is DF CCCP. All groups starting with DF CCCP will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The CAP Zone prefix is "CAP Zone".
-- -- The CAP Limit is 2.
-- -- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- -- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- -- will be considered a defense task if the target is within 60km from the defender.
-- -- The GCI Radius is set to 150000. Any target detected within 150km will be considered for GCI engagement.
-- A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2, 20000, 60000, 150000 )
--
-- @usage
--
-- -- Setup a new GCICAP dispatcher object. Each squadron has 30 resources.
-- -- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The CAP Zone prefix is "CAP Zone".
-- -- The CAP Limit is 2.
-- -- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- -- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- -- will be considered a defense task if the target is within 60km from the defender.
-- -- The GCI Radius is set to 150000. Any target detected within 150km will be considered for GCI engagement.
-- -- The amount of resources for each squadron is set to 30. Thus about 30 resources are allocated to each squadron created.
--
-- A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2, 20000, 60000, 150000, 30 )
--
-- @usage
--
-- -- Setup a new GCICAP dispatcher object. Each squadron has 30 resources.
-- -- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The CAP Zone prefix is nil. No CAP is created.
-- -- The CAP Limit is nil.
-- -- The Grouping Radius is nil. The default range of 6km radius will be grouped as a group of targets.
-- -- The Engage Radius is set nil. The default Engage Radius will be used to consider a defenser being assigned to a task.
-- -- The GCI Radius is nil. Any target detected within the default GCI Radius will be considered for GCI engagement.
-- -- The amount of resources for each squadron is set to 30. Thus about 30 resources are allocated to each squadron created.
--
-- A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, nil, nil, nil, nil, nil, 30 )
--
function AI_A2A_GCICAP:New( EWRPrefixes, TemplatePrefixes, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius, Resources )
GroupingRadius = GroupingRadius or 30000
EngageRadius = EngageRadius or 100000
@ -3364,7 +3445,7 @@ do
end
end
if Templates then
self:SetSquadron( AirbaseName, AirbaseName, Templates, 30 )
self:SetSquadron( AirbaseName, AirbaseName, Templates, Resources )
end
end
@ -3433,17 +3514,93 @@ do
-- For airplanes, 6000 (6km) is recommended, and is also the default value of this parameter.
-- @param #number EngageRadius The radius in meters wherein detected airplanes will be engaged by airborne defenders without a task.
-- @param #number GciRadius The radius in meters wherein detected airplanes will GCI.
-- @param #number Resources The amount of resources that will be allocated to each squadron.
-- @return #AI_A2A_GCICAP
-- @usage
--
-- -- Set a new AI A2A GCICAP object, based on an EWR network with a 30 km grouping radius
-- -- This for ground and awacs installations.
-- -- Setup a new GCICAP dispatcher object with a border. Each squadron has unlimited resources.
-- -- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The CAP Zone prefix is "CAP Zone".
-- -- The CAP Limit is 2.
--
-- A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", { "CAP Zone" }, 2 )
--
-- A2ADispatcher = AI_A2A_GCICAP:New( { "BlueEWRGroundRadars", "BlueEWRAwacs" }, 30000 )
-- @usage
--
function AI_A2A_GCICAP:NewWithBorder( EWRPrefixes, TemplatePrefixes, BorderPrefix, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius )
-- -- Setup a new GCICAP dispatcher object with a border. Each squadron has unlimited resources.
-- -- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The Border prefix is "Border". This will setup a border using the group defined within the mission editor with the name Border.
-- -- The CAP Zone prefix is "CAP Zone".
-- -- The CAP Limit is 2.
-- -- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
--
-- A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", { "CAP Zone" }, 2, 20000 )
--
-- @usage
--
-- -- Setup a new GCICAP dispatcher object with a border. Each squadron has unlimited resources.
-- -- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The Border prefix is "Border". This will setup a border using the group defined within the mission editor with the name Border.
-- -- The CAP Zone prefix is "CAP Zone".
-- -- The CAP Limit is 2.
-- -- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- -- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- -- will be considered a defense task if the target is within 60km from the defender.
--
-- A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", { "CAP Zone" }, 2, 20000, 60000 )
--
-- @usage
--
-- -- Setup a new GCICAP dispatcher object with a border. Each squadron has unlimited resources.
-- -- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The Border prefix is "Border". This will setup a border using the group defined within the mission editor with the name Border.
-- -- The CAP Zone prefix is "CAP Zone".
-- -- The CAP Limit is 2.
-- -- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- -- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- -- will be considered a defense task if the target is within 60km from the defender.
-- -- The GCI Radius is set to 150000. Any target detected within 150km will be considered for GCI engagement.
--
-- A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", { "CAP Zone" }, 2, 20000, 60000, 150000 )
--
-- @usage
--
-- -- Setup a new GCICAP dispatcher object with a border. Each squadron has 30 resources.
-- -- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The Border prefix is "Border". This will setup a border using the group defined within the mission editor with the name Border.
-- -- The CAP Zone prefix is "CAP Zone".
-- -- The CAP Limit is 2.
-- -- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- -- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- -- will be considered a defense task if the target is within 60km from the defender.
-- -- The GCI Radius is set to 150000. Any target detected within 150km will be considered for GCI engagement.
-- -- The amount of resources for each squadron is set to 30. Thus about 30 resources are allocated to each squadron created.
--
-- A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", { "CAP Zone" }, 2, 20000, 60000, 150000, 30 )
--
-- @usage
--
-- -- Setup a new GCICAP dispatcher object with a border. Each squadron has 30 resources.
-- -- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- -- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- -- The Border prefix is "Border". This will setup a border using the group defined within the mission editor with the name Border.
-- -- The CAP Zone prefix is nil. No CAP is created.
-- -- The CAP Limit is nil.
-- -- The Grouping Radius is nil. The default range of 6km radius will be grouped as a group of targets.
-- -- The Engage Radius is set nil. The default Engage Radius will be used to consider a defenser being assigned to a task.
-- -- The GCI Radius is nil. Any target detected within the default GCI Radius will be considered for GCI engagement.
-- -- The amount of resources for each squadron is set to 30. Thus about 30 resources are allocated to each squadron created.
--
-- A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", nil, nil, nil, nil, nil, 30 )
--
function AI_A2A_GCICAP:NewWithBorder( EWRPrefixes, TemplatePrefixes, BorderPrefix, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius, Resources )
local self = AI_A2A_GCICAP:New( EWRPrefixes, TemplatePrefixes, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius )
local self = AI_A2A_GCICAP:New( EWRPrefixes, TemplatePrefixes, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius, Resources )
if BorderPrefix then
self:SetBorderZone( ZONE_POLYGON:New( BorderPrefix, GROUP:FindByName( BorderPrefix ) ) )

View File

@ -927,13 +927,13 @@ Per one, two, three, four?</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A_GCICAP).New">AI_A2A_GCICAP:New(EWRPrefixes, TemplatePrefixes, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius)</a></td>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A_GCICAP).New">AI_A2A_GCICAP:New(EWRPrefixes, TemplatePrefixes, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius, Resources)</a></td>
<td class="summary">
<p>AI<em>A2A</em>GCICAP constructor.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A_GCICAP).NewWithBorder">AI_A2A_GCICAP:NewWithBorder(EWRPrefixes, TemplatePrefixes, BorderPrefix, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius)</a></td>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A_GCICAP).NewWithBorder">AI_A2A_GCICAP:NewWithBorder(EWRPrefixes, TemplatePrefixes, BorderPrefix, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius, Resources)</a></td>
<td class="summary">
<p>AI<em>A2A</em>GCICAP constructor with border.</p>
</td>
@ -1156,7 +1156,7 @@ while defining which plane types are being used by the squadron and how many res
<li>Have name (string) that is the identifier or key of the squadron.</li>
<li>Have specific plane types.</li>
<li>Are located at one airbase.</li>
<li>Have a limited set of resources.</li>
<li>Optionally have a limited set of resources. The default is that squadrons have <strong>unlimited resources</strong>.</li>
</ul>
<p>The name of the squadron given acts as the <strong>squadron key</strong> in the AI_A2A_DISPATCHER:Squadron...() methods.</p>
@ -4102,7 +4102,7 @@ If too large, intercept missions may be triggered when the detected target is to
<li>Have a <strong>name or key</strong> that is the identifier or key of the squadron.</li>
<li>Have <strong>specific plane types</strong> defined by <strong>templates</strong>.</li>
<li>Are <strong>located at one specific airbase</strong>. Multiple squadrons can be located at one airbase through.</li>
<li>Have a limited set of <strong>resources</strong>.</li>
<li>Optionally have a limited set of <strong>resources</strong>. The default is that squadrons have unlimited resources.</li>
</ul>
<p>The name of the squadron given acts as the <strong>squadron key</strong> in the AI_A2A_DISPATCHER:Squadron...() methods.</p>
@ -4161,7 +4161,7 @@ If you have only one prefix name for a squadron, you don't need to use the <code
<li>
<p><code><em>#number Resources </em></code>:
A number that specifies how many resources are in stock of the squadron. It is still a bit buggy, this part. Just make this a large number for the moment. This will be fine tuned later.</p>
(optional) A number that specifies how many resources are in stock of the squadron. If not specified, the squadron will have infinite resources available.</p>
</li>
@ -4174,17 +4174,26 @@ A number that specifies how many resources are in stock of the squadron. It is s
<h3>Usages:</h3>
<ul>
<li><pre class="example"><code> -- Now Setup the A2A dispatcher, and initialize it using the Detection object.
A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) </code></pre></li>
A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )
</code></pre></li>
<li><pre class="example"><code> -- This will create squadron "Squadron1" at "Batumi" airbase, and will use plane types "SQ1" and has 40 planes in stock...
A2ADispatcher:SetSquadron( "Squadron1", "Batumi", "SQ1", 40 )</code></pre></li>
A2ADispatcher:SetSquadron( "Squadron1", "Batumi", "SQ1", 40 )
</code></pre></li>
<li><pre class="example"><code> -- This will create squadron "Sq 1" at "Batumi" airbase, and will use plane types "Mig-29" and "Su-27" and has 20 planes in stock...
-- Note that in this implementation, the A2A dispatcher will select a random plane when a new plane (group) needs to be spawned for defenses.
-- Note that in this implementation, the A2A dispatcher will select a random plane type when a new plane (group) needs to be spawned for defenses.
-- Note the usage of the {} for the airplane templates list.
A2ADispatcher:SetSquadron( "Sq 1", "Batumi", { "Mig-29", "Su-27" }, 40 )</code></pre></li>
A2ADispatcher:SetSquadron( "Sq 1", "Batumi", { "Mig-29", "Su-27" }, 40 )
</code></pre></li>
<li><pre class="example"><code> -- This will create 2 squadrons "104th" and "23th" at "Batumi" airbase, and will use plane types "Mig-29" and "Su-27" respectively and each squadron has 10 planes in stock...
-- Note that in this implementation, the A2A dispatcher will select a random plane when a new plane (group) needs to be spawned for defenses.
A2ADispatcher:SetSquadron( "104th", "Batumi", "Mig-29", 10 )
A2ADispatcher:SetSquadron( "23th", "Batumi", "Su-27", 10 )</code></pre></li>
A2ADispatcher:SetSquadron( "23th", "Batumi", "Su-27", 10 )
</code></pre></li>
<li><pre class="example"><code> -- This is an example like the previous, but now with infinite resources.
-- The Resources parameter is not given in the SetSquadron method.
A2ADispatcher:SetSquadron( "104th", "Batumi", "Mig-29" )
A2ADispatcher:SetSquadron( "23th", "Batumi", "Su-27" )
</code></pre></li>
</ul>
</dd>
@ -5271,7 +5280,7 @@ Provide a value of <strong>true</strong> to display every 30 seconds a tactical
<dt>
<a id="#(AI_A2A_GCICAP).New" >
<strong>AI_A2A_GCICAP:New(EWRPrefixes, TemplatePrefixes, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius)</strong>
<strong>AI_A2A_GCICAP:New(EWRPrefixes, TemplatePrefixes, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius, Resources)</strong>
</a>
</dt>
<dd>
@ -5322,6 +5331,12 @@ The radius in meters wherein detected airplanes will be engaged by airborne defe
<p><code><em>#number GciRadius </em></code>:
The radius in meters wherein detected airplanes will GCI.</p>
</li>
<li>
<p><code><em>#number Resources </em></code>:
The amount of resources that will be allocated to each squadron.</p>
</li>
</ul>
<h3>Return value</h3>
@ -5329,13 +5344,76 @@ The radius in meters wherein detected airplanes will GCI.</p>
<p><em><a href="##(AI_A2A_GCICAP)">#AI<em>A2A</em>GCICAP</a>:</em></p>
<h3>Usage:</h3>
<pre class="example"><code>
-- Set a new AI A2A GCICAP object, based on an EWR network with a 30 km grouping radius
-- This for ground and awacs installations.
A2ADispatcher = AI_A2A_GCICAP:New( { "BlueEWRGroundRadars", "BlueEWRAwacs" }, 30000 )
</code></pre>
<h3>Usages:</h3>
<ul>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object. Each squadron has unlimited resources.
-- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The CAP Zone prefix is "CAP Zone".
-- The CAP Limit is 2.
A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2 )
</code></pre></li>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object. Each squadron has unlimited resources.
-- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The CAP Zone prefix is "CAP Zone".
-- The CAP Limit is 2.
-- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2, 20000 )
</code></pre></li>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object. Each squadron has unlimited resources.
-- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The CAP Zone prefix is "CAP Zone".
-- The CAP Limit is 2.
-- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- will be considered a defense task if the target is within 60km from the defender.
A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2, 20000, 60000 )
</code></pre></li>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object. Each squadron has unlimited resources.
-- The EWR network group prefix is DF CCCP. All groups starting with DF CCCP will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The CAP Zone prefix is "CAP Zone".
-- The CAP Limit is 2.
-- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- will be considered a defense task if the target is within 60km from the defender.
-- The GCI Radius is set to 150000. Any target detected within 150km will be considered for GCI engagement.
A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2, 20000, 60000, 150000 )
</code></pre></li>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object. Each squadron has 30 resources.
-- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The CAP Zone prefix is "CAP Zone".
-- The CAP Limit is 2.
-- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- will be considered a defense task if the target is within 60km from the defender.
-- The GCI Radius is set to 150000. Any target detected within 150km will be considered for GCI engagement.
-- The amount of resources for each squadron is set to 30. Thus about 30 resources are allocated to each squadron created.
A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2, 20000, 60000, 150000, 30 )
</code></pre></li>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object. Each squadron has 30 resources.
-- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The CAP Zone prefix is nil. No CAP is created.
-- The CAP Limit is nil.
-- The Grouping Radius is nil. The default range of 6km radius will be grouped as a group of targets.
-- The Engage Radius is set nil. The default Engage Radius will be used to consider a defenser being assigned to a task.
-- The GCI Radius is nil. Any target detected within the default GCI Radius will be considered for GCI engagement.
-- The amount of resources for each squadron is set to 30. Thus about 30 resources are allocated to each squadron created.
A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, nil, nil, nil, nil, nil, 30 )
</code></pre></li>
</ul>
</dd>
</dl>
@ -5343,7 +5421,7 @@ The radius in meters wherein detected airplanes will GCI.</p>
<dt>
<a id="#(AI_A2A_GCICAP).NewWithBorder" >
<strong>AI_A2A_GCICAP:NewWithBorder(EWRPrefixes, TemplatePrefixes, BorderPrefix, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius)</strong>
<strong>AI_A2A_GCICAP:NewWithBorder(EWRPrefixes, TemplatePrefixes, BorderPrefix, CapPrefixes, CapLimit, GroupingRadius, EngageRadius, GciRadius, Resources)</strong>
</a>
</dt>
<dd>
@ -5400,6 +5478,12 @@ The radius in meters wherein detected airplanes will be engaged by airborne defe
<p><code><em>#number GciRadius </em></code>:
The radius in meters wherein detected airplanes will GCI.</p>
</li>
<li>
<p><code><em>#number Resources </em></code>:
The amount of resources that will be allocated to each squadron.</p>
</li>
</ul>
<h3>Return value</h3>
@ -5407,13 +5491,85 @@ The radius in meters wherein detected airplanes will GCI.</p>
<p><em><a href="##(AI_A2A_GCICAP)">#AI<em>A2A</em>GCICAP</a>:</em></p>
<h3>Usage:</h3>
<pre class="example"><code>
-- Set a new AI A2A GCICAP object, based on an EWR network with a 30 km grouping radius
-- This for ground and awacs installations.
A2ADispatcher = AI_A2A_GCICAP:New( { "BlueEWRGroundRadars", "BlueEWRAwacs" }, 30000 )
</code></pre>
<h3>Usages:</h3>
<ul>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object with a border. Each squadron has unlimited resources.
-- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The CAP Zone prefix is "CAP Zone".
-- The CAP Limit is 2.
A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", { "CAP Zone" }, 2 )
</code></pre></li>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object with a border. Each squadron has unlimited resources.
-- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The Border prefix is "Border". This will setup a border using the group defined within the mission editor with the name Border.
-- The CAP Zone prefix is "CAP Zone".
-- The CAP Limit is 2.
-- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", { "CAP Zone" }, 2, 20000 )
</code></pre></li>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object with a border. Each squadron has unlimited resources.
-- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The Border prefix is "Border". This will setup a border using the group defined within the mission editor with the name Border.
-- The CAP Zone prefix is "CAP Zone".
-- The CAP Limit is 2.
-- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- will be considered a defense task if the target is within 60km from the defender.
A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", { "CAP Zone" }, 2, 20000, 60000 )
</code></pre></li>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object with a border. Each squadron has unlimited resources.
-- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The Border prefix is "Border". This will setup a border using the group defined within the mission editor with the name Border.
-- The CAP Zone prefix is "CAP Zone".
-- The CAP Limit is 2.
-- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- will be considered a defense task if the target is within 60km from the defender.
-- The GCI Radius is set to 150000. Any target detected within 150km will be considered for GCI engagement.
A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", { "CAP Zone" }, 2, 20000, 60000, 150000 )
</code></pre></li>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object with a border. Each squadron has 30 resources.
-- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The Border prefix is "Border". This will setup a border using the group defined within the mission editor with the name Border.
-- The CAP Zone prefix is "CAP Zone".
-- The CAP Limit is 2.
-- The Grouping Radius is set to 20000. Thus all planes within a 20km radius will be grouped as a group of targets.
-- The Engage Radius is set to 60000. Any defender without a task, and in healthy condition,
-- will be considered a defense task if the target is within 60km from the defender.
-- The GCI Radius is set to 150000. Any target detected within 150km will be considered for GCI engagement.
-- The amount of resources for each squadron is set to 30. Thus about 30 resources are allocated to each squadron created.
A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", { "CAP Zone" }, 2, 20000, 60000, 150000, 30 )
</code></pre></li>
<li><pre class="example"><code>
-- Setup a new GCICAP dispatcher object with a border. Each squadron has 30 resources.
-- The EWR network group prefix is "DF CCCP". All groups starting with "DF CCCP" will be part of the EWR network.
-- The Squadron Templates prefix is "SQ CCCP". All groups starting with "SQ CCCP" will be considered as airplane templates.
-- The Border prefix is "Border". This will setup a border using the group defined within the mission editor with the name Border.
-- The CAP Zone prefix is nil. No CAP is created.
-- The CAP Limit is nil.
-- The Grouping Radius is nil. The default range of 6km radius will be grouped as a group of targets.
-- The Engage Radius is set nil. The default Engage Radius will be used to consider a defenser being assigned to a task.
-- The GCI Radius is nil. Any target detected within the default GCI Radius will be considered for GCI engagement.
-- The amount of resources for each squadron is set to 30. Thus about 30 resources are allocated to each squadron created.
A2ADispatcher = AI_A2A_GCICAP:NewWithBorder( { "DF CCCP" }, { "SQ CCCP" }, "Border", nil, nil, nil, nil, nil, 30 )
</code></pre></li>
</ul>
</dd>
</dl>

View File

@ -2464,7 +2464,6 @@ The index of the DetectedItem.</p>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(DETECTION_BASE).DetectedItemCount" >
<strong>DETECTION_BASE.DetectedItemCount</strong>
</a>
@ -2478,7 +2477,6 @@ The index of the DetectedItem.</p>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(DETECTION_BASE).DetectedItemMax" >
<strong>DETECTION_BASE.DetectedItemMax</strong>
</a>
@ -2644,7 +2642,7 @@ The group to generate the report for.</p>
<dl class="function">
<dt>
<em>#number</em>
<em></em>
<a id="#(DETECTION_BASE).DetectionInterval" >
<strong>DETECTION_BASE.DetectionInterval</strong>
</a>

View File

@ -1598,7 +1598,7 @@ A string defining the start state.</p>
<dl class="function">
<dt>
<em>#string</em>
<em></em>
<a id="#(FSM)._StartState" >
<strong>FSM._StartState</strong>
</a>
@ -1897,6 +1897,7 @@ A string defining the start state.</p>
<dl class="function">
<dt>
<em></em>
<a id="#(FSM).current" >
<strong>FSM.current</strong>
</a>

View File

@ -2829,7 +2829,6 @@ The y coordinate.</p>
<dl class="function">
<dt>
<em></em>
<a id="#(POINT_VEC2).z" >
<strong>POINT_VEC2.z</strong>
</a>

View File

@ -1142,7 +1142,7 @@ true if metric.</p>
<dl class="function">
<dt>
<em></em>
<em>#boolean</em>
<a id="#(SETTINGS).Metric" >
<strong>SETTINGS.Metric</strong>
</a>

View File

@ -2194,6 +2194,9 @@ The group that was spawned. You can use this group for further actions.</p>
<p> Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.</p>
</dd>
</dl>
<dl class="function">
@ -2749,9 +2752,6 @@ when nothing was spawned.</p>
<p> By default, no InitLimit</p>
</dd>
</dl>
<dl class="function">
@ -2787,7 +2787,7 @@ when nothing was spawned.</p>
<dl class="function">
<dt>
<em>#number</em>
<em></em>
<a id="#(SPAWN).SpawnMaxGroups" >
<strong>SPAWN.SpawnMaxGroups</strong>
</a>
@ -2804,7 +2804,7 @@ when nothing was spawned.</p>
<dl class="function">
<dt>
<em>#number</em>
<em></em>
<a id="#(SPAWN).SpawnMaxUnitsAlive" >
<strong>SPAWN.SpawnMaxUnitsAlive</strong>
</a>

View File

@ -436,7 +436,6 @@ ptional) The name of the new static.</p>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(SPAWNSTATIC).SpawnIndex" >
<strong>SPAWNSTATIC.SpawnIndex</strong>
</a>

View File

@ -765,7 +765,6 @@ true if it is lasing</p>
<dl class="function">
<dt>
<em></em>
<a id="#(SPOT).ScheduleID" >
<strong>SPOT.ScheduleID</strong>
</a>
@ -779,7 +778,6 @@ true if it is lasing</p>
<dl class="function">
<dt>
<em></em>
<a id="#(SPOT).SpotIR" >
<strong>SPOT.SpotIR</strong>
</a>
@ -793,7 +791,6 @@ true if it is lasing</p>
<dl class="function">
<dt>
<em></em>
<a id="#(SPOT).SpotLaser" >
<strong>SPOT.SpotLaser</strong>
</a>
@ -807,7 +804,6 @@ true if it is lasing</p>
<dl class="function">
<dt>
<em></em>
<a id="#(SPOT).Target" >
<strong>SPOT.Target</strong>
</a>