Finetuned AIBALANCER documentation

This commit is contained in:
FlightControl 2016-06-18 00:00:27 +02:00
parent c211f4f603
commit 87313a9204
2 changed files with 59 additions and 31 deletions

View File

@ -35,10 +35,10 @@
-- @type AIBALANCER
-- @field Set#SET_CLIENT SetClient
-- @field Spawn#SPAWN SpawnAI
-- @field #boolean ReturnToAirbase
-- @field #boolean ToNearestAirbase
-- @field Set#SET_AIRBASE ReturnAirbaseSet
-- @field DCSTypes#Distance ReturnTresholdRange
-- @field #boolean ReturnToHomeAirbase
-- @field #boolean ToHomeAirbase
-- @extends Base#BASE
AIBALANCER = {
ClassName = "AIBALANCER",
@ -76,7 +76,7 @@ function AIBALANCER:New( SetClient, SpawnAI )
end
end
self.ReturnToAirbase = false
self.ToNearestAirbase = false
self.ReturnHomeAirbase = false
self.AIMonitorSchedule = SCHEDULER:New( self, self._ClientAliveMonitorScheduler, {}, 1, 10, 0 )
@ -90,7 +90,7 @@ end
-- @param Set#SET_AIRBASE ReturnAirbaseSet The SET of @{Set#SET_AIRBASE}s to evaluate where to return to.
function AIBALANCER:ReturnToNearestAirbases( ReturnTresholdRange, ReturnAirbaseSet )
self.ReturnToAirbase = true
self.ToNearestAirbase = true
self.ReturnTresholdRange = ReturnTresholdRange
self.ReturnAirbaseSet = ReturnAirbaseSet
end
@ -100,7 +100,7 @@ end
-- @param DCSTypes#Distance ReturnTresholdRange If there is an enemy @{Client#CLIENT} within the ReturnTresholdRange given in meters, the AI will not return to the nearest @{Airbase#AIRBASE}.
function AIBALANCER:ReturnToHomeAirbase( ReturnTresholdRange )
self.ReturnToHomeAirbase = true
self.ToHomeAirbase = true
self.ReturnTresholdRange = ReturnTresholdRange
end
@ -118,7 +118,7 @@ function AIBALANCER:_ClientAliveMonitorScheduler()
local AIGroup = Client:GetState( self, 'AIGroup' ) -- Group#GROUP
if self.ReturnToAirbase == false and self.ReturnToHomeAirbase == false then
if self.ToNearestAirbase == false and self.ToHomeAirbase == false then
AIGroup:Destroy()
else
-- We test if there is no other CLIENT within the self.ReturnTresholdRange of the first unit of the AI group.
@ -148,7 +148,7 @@ function AIBALANCER:_ClientAliveMonitorScheduler()
function( RangeZone, AIGroup, ClientInZone )
local AIGroupTemplate = AIGroup:GetTemplate()
if ClientInZone.Value == false then
if self.ReturnToHomeAirbase == true then
if self.ToHomeAirbase == true then
local WayPointCount = #AIGroupTemplate.route.points
local SwitchWayPointCommand = AIGroup:CommandSwitchWayPoint( 1, WayPointCount, 1 )
AIGroup:SetCommand( SwitchWayPointCommand )

View File

@ -136,15 +136,9 @@ James has shared his ideas on balancing AI with air units, and together we made
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AIBALANCER).ReturnToAirbase">AIBALANCER.ReturnToAirbase</a></td>
<td class="name" nowrap="nowrap"><a href="##(AIBALANCER).ReturnToHomeAirbase">AIBALANCER:ReturnToHomeAirbase(ReturnTresholdRange)</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AIBALANCER).ReturnToHomeAirbase">AIBALANCER.ReturnToHomeAirbase</a></td>
<td class="summary">
<p>Returns the AI to the home <a href="Airbase.html##(AIRBASE)">Airbase#AIRBASE</a>.</p>
</td>
</tr>
<tr>
@ -169,6 +163,18 @@ James has shared his ideas on balancing AI with air units, and together we made
<td class="name" nowrap="nowrap"><a href="##(AIBALANCER).SpawnAI">AIBALANCER.SpawnAI</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AIBALANCER).ToHomeAirbase">AIBALANCER.ToHomeAirbase</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AIBALANCER).ToNearestAirbase">AIBALANCER.ToNearestAirbase</a></td>
<td class="summary">
</td>
</tr>
<tr>
@ -265,29 +271,23 @@ self</p>
<dl class="function">
<dt>
<em>#boolean</em>
<a id="#(AIBALANCER).ReturnToAirbase" >
<strong>AIBALANCER.ReturnToAirbase</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<em>#boolean</em>
<a id="#(AIBALANCER).ReturnToHomeAirbase" >
<strong>AIBALANCER.ReturnToHomeAirbase</strong>
<strong>AIBALANCER:ReturnToHomeAirbase(ReturnTresholdRange)</strong>
</a>
</dt>
<dd>
<p>Returns the AI to the home <a href="Airbase.html##(AIRBASE)">Airbase#AIRBASE</a>.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="DCSTypes.html##(Distance)">DCSTypes#Distance</a> ReturnTresholdRange </em></code>:
If there is an enemy <a href="Client.html##(CLIENT)">Client#CLIENT</a> within the ReturnTresholdRange given in meters, the AI will not return to the nearest <a href="Airbase.html##(AIRBASE)">Airbase#AIRBASE</a>.</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
@ -358,6 +358,34 @@ The SET of <a href="Set.html##(SET_AIRBASE)">Set#SET_AIRBASE</a>s to evaluate wh
</dd>
</dl>
<dl class="function">
<dt>
<em>#boolean</em>
<a id="#(AIBALANCER).ToHomeAirbase" >
<strong>AIBALANCER.ToHomeAirbase</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<em>#boolean</em>
<a id="#(AIBALANCER).ToNearestAirbase" >
<strong>AIBALANCER.ToNearestAirbase</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">