method AI_FORMATION:FormationCenterWing implemented.

This commit is contained in:
FlightControl 2017-05-11 14:10:49 +02:00
parent 98fb15dfb7
commit 546b960951
8 changed files with 437 additions and 40 deletions

View File

@ -73,19 +73,16 @@
-- * @{AI_Formation#AI_FORMATION.FormationRightWing}(): Form a right wing formation.
-- * @{AI_Formation#AI_FORMATION.FormationLeftWing}(): Form a left wing formation.
-- * @{AI_Formation#AI_FORMATION.FormationCenterLine}(): Form a center line formation.
-- * @{AI_Formation#AI_FORMATION.FormationCenterWing}(): Form a center wing formation.
-- * @{AI_Formation#AI_FORMATION.FormationCenterBoxed}(): Form a center boxed formation.
--
--
-- @usage
-- -- Declare a new FollowPlanes object as follows:
--
-- -- First find the GROUP object and the CLIENT object.
-- local FollowUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
-- local FollowGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Follow Client.
--
-- -- Now use these 2 objects to construct the new FollowPlanes object.
-- FollowPlanes = AI_FORMATION:New( FollowUnit, FollowGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
-- local FollowGroupSet = SET_GROUP:New():FilterCategories("plane"):FilterCoalitions("blue"):FilterPrefixes("Follow"):FilterStart()
-- FollowGroupSet:Flush()
-- local LeaderUnit = UNIT:FindByName( "Leader" )
-- local LargeFormation = AI_FORMATION:New( LeaderUnit, FollowGroupSet, "Center Wing Formation", "Briefing" )
-- LargeFormation:FormationCenterWing( 500, 50, 0, 250, 250 )
-- LargeFormation:__Start( 1 )
--
-- @field #AI_FORMATION
AI_FORMATION = {
@ -320,6 +317,56 @@ function AI_FORMATION:New( FollowUnit, FollowGroupSet, FollowName, FollowBriefin
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
self:AddTransition( "*", "FormationCenterWing", "*" )
--- FormationCenterWing Handler OnBefore for AI_FORMATION
-- @function [parent=#AI_FORMATION] OnBeforeFormationCenterWing
-- @param #AI_FORMATION self
-- @param Core.Set#SET_GROUP FollowGroupSet The group AI escorting the FollowUnit.
-- @param #string From
-- @param #string Event
-- @param #string To
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
-- @return #boolean
--- FormationCenterWing Handler OnAfter for AI_FORMATION
-- @function [parent=#AI_FORMATION] OnAfterFormationCenterWing
-- @param #AI_FORMATION self
-- @param Core.Set#SET_GROUP FollowGroupSet The group AI escorting the FollowUnit.
-- @param #string From
-- @param #string Event
-- @param #string To
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
--- FormationCenterWing Trigger for AI_FORMATION
-- @function [parent=#AI_FORMATION] FormationCenterWing
-- @param #AI_FORMATION self
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
--- FormationCenterWing Asynchronous Trigger for AI_FORMATION
-- @function [parent=#AI_FORMATION] __FormationCenterWing
-- @param #AI_FORMATION self
-- @param #number Delay
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
self:AddTransition( "*", "Follow", "Following" )
@ -493,6 +540,47 @@ function AI_FORMATION:onafterFormationRightWing( FollowGroupSet, From , Event ,
end
--- FormationCenterWing Handler OnAfter for AI_FORMATION
-- @function [parent=#AI_FORMATION] OnAfterFormationCenterWing
-- @param #AI_FORMATION self
-- @param Core.Set#SET_GROUP FollowGroupSet The group AI escorting the FollowUnit.
-- @param #string From
-- @param #string Event
-- @param #string To
-- @param #number XStart The start position on the X-axis in meters for the first group.
-- @param #number XSpace The space between groups on the X-axis in meters for each sequent group.
-- @param #nubmer YStart The start position on the Y-axis in meters for the first group.
-- @param #nubmer ZStart The start position on the Z-axis in meters for the first group.
-- @param #number ZSpace The space between groups on the Z-axis in meters for each sequent group.
function AI_FORMATION:onafterFormationCenterWing( FollowGroupSet, From , Event , To, XStart, XSpace, YStart, ZStart, ZSpace )
local FollowSet = FollowGroupSet:GetSet()
local i = 0
for FollowID, FollowGroup in pairs( FollowSet ) do
local PointVec3 = POINT_VEC3:New()
local Side = ( i % 2 == 0 ) and 1 or -1
local Row = i / 2 + 1
self:E(Side)
PointVec3:SetX( XStart + Row * XSpace )
PointVec3:SetY( YStart )
PointVec3:SetZ( Side * ( ZStart + i * ZSpace ) )
local Vec3 = PointVec3:GetVec3()
self:E( Vec3 )
FollowGroup:SetState( self, "Vec3", Vec3 )
FollowGroup:OptionROTPassiveDefense()
FollowGroup:OptionROEReturnFire()
i = i + 1
end
end
--- @param Follow#AI_FORMATION self

View File

@ -197,6 +197,12 @@
<td class="name" nowrap="nowrap"><a href="##(AI_FORMATION).FollowUnit">AI_FORMATION.FollowUnit</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_FORMATION).FormationCenterWing">AI_FORMATION:FormationCenterWing(XStart, XSpace, YStart, ZStart, ZSpace)</a></td>
<td class="summary">
<p>FormationCenterWing Trigger for AI_FORMATION</p>
</td>
</tr>
<tr>
@ -227,6 +233,12 @@
<td class="name" nowrap="nowrap"><a href="##(AI_FORMATION).New">AI_FORMATION:New(FollowUnit, FollowGroupSet, FollowName, FollowBriefing)</a></td>
<td class="summary">
<p>AI_FORMATION class constructor for an AI group</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_FORMATION).OnAfterFormationCenterWing">AI_FORMATION:OnAfterFormationCenterWing(FollowGroupSet, From, Event, To, XStart, XSpace, YStart, ZStart, ZSpace)</a></td>
<td class="summary">
<p>FormationCenterWing Handler OnAfter for AI_FORMATION</p>
</td>
</tr>
<tr>
@ -251,6 +263,12 @@
<td class="name" nowrap="nowrap"><a href="##(AI_FORMATION).OnAfterFormationRightWing">AI_FORMATION:OnAfterFormationRightWing(FollowGroupSet, From, Event, To, XStart, XSpace, YStart, ZStart, ZSpace)</a></td>
<td class="summary">
<p>FormationRightWing Handler OnAfter for AI_FORMATION</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_FORMATION).OnBeforeFormationCenterWing">AI_FORMATION:OnBeforeFormationCenterWing(FollowGroupSet, From, Event, To, XStart, XSpace, YStart, ZStart, ZSpace)</a></td>
<td class="summary">
<p>FormationCenterWing Handler OnBefore for AI_FORMATION</p>
</td>
</tr>
<tr>
@ -299,6 +317,12 @@
<td class="name" nowrap="nowrap"><a href="##(AI_FORMATION).TestSmokeDirectionVector">AI_FORMATION:TestSmokeDirectionVector(SmokeDirection)</a></td>
<td class="summary">
<p>This function is for test, it will put on the frequency of the FollowScheduler a red smoke at the direction vector calculated for the escort to fly to.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_FORMATION).__FormationCenterWing">AI_FORMATION:__FormationCenterWing(Delay, XStart, XSpace, YStart, ZStart, ZSpace)</a></td>
<td class="summary">
<p>FormationCenterWing Asynchronous Trigger for AI_FORMATION</p>
</td>
</tr>
<tr>
@ -323,6 +347,12 @@
<td class="name" nowrap="nowrap"><a href="##(AI_FORMATION).__FormationRightWing">AI_FORMATION:__FormationRightWing(Delay, XStart, XSpace, YStart, ZStart, ZSpace)</a></td>
<td class="summary">
<p>FormationRightWing Asynchronous Trigger for AI_FORMATION</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_FORMATION).onafterFormationCenterWing">AI_FORMATION:onafterFormationCenterWing(FollowGroupSet, From, Event, To, XStart, XSpace, YStart, ZStart, ZSpace)</a></td>
<td class="summary">
</td>
</tr>
<tr>
@ -437,21 +467,18 @@
<li><a href="AI_Formation.html##(AI_FORMATION).FormationRightWing">AI<em>Formation#AI</em>FORMATION.FormationRightWing</a>(): Form a right wing formation.</li>
<li><a href="AI_Formation.html##(AI_FORMATION).FormationLeftWing">AI<em>Formation#AI</em>FORMATION.FormationLeftWing</a>(): Form a left wing formation.</li>
<li><a href="AI_Formation.html##(AI_FORMATION).FormationCenterLine">AI<em>Formation#AI</em>FORMATION.FormationCenterLine</a>(): Form a center line formation.</li>
<li><a href="AI_Formation.html##(AI_FORMATION).FormationCenterWing">AI<em>Formation#AI</em>FORMATION.FormationCenterWing</a>(): Form a center wing formation.</li>
<li><a href="AI_Formation.html##(AI_FORMATION).FormationCenterBoxed">AI<em>Formation#AI</em>FORMATION.FormationCenterBoxed</a>(): Form a center boxed formation.</li>
</ul>
<h3>Usage:</h3>
<pre class="example"><code>-- Declare a new FollowPlanes object as follows:
-- First find the GROUP object and the CLIENT object.
local FollowUnit = CLIENT:FindByName( "Unit Name" ) -- The Unit Name is the name of the unit flagged with the skill Client in the mission editor.
local FollowGroup = GROUP:FindByName( "Group Name" ) -- The Group Name is the name of the group that will escort the Follow Client.
-- Now use these 2 objects to construct the new FollowPlanes object.
FollowPlanes = AI_FORMATION:New( FollowUnit, FollowGroup, "Desert", "Welcome to the mission. You are escorted by a plane with code name 'Desert', which can be instructed through the F10 radio menu." )
<pre class="example"><code>local FollowGroupSet = SET_GROUP:New():FilterCategories("plane"):FilterCoalitions("blue"):FilterPrefixes("Follow"):FilterStart()
FollowGroupSet:Flush()
local LeaderUnit = UNIT:FindByName( "Leader" )
local LargeFormation = AI_FORMATION:New( LeaderUnit, FollowGroupSet, "Center Wing Formation", "Briefing" )
LargeFormation:FormationCenterWing( 500, 50, 0, 250, 250 )
LargeFormation:__Start( 1 )
</code></pre>
</dd>
@ -559,6 +586,52 @@ FollowPlanes = AI_FORMATION:New( FollowUnit, FollowGroup, "Desert", "Welcome to
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_FORMATION).FormationCenterWing" >
<strong>AI_FORMATION:FormationCenterWing(XStart, XSpace, YStart, ZStart, ZSpace)</strong>
</a>
</dt>
<dd>
<p>FormationCenterWing Trigger for AI_FORMATION</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#number XStart </em></code>:
The start position on the X-axis in meters for the first group.</p>
</li>
<li>
<p><code><em>#number XSpace </em></code>:
The space between groups on the X-axis in meters for each sequent group.</p>
</li>
<li>
<p><code><em><a href="##(nubmer)">#nubmer</a> YStart </em></code>:
The start position on the Y-axis in meters for the first group.</p>
</li>
<li>
<p><code><em><a href="##(nubmer)">#nubmer</a> ZStart </em></code>:
The start position on the Z-axis in meters for the first group.</p>
</li>
<li>
<p><code><em>#number ZSpace </em></code>:
The space between groups on the Z-axis in meters for each sequent group.</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
@ -780,6 +853,73 @@ self</p>
<dl class="function">
<dt>
<a id="#(AI_FORMATION).OnAfterFormationCenterWing" >
<strong>AI_FORMATION:OnAfterFormationCenterWing(FollowGroupSet, From, Event, To, XStart, XSpace, YStart, ZStart, ZSpace)</strong>
</a>
</dt>
<dd>
<p>FormationCenterWing Handler OnAfter for AI_FORMATION</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Core.Set.html##(SET_GROUP)">Core.Set#SET_GROUP</a> FollowGroupSet </em></code>:
The group AI escorting the FollowUnit.</p>
</li>
<li>
<p><code><em>#string From </em></code>: </p>
</li>
<li>
<p><code><em>#string Event </em></code>: </p>
</li>
<li>
<p><code><em>#string To </em></code>: </p>
</li>
<li>
<p><code><em>#number XStart </em></code>:
The start position on the X-axis in meters for the first group.</p>
</li>
<li>
<p><code><em>#number XSpace </em></code>:
The space between groups on the X-axis in meters for each sequent group.</p>
</li>
<li>
<p><code><em><a href="##(nubmer)">#nubmer</a> YStart </em></code>:
The start position on the Y-axis in meters for the first group.</p>
</li>
<li>
<p><code><em><a href="##(nubmer)">#nubmer</a> ZStart </em></code>:
The start position on the Z-axis in meters for the first group.</p>
</li>
<li>
<p><code><em>#number ZSpace </em></code>:
The space between groups on the Z-axis in meters for each sequent group.</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_FORMATION).OnAfterFormationLeftLine" >
<strong>AI_FORMATION:OnAfterFormationLeftLine(FollowGroupSet, From, Event, To, XStart, YStart, ZStart, ZSpace)</strong>
</a>
@ -1036,6 +1176,78 @@ The space between groups on the Z-axis in meters for each sequent group.</p>
<dl class="function">
<dt>
<a id="#(AI_FORMATION).OnBeforeFormationCenterWing" >
<strong>AI_FORMATION:OnBeforeFormationCenterWing(FollowGroupSet, From, Event, To, XStart, XSpace, YStart, ZStart, ZSpace)</strong>
</a>
</dt>
<dd>
<p>FormationCenterWing Handler OnBefore for AI_FORMATION</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Core.Set.html##(SET_GROUP)">Core.Set#SET_GROUP</a> FollowGroupSet </em></code>:
The group AI escorting the FollowUnit.</p>
</li>
<li>
<p><code><em>#string From </em></code>: </p>
</li>
<li>
<p><code><em>#string Event </em></code>: </p>
</li>
<li>
<p><code><em>#string To </em></code>: </p>
</li>
<li>
<p><code><em>#number XStart </em></code>:
The start position on the X-axis in meters for the first group.</p>
</li>
<li>
<p><code><em>#number XSpace </em></code>:
The space between groups on the X-axis in meters for each sequent group.</p>
</li>
<li>
<p><code><em><a href="##(nubmer)">#nubmer</a> YStart </em></code>:
The start position on the Y-axis in meters for the first group.</p>
</li>
<li>
<p><code><em><a href="##(nubmer)">#nubmer</a> ZStart </em></code>:
The start position on the Z-axis in meters for the first group.</p>
</li>
<li>
<p><code><em>#number ZSpace </em></code>:
The space between groups on the Z-axis in meters for each sequent group.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em>#boolean:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_FORMATION).OnBeforeFormationLeftLine" >
<strong>AI_FORMATION:OnBeforeFormationLeftLine(FollowGroupSet, From, Event, To, XStart, YStart, ZStart, ZSpace)</strong>
</a>
@ -1383,6 +1595,57 @@ If true, then the direction vector will be smoked.</p>
<dl class="function">
<dt>
<a id="#(AI_FORMATION).__FormationCenterWing" >
<strong>AI_FORMATION:__FormationCenterWing(Delay, XStart, XSpace, YStart, ZStart, ZSpace)</strong>
</a>
</dt>
<dd>
<p>FormationCenterWing Asynchronous Trigger for AI_FORMATION</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#number Delay </em></code>: </p>
</li>
<li>
<p><code><em>#number XStart </em></code>:
The start position on the X-axis in meters for the first group.</p>
</li>
<li>
<p><code><em>#number XSpace </em></code>:
The space between groups on the X-axis in meters for each sequent group.</p>
</li>
<li>
<p><code><em><a href="##(nubmer)">#nubmer</a> YStart </em></code>:
The start position on the Y-axis in meters for the first group.</p>
</li>
<li>
<p><code><em><a href="##(nubmer)">#nubmer</a> ZStart </em></code>:
The start position on the Z-axis in meters for the first group.</p>
</li>
<li>
<p><code><em>#number ZSpace </em></code>:
The space between groups on the Z-axis in meters for each sequent group.</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_FORMATION).__FormationLeftLine" >
<strong>AI_FORMATION:__FormationLeftLine(Delay, XStart, YStart, ZStart, ZSpace)</strong>
</a>
@ -1575,6 +1838,67 @@ The space between groups on the Z-axis in meters for each sequent group.</p>
<dl class="function">
<dt>
<a id="#(AI_FORMATION).onafterFormationCenterWing" >
<strong>AI_FORMATION:onafterFormationCenterWing(FollowGroupSet, From, Event, To, XStart, XSpace, YStart, ZStart, ZSpace)</strong>
</a>
</dt>
<dd>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em> FollowGroupSet </em></code>: </p>
</li>
<li>
<p><code><em> From </em></code>: </p>
</li>
<li>
<p><code><em> Event </em></code>: </p>
</li>
<li>
<p><code><em> To </em></code>: </p>
</li>
<li>
<p><code><em> XStart </em></code>: </p>
</li>
<li>
<p><code><em> XSpace </em></code>: </p>
</li>
<li>
<p><code><em> YStart </em></code>: </p>
</li>
<li>
<p><code><em> ZStart </em></code>: </p>
</li>
<li>
<p><code><em> ZSpace </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(AI_FORMATION).onafterFormationLeftLine" >
<strong>AI_FORMATION:onafterFormationLeftLine(FollowGroupSet, From, Event, To, XStart, YStart, ZStart, ZSpace)</strong>
</a>

View File

@ -1830,7 +1830,6 @@ self</p>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(DATABASE).UNITS_Position" >
<strong>DATABASE.UNITS_Position</strong>
</a>

View File

@ -2478,7 +2478,7 @@ The index of the DetectedItem.</p>
<dl class="function">
<dt>
<em>#number</em>
<em></em>
<a id="#(DETECTION_BASE).DetectionInterval" >
<strong>DETECTION_BASE.DetectionInterval</strong>
</a>

View File

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

View File

@ -215,7 +215,6 @@ on defined intervals (currently every minute).</p>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(MOVEMENT).AliveUnits" >
<strong>MOVEMENT.AliveUnits</strong>
</a>
@ -224,9 +223,6 @@ on defined intervals (currently every minute).</p>
<p> Contains the counter how many units are currently alive</p>
</dd>
</dl>
<dl class="function">

View File

@ -2073,9 +2073,6 @@ 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">
@ -2529,9 +2526,6 @@ when nothing was spawned.</p>
<p> Overwrite unit names by default with group name.</p>
</dd>
</dl>
<dl class="function">
@ -2546,9 +2540,6 @@ when nothing was spawned.</p>
<p> By default, no InitLimit</p>
</dd>
</dl>
<dl class="function">
@ -2584,7 +2575,7 @@ when nothing was spawned.</p>
<dl class="function">
<dt>
<em>#number</em>
<em></em>
<a id="#(SPAWN).SpawnMaxGroups" >
<strong>SPAWN.SpawnMaxGroups</strong>
</a>
@ -2601,7 +2592,7 @@ when nothing was spawned.</p>
<dl class="function">
<dt>
<em>#number</em>
<em></em>
<a id="#(SPAWN).SpawnMaxUnitsAlive" >
<strong>SPAWN.SpawnMaxUnitsAlive</strong>
</a>
@ -2929,7 +2920,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
<dl class="function">
<dt>
<em>#boolean</em>
<em></em>
<a id="#(SPAWN).SpawnUnControlled" >
<strong>SPAWN.SpawnUnControlled</strong>
</a>
@ -2953,7 +2944,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
<p> Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.</p>
<p> When the first Spawn executes, all the Groups need to be made visible before start.</p>
</dd>
</dl>

View File

@ -503,7 +503,7 @@ based on the tasking capabilities defined in <a href="Task.html##(TASK)">Task#TA
<dl class="function">
<dt>
<em><a href="Core.Cargo.html##(CARGO)">Core.Cargo#CARGO</a></em>
<em><a href="Core.Cargo.html##(CARGO_GROUP)">Core.Cargo#CARGO_GROUP</a></em>
<a id="#(FSM_PROCESS).Cargo" >
<strong>FSM_PROCESS.Cargo</strong>
</a>