Documentation, and test mission video + optimizations

This commit is contained in:
FlightControl
2016-05-24 11:57:01 +02:00
parent d1b8eda700
commit 070c893940
68 changed files with 4190 additions and 2098 deletions

View File

@@ -21,6 +21,17 @@
<li><a href="CARGO.html">CARGO</a></li>
<li><a href="CleanUp.html">CleanUp</a></li>
<li>Client</li>
<li><a href="DCSAirbase.html">DCSAirbase</a></li>
<li><a href="DCSCoalitionObject.html">DCSCoalitionObject</a></li>
<li><a href="DCSCommand.html">DCSCommand</a></li>
<li><a href="DCSController.html">DCSController</a></li>
<li><a href="DCSGroup.html">DCSGroup</a></li>
<li><a href="DCSObject.html">DCSObject</a></li>
<li><a href="DCSTask.html">DCSTask</a></li>
<li><a href="DCSTypes.html">DCSTypes</a></li>
<li><a href="DCSUnit.html">DCSUnit</a></li>
<li><a href="DCSWorld.html">DCSWorld</a></li>
<li><a href="DCStimer.html">DCStimer</a></li>
<li><a href="DEPLOYTASK.html">DEPLOYTASK</a></li>
<li><a href="DESTROYBASETASK.html">DESTROYBASETASK</a></li>
<li><a href="DESTROYGROUPSTASK.html">DESTROYGROUPSTASK</a></li>
@@ -45,9 +56,12 @@
<li><a href="Sead.html">Sead</a></li>
<li><a href="Set.html">Set</a></li>
<li><a href="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>
<li><a href="Unit.html">Unit</a></li>
<li><a href="Zone.html">Zone</a></li>
<li><a href="env.html">env</a></li>
<li><a href="land.html">land</a></li>
<li><a href="routines.html">routines</a></li>
</ul>
</div>
@@ -60,18 +74,41 @@
<h1><a href="##(CLIENT)">#CLIENT</a> class</h1>
<p>Clients are those <strong>Units</strong> defined within the Mission Editor that have the skillset defined as <strong>Client</strong> or <strong>Player</strong>.
Note that clients are NOT the same as Units, they are NOT necessarily alive.</p>
Note that clients are NOT the same as Units, they are NOT necessarily alive.
The <a href="CLIENT.html">CLIENT</a> class is a wrapper class to handle the DCS Unit objects that have the skillset defined as <strong>Client</strong> or <strong>Player</strong>:</p>
<ul>
<li>Wraps the DCS Unit objects with skill level set to Player or Client.</li>
<li>Support all DCS Unit APIs.</li>
<li>Enhance with Unit specific APIs not in the DCS Group API set.</li>
<li>When player joins Unit, execute alive init logic.</li>
<li>Handles messages to players.</li>
<li>Manage the "state" of the DCS Unit.</li>
</ul>
<p>Clients are being used by the <a href="MISSION.html">MISSION</a> class to follow players and register their successes.</p>
<h1>CLIENT construction methods:</h1>
<p>Create a new CLIENT object with the <a href="##(CLIENT).New">CLIENT.New</a> method:</p>
<h1>CLIENT reference methods</h1>
<p>For each DCS Unit having skill level Player or Client, a CLIENT wrapper object (instance) will be created within the _<a href="DATABASE.html">DATABASE</a> object.
This is done at the beginning of the mission (when the mission starts).</p>
<p>The CLIENT class does not contain a :New() method, rather it provides :Find() methods to retrieve the object reference
using the DCS Unit or the DCS UnitName.</p>
<p>Another thing to know is that CLIENT objects do not "contain" the DCS Unit object.
The CLIENT methods will reference the DCS Unit object by name when it is needed during API execution.
If the DCS Unit object does not exist or is nil, the CLIENT methods will return nil and log an exception in the DCS.log file.</p>
<p>The CLIENT class provides the following functions to retrieve quickly the relevant CLIENT instance:</p>
<ul>
<li><a href="##(CLIENT).New">CLIENT.New</a>: Creates a new CLIENT object taking the name of the <strong>DCSUnit</strong> that is a client as defined within the mission editor.
</li>
<li><a href="##(CLIENT).Find">CLIENT.Find</a>(): Find a CLIENT instance from the _DATABASE object using a DCS Unit object.</li>
<li><a href="##(CLIENT).FindByName">CLIENT.FindByName</a>(): Find a CLIENT instance from the _DATABASE object using a DCS Unit name.</li>
</ul>
<p>IMPORTANT: ONE SHOULD NEVER SANATIZE these CLIENT OBJECT REFERENCES! (make the CLIENT object references nil).</p>
<h2>Global(s)</h2>
<table class="function_list">
<tr>
@@ -93,12 +130,6 @@ Note that clients are NOT the same as Units, they are NOT necessarily alive.</p>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).Alive">CLIENT:Alive(CallBack, ...)</a></td>
<td class="summary">
<p>Checks for a client alive event and calls a function on a continuous basis.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).AliveCheckScheduler">CLIENT.AliveCheckScheduler</a></td>
<td class="summary">
</td>
</tr>
<tr>
@@ -171,6 +202,18 @@ Note that clients are NOT the same as Units, they are NOT necessarily alive.</p>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).ClientTransport">CLIENT.ClientTransport</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).Find">CLIENT:Find(ClientName, ClientBriefing, DCSUnit)</a></td>
<td class="summary">
<p>Finds a CLIENT from the _DATABASE using the relevant DCS Unit.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).FindByName">CLIENT:FindByName(ClientName, ClientBriefing)</a></td>
<td class="summary">
<p>Finds a CLIENT from the _DATABASE using the relevant Client Unit Name.</p>
</td>
</tr>
<tr>
@@ -237,24 +280,12 @@ Note that clients are NOT the same as Units, they are NOT necessarily alive.</p>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).Message">CLIENT:Message(Message, MessageDuration, MessageId, MessageCategory, MessageInterval)</a></td>
<td class="summary">
<p>The main message driver for the CLIENT.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).MessageSwitch">CLIENT.MessageSwitch</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).Messages">CLIENT.Messages</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).New">CLIENT:New(ClientName, ClientBriefing)</a></td>
<td class="summary">
<p>Use this method to register new Clients within a mission.</p>
</td>
</tr>
<tr>
@@ -273,6 +304,12 @@ Note that clients are NOT the same as Units, they are NOT necessarily alive.</p>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).Reset">CLIENT:Reset(ClientName)</a></td>
<td class="summary">
<p>Resets a CLIENT.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).ShowBriefing">CLIENT:ShowBriefing()</a></td>
<td class="summary">
<p>Show the briefing of the MISSION to the CLIENT.</p>
</td>
</tr>
<tr>
@@ -357,8 +394,8 @@ is the text defining the Mission briefing.</p>
</ul>
<h3>Return value</h3>
<p><em><a href="##(CLIENT)">#CLIENT</a>:</em></p>
<p><em><a href="##(CLIENT)">#CLIENT</a>:</em>
self</p>
</dd>
</dl>
@@ -392,20 +429,6 @@ Function.</p>
<p><em><a href="##(CLIENT)">#CLIENT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(CLIENT).AliveCheckScheduler" >
<strong>CLIENT.AliveCheckScheduler</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
@@ -536,7 +559,6 @@ Function.</p>
<dl class="function">
<dt>
<em></em>
<a id="#(CLIENT).ClientName" >
<strong>CLIENT.ClientName</strong>
</a>
@@ -573,6 +595,100 @@ Function.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).Find" >
<strong>CLIENT:Find(ClientName, ClientBriefing, DCSUnit)</strong>
</a>
</dt>
<dd>
<p>Finds a CLIENT from the _DATABASE using the relevant DCS Unit.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string ClientName </em></code>:
Name of the DCS <strong>Unit</strong> as defined within the Mission Editor.</p>
</li>
<li>
<p><code><em>#string ClientBriefing </em></code>:
Text that describes the briefing of the mission when a Player logs into the Client.</p>
</li>
<li>
<p><code><em> DCSUnit </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(CLIENT)">#CLIENT</a>:</em></p>
<h3>Usage:</h3>
<pre class="example"><code>-- Create new Clients.
local Mission = MISSIONSCHEDULER.AddMission( 'Russia Transport Troops SA-6', 'Operational', 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', 'Russia' )
Mission:AddGoal( DeploySA6TroopsGoal )
Mission:AddClient( CLIENT:FindByName( 'RU MI-8MTV2*HOT-Deploy Troops 1' ):Transport() )
Mission:AddClient( CLIENT:FindByName( 'RU MI-8MTV2*RAMP-Deploy Troops 3' ):Transport() )
Mission:AddClient( CLIENT:FindByName( 'RU MI-8MTV2*HOT-Deploy Troops 2' ):Transport() )
Mission:AddClient( CLIENT:FindByName( 'RU MI-8MTV2*RAMP-Deploy Troops 4' ):Transport() )</code></pre>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).FindByName" >
<strong>CLIENT:FindByName(ClientName, ClientBriefing)</strong>
</a>
</dt>
<dd>
<p>Finds a CLIENT from the _DATABASE using the relevant Client Unit Name.</p>
<p>As an optional parameter, a briefing text can be given also.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string ClientName </em></code>:
Name of the DCS <strong>Unit</strong> as defined within the Mission Editor.</p>
</li>
<li>
<p><code><em>#string ClientBriefing </em></code>:
Text that describes the briefing of the mission when a Player logs into the Client.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(CLIENT)">#CLIENT</a>:</em></p>
<h3>Usage:</h3>
<pre class="example"><code>-- Create new Clients.
local Mission = MISSIONSCHEDULER.AddMission( 'Russia Transport Troops SA-6', 'Operational', 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', 'Russia' )
Mission:AddGoal( DeploySA6TroopsGoal )
Mission:AddClient( CLIENT:FindByName( 'RU MI-8MTV2*HOT-Deploy Troops 1' ):Transport() )
Mission:AddClient( CLIENT:FindByName( 'RU MI-8MTV2*RAMP-Deploy Troops 3' ):Transport() )
Mission:AddClient( CLIENT:FindByName( 'RU MI-8MTV2*HOT-Deploy Troops 2' ):Transport() )
Mission:AddClient( CLIENT:FindByName( 'RU MI-8MTV2*RAMP-Deploy Troops 4' ):Transport() )</code></pre>
</dd>
</dl>
<dl class="function">
@@ -794,20 +910,6 @@ is the interval in seconds between the display of the <a href="Message.html##(ME
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<em>#boolean</em>
<a id="#(CLIENT).MessageSwitch" >
<strong>CLIENT.MessageSwitch</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
@@ -822,49 +924,6 @@ is the interval in seconds between the display of the <a href="Message.html##(ME
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).New" >
<strong>CLIENT:New(ClientName, ClientBriefing)</strong>
</a>
</dt>
<dd>
<p>Use this method to register new Clients within a mission.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#string ClientName </em></code>:
Name of the DCS <strong>Unit</strong> as defined within the Mission Editor.</p>
</li>
<li>
<p><code><em>#string ClientBriefing </em></code>:
Text that describes the briefing of the mission when a Player logs into the Client.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(CLIENT)">#CLIENT</a>:</em></p>
<h3>Usage:</h3>
<pre class="example"><code>-- Create new Clients.
local Mission = MISSIONSCHEDULER.AddMission( 'Russia Transport Troops SA-6', 'Operational', 'Transport troops from the control center to one of the SA-6 SAM sites to activate their operation.', 'Russia' )
Mission:AddGoal( DeploySA6TroopsGoal )
Mission:AddClient( CLIENT:New( 'RU MI-8MTV2*HOT-Deploy Troops 1' ):Transport() )
Mission:AddClient( CLIENT:New( 'RU MI-8MTV2*RAMP-Deploy Troops 3' ):Transport() )
Mission:AddClient( CLIENT:New( 'RU MI-8MTV2*HOT-Deploy Troops 2' ):Transport() )
Mission:AddClient( CLIENT:New( 'RU MI-8MTV2*RAMP-Deploy Troops 4' ):Transport() )</code></pre>
</dd>
</dl>
<dl class="function">
@@ -927,6 +986,24 @@ Name of the Group as defined within the Mission Editor. The Group must have a Un
<dl class="function">
<dt>
<a id="#(CLIENT).ShowBriefing" >
<strong>CLIENT:ShowBriefing()</strong>
</a>
</dt>
<dd>
<p>Show the briefing of the MISSION to the CLIENT.</p>
<h3>Return value</h3>
<p><em><a href="##(CLIENT)">#CLIENT</a>:</em>
self</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).ShowCargo" >
<strong>CLIENT:ShowCargo()</strong>
</a>