mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Documentation + Zone functions
Implemented zone functions for GROUP and UNIT Documentation improvement for GROUP, UNIT, CLIENT.
This commit is contained in:
@@ -71,24 +71,22 @@
|
||||
<div id="content">
|
||||
<h1>Module <code>Unit</code></h1>
|
||||
|
||||
<p>UNIT Class</p>
|
||||
<p>This module contains the UNIT class.</p>
|
||||
|
||||
<h1><a href="UNIT.html">UNIT</a> class</h1>
|
||||
<p>The <a href="UNIT.html">UNIT</a> class is a wrapper class to handle the DCS Unit objects:</p>
|
||||
|
||||
|
||||
<h1>1) <a href="Unit.html##(UNIT)">Unit#UNIT</a> class, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
|
||||
<p>The <a href="Unit.html##(UNIT)">Unit#UNIT</a> class is a wrapper class to handle the DCS Unit objects:</p>
|
||||
|
||||
<ul>
|
||||
<li>Support all DCS Unit APIs.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<ul>
|
||||
<li>Enhance with Unit specific APIs not in the DCS Unit API set.</li>
|
||||
<li>Handle local Unit Controller.</li>
|
||||
<li>Manage the "state" of the DCS Unit.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h1>UNIT reference methods</h1>
|
||||
<h2>1.1) UNIT reference methods</h2>
|
||||
<p>For each DCS Unit object alive within a running mission, a UNIT 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), and dynamically when new DCS Unit objects are spawned (using the <a href="SPAWN.html">SPAWN</a> class).</p>
|
||||
|
||||
@@ -108,16 +106,13 @@ If the DCS Unit object does not exist or is nil, the UNIT methods will return ni
|
||||
|
||||
<p>IMPORTANT: ONE SHOULD NEVER SANATIZE these UNIT OBJECT REFERENCES! (make the UNIT object references nil).</p>
|
||||
|
||||
<h1>DCS UNIT APIs</h1>
|
||||
<h2>1.2) DCS UNIT APIs</h2>
|
||||
<p>The DCS Unit APIs are used extensively within MOOSE. The UNIT class has for each DCS Unit API a corresponding method.
|
||||
To be able to distinguish easily in your code the difference between a UNIT API call and a DCS Unit API call,
|
||||
the first letter of the method is also capitalized. So, by example, the DCS Unit method <a href="DCSUnit.html##(Unit).getName">DCSUnit#Unit.getName</a>()
|
||||
is implemented in the UNIT class as <a href="##(UNIT).GetName">UNIT.GetName</a>().</p>
|
||||
|
||||
<h1>Additional UNIT APIs</h1>
|
||||
<p>The UNIT class comes with additional methods. Find below a summary.</p>
|
||||
|
||||
<h2>Smoke, Flare Units</h2>
|
||||
<h2>1.3) Smoke, Flare Units</h2>
|
||||
<p>The UNIT class provides methods to smoke or flare units easily.
|
||||
The <a href="##(UNIT).SmokeBlue">UNIT.SmokeBlue</a>(), <a href="##(UNIT).SmokeGreen">UNIT.SmokeGreen</a>(),<a href="##(UNIT).SmokeOrange">UNIT.SmokeOrange</a>(), <a href="##(UNIT).SmokeRed">UNIT.SmokeRed</a>(), <a href="##(UNIT).SmokeRed">UNIT.SmokeRed</a>() methods
|
||||
will smoke the unit in the corresponding color. Note that smoking a unit is done at the current position of the DCS Unit.
|
||||
@@ -125,22 +120,22 @@ When the DCS Unit moves for whatever reason, the smoking will still continue!
|
||||
The <a href="##(UNIT).FlareGreen">UNIT.FlareGreen</a>(), <a href="##(UNIT).FlareRed">UNIT.FlareRed</a>(), <a href="##(UNIT).FlareWhite">UNIT.FlareWhite</a>(), <a href="##(UNIT).FlareYellow">UNIT.FlareYellow</a>()
|
||||
methods will fire off a flare in the air with the corresponding color. Note that a flare is a one-off shot and its effect is of very short duration.</p>
|
||||
|
||||
<h2>Position, Point</h2>
|
||||
<h2>1.4) Location Position, Point</h2>
|
||||
<p>The UNIT class provides methods to obtain the current point or position of the DCS Unit.
|
||||
The <a href="##(UNIT).GetPointVec2">UNIT.GetPointVec2</a>(), <a href="##(UNIT).GetPointVec3">UNIT.GetPointVec3</a>() will obtain the current location of the DCS Unit in a Vec2 (2D) or a Vec3 (3D) vector respectively.
|
||||
If you want to obtain the complete 3D position including oriëntation and direction vectors, consult the <a href="##(UNIT).GetPositionVec3">UNIT.GetPositionVec3</a>() method respectively.</p>
|
||||
The <a href="##(UNIT).GetPointVec2">UNIT.GetPointVec2</a>(), <a href="##(UNIT).GetPointVec3">UNIT.GetPointVec3</a>() will obtain the current <strong>location</strong> of the DCS Unit in a Vec2 (2D) or a <strong>point</strong> in a Vec3 (3D) vector respectively.
|
||||
If you want to obtain the complete <strong>3D position</strong> including oriëntation and direction vectors, consult the <a href="##(UNIT).GetPositionVec3">UNIT.GetPositionVec3</a>() method respectively.</p>
|
||||
|
||||
<h2>Alive</h2>
|
||||
<h2>1.5) Test if alive</h2>
|
||||
<p>The <a href="##(UNIT).IsAlive">UNIT.IsAlive</a>(), <a href="##(UNIT).IsActive">UNIT.IsActive</a>() methods determines if the DCS Unit is alive, meaning, it is existing and active.</p>
|
||||
|
||||
<h2>Test for other units in radius</h2>
|
||||
<p>One can test if another DCS Unit is within a given radius of the current DCS Unit, by using the <a href="##(UNIT).OtherUnitInRadius">UNIT.OtherUnitInRadius</a>() method.</p>
|
||||
|
||||
<h2>More functions will be added</h2>
|
||||
<p>During the MOOSE development, more functions will be added. A complete list of the current functions is below.</p>
|
||||
|
||||
<h2>1.6) Test for proximity</h2>
|
||||
<p>The UNIT class contains methods to test the location or proximity against zones or other objects.</p>
|
||||
|
||||
<h3>1.6.1) Zones</h3>
|
||||
<p>To test whether the Unit is within a <strong>zone</strong>, use the <a href="##(UNIT).IsInZone">UNIT.IsInZone</a>() or the <a href="##(UNIT).IsNotInZone">UNIT.IsNotInZone</a>() methods. Any zone can be tested on, but the zone must be derived from <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a>. </p>
|
||||
|
||||
<h3>1.6.2) Units</h3>
|
||||
<p>Test if another DCS Unit is within a given radius of the current DCS Unit, use the <a href="##(UNIT).OtherUnitInRadius">UNIT.OtherUnitInRadius</a>() method.</p>
|
||||
|
||||
|
||||
<h2>Global(s)</h2>
|
||||
@@ -384,6 +379,18 @@ If you want to obtain the complete 3D position including ori
|
||||
<td class="name" nowrap="nowrap"><a href="##(UNIT).IsAlive">UNIT:IsAlive()</a></td>
|
||||
<td class="summary">
|
||||
<p>Returns if the unit is alive.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(UNIT).IsInZone">UNIT:IsInZone(Zone)</a></td>
|
||||
<td class="summary">
|
||||
<p>Returns true if the unit is within a <a href="Zone.html">Zone</a>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(UNIT).IsNotInZone">UNIT:IsNotInZone(Zone)</a></td>
|
||||
<td class="summary">
|
||||
<p>Returns true if the unit is not within a <a href="Zone.html">Zone</a>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -1487,6 +1494,60 @@ The DCS Unit is not existing or alive. </p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(UNIT).IsInZone" >
|
||||
<strong>UNIT:IsInZone(Zone)</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns true if the unit is within a <a href="Zone.html">Zone</a>.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<p><code><em><a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a> Zone </em></code>:
|
||||
The zone to test.</p>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em>#boolean:</em>
|
||||
Returns true if the unit is within the <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a></p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(UNIT).IsNotInZone" >
|
||||
<strong>UNIT:IsNotInZone(Zone)</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns true if the unit is not within a <a href="Zone.html">Zone</a>.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<p><code><em><a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a> Zone </em></code>:
|
||||
The zone to test.</p>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em>#boolean:</em>
|
||||
Returns true if the unit is not within the <a href="Zone.html##(ZONE_BASE)">Zone#ZONE_BASE</a></p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(UNIT).OtherUnitInRadius" >
|
||||
<strong>UNIT:OtherUnitInRadius(AwaitUnit, Radius)</strong>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user