FlightControl 131d2dd4a4 AI_CAP Created
-- Documentation
-- Coding
-- Test Missions
-- Presentations
2017-01-16 12:25:21 +01:00

1541 lines
34 KiB
HTML
Raw Blame History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" href="stylesheet.css" type="text/css"/>
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div>
<div id="main">
<div id="navigation">
<h2>Modules</h2>
<ul><li>
<a href="index.html">index</a>
</li></ul>
<ul>
<li><a href="AI_Balancer.html">AI_Balancer</a></li>
<li><a href="AI_Cap.html">AI_Cap</a></li>
<li><a href="AI_Cas.html">AI_Cas</a></li>
<li><a href="AI_Patrol.html">AI_Patrol</a></li>
<li><a href="Account.html">Account</a></li>
<li><a href="Airbase.html">Airbase</a></li>
<li><a href="AirbasePolice.html">AirbasePolice</a></li>
<li><a href="Assign.html">Assign</a></li>
<li><a href="Base.html">Base</a></li>
<li><a href="Cargo.html">Cargo</a></li>
<li><a href="CleanUp.html">CleanUp</a></li>
<li><a href="Client.html">Client</a></li>
<li><a href="CommandCenter.html">CommandCenter</a></li>
<li><a href="Controllable.html">Controllable</a></li>
<li><a href="Database.html">Database</a></li>
<li><a href="Detection.html">Detection</a></li>
<li><a href="Escort.html">Escort</a></li>
<li><a href="Event.html">Event</a></li>
<li><a href="Fsm.html">Fsm</a></li>
<li><a href="Group.html">Group</a></li>
<li><a href="Identifiable.html">Identifiable</a></li>
<li><a href="MOVEMENT.html">MOVEMENT</a></li>
<li><a href="Menu.html">Menu</a></li>
<li><a href="Message.html">Message</a></li>
<li><a href="MissileTrainer.html">MissileTrainer</a></li>
<li><a href="Mission.html">Mission</a></li>
<li><a href="Object.html">Object</a></li>
<li><a href="Point.html">Point</a></li>
<li><a href="Positionable.html">Positionable</a></li>
<li><a href="Process_JTAC.html">Process_JTAC</a></li>
<li><a href="Process_Pickup.html">Process_Pickup</a></li>
<li><a href="Route.html">Route</a></li>
<li><a href="ScheduleDispatcher.html">ScheduleDispatcher</a></li>
<li><a href="Scheduler.html">Scheduler</a></li>
<li><a href="Scoring.html">Scoring</a></li>
<li><a href="Sead.html">Sead</a></li>
<li><a href="Set.html">Set</a></li>
<li><a href="Smoke.html">Smoke</a></li>
<li><a href="Spawn.html">Spawn</a></li>
<li><a href="Static.html">Static</a></li>
<li><a href="Task.html">Task</a></li>
<li><a href="Task_A2G.html">Task_A2G</a></li>
<li><a href="Task_PICKUP.html">Task_PICKUP</a></li>
<li><a href="Task_SEAD.html">Task_SEAD</a></li>
<li>Unit</li>
<li><a href="Utils.html">Utils</a></li>
<li><a href="Zone.html">Zone</a></li>
<li><a href="routines.html">routines</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Unit</code></h1>
<p>This module contains the UNIT class.</p>
<h1>1) <a href="##(UNIT)">#UNIT</a> class, extends <a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a></h1>
<p>The <a href="##(UNIT)">#UNIT</a> class is a wrapper class to handle the DCS Unit objects:</p>
<ul>
<li>Support all DCS Unit APIs.</li>
<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>
<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>
<p>The UNIT class <strong>does not contain a :New()</strong> method, rather it provides <strong>:Find()</strong> methods to retrieve the object reference
using the DCS Unit or the DCS UnitName.</p>
<p>Another thing to know is that UNIT objects do not "contain" the DCS Unit object.
The UNIT 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 UNIT methods will return nil and log an exception in the DCS.log file.</p>
<p>The UNIT class provides the following functions to retrieve quickly the relevant UNIT instance:</p>
<ul>
<li><a href="##(UNIT).Find">UNIT.Find</a>(): Find a UNIT instance from the _DATABASE object using a DCS Unit object.</li>
<li><a href="##(UNIT).FindByName">UNIT.FindByName</a>(): Find a UNIT instance from the _DATABASE object using a DCS Unit name.</li>
</ul>
<p>IMPORTANT: ONE SHOULD NEVER SANATIZE these UNIT OBJECT REFERENCES! (make the UNIT object references nil).</p>
<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="Dcs.DCSWrapper.Unit.html##(Unit).getName">Dcs.DCSWrapper.Unit#Unit.getName</a>()
is implemented in the UNIT class as <a href="##(UNIT).GetName">UNIT.GetName</a>().</p>
<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.
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>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).GetVec3">UNIT.GetVec3</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<72>ntation and direction vectors, consult the <a href="##(UNIT).GetPositionVec3">UNIT.GetPositionVec3</a>() method respectively.</p>
<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>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="Core.Zone.html##(ZONE_BASE)">Core.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>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="#UNIT">UNIT</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="#i">i</a></td>
<td class="summary">
</td>
</tr>
</table>
<h2><a id="#(UNIT)">Type <code>UNIT</code></a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).ClassName">UNIT.ClassName</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).Find">UNIT:Find(DCSUnit)</a></td>
<td class="summary">
<p>Finds a UNIT from the _DATABASE using a DCSUnit object.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).FindByName">UNIT:FindByName(UnitName)</a></td>
<td class="summary">
<p>Find a UNIT in the _DATABASE using the name of an existing DCS Unit.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).Flare">UNIT:Flare(FlareColor)</a></td>
<td class="summary">
<p>Signal a flare at the position of the UNIT.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).FlareGreen">UNIT:FlareGreen()</a></td>
<td class="summary">
<p>Signal a green flare at the position of the UNIT.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).FlareRed">UNIT:FlareRed()</a></td>
<td class="summary">
<p>Signal a red flare at the position of the UNIT.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).FlareWhite">UNIT:FlareWhite()</a></td>
<td class="summary">
<p>Signal a white flare at the position of the UNIT.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).FlareYellow">UNIT:FlareYellow()</a></td>
<td class="summary">
<p>Signal a yellow flare at the position of the UNIT.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetAmmo">UNIT:GetAmmo()</a></td>
<td class="summary">
<p>Returns the Unit's ammunition.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetCallsign">UNIT:GetCallsign()</a></td>
<td class="summary">
<p>Returns the Unit's callsign - the localized string.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetDCSObject">UNIT:GetDCSObject()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetFuel">UNIT:GetFuel()</a></td>
<td class="summary">
<p>Returns relative amount of fuel (from 0.0 to 1.0) the unit has in its internal tanks.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetGroup">UNIT:GetGroup()</a></td>
<td class="summary">
<p>Returns the unit's group if it exist and nil otherwise.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetLife">UNIT:GetLife()</a></td>
<td class="summary">
<p>Returns the unit's health.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetLife0">UNIT:GetLife0()</a></td>
<td class="summary">
<p>Returns the Unit's initial health.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetNumber">UNIT:GetNumber()</a></td>
<td class="summary">
<p>Returns the unit's number in the group.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetPlayerName">UNIT:GetPlayerName()</a></td>
<td class="summary">
<p>Returns name of the player that control the unit or nil if the unit is controlled by A.I.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetPrefix">UNIT:GetPrefix()</a></td>
<td class="summary">
<p>Returns the prefix name of the DCS Unit.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetRadar">UNIT:GetRadar()</a></td>
<td class="summary">
<p>Returns two values:</p>
<ul>
<li>First value indicates if at least one of the unit's radar(s) is on.</li>
</ul>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetSensors">UNIT:GetSensors()</a></td>
<td class="summary">
<p>Returns the unit sensors.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetThreatLevel">UNIT:GetThreatLevel()</a></td>
<td class="summary">
<p>Returns the Unit's A2G threat level on a scale from 1 to 10 ...</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetUnits">UNIT:GetUnits()</a></td>
<td class="summary">
<p>Returns the UNIT in a UNIT list of one element.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).HasSEAD">UNIT:HasSEAD()</a></td>
<td class="summary">
<p>Returns if the unit is SEADable.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).HasSensors">UNIT:HasSensors(...)</a></td>
<td class="summary">
<p>Returns if the unit has sensors of a certain type.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).IsActive">UNIT:IsActive()</a></td>
<td class="summary">
<p>Returns if the unit is activated.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).IsAir">UNIT:IsAir()</a></td>
<td class="summary">
<p>Returns if the unit is of an air category.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).IsFriendly">UNIT:IsFriendly(FriendlyCoalition)</a></td>
<td class="summary">
<p>Returns if the unit is a friendly unit.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).IsGround">UNIT:IsGround()</a></td>
<td class="summary">
<p>Returns if the unit is of an ground category.</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>
<td class="name" nowrap="nowrap"><a href="##(UNIT).IsShip">UNIT:IsShip()</a></td>
<td class="summary">
<p>Returns if the unit is of a ship category.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).Name">UNIT:Name()</a></td>
<td class="summary">
<p>Return the name of the UNIT.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).OtherUnitInRadius">UNIT:OtherUnitInRadius(AwaitUnit, Radius)</a></td>
<td class="summary">
<p>Returns true if there is an <strong>other</strong> DCS Unit within a radius of the current 2D point of the DCS Unit.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).ReSpawn">UNIT:ReSpawn(SpawnVec3, Heading)</a></td>
<td class="summary">
<p>Respawn the <a href="Unit.html">Unit</a> using a (tweaked) template of the parent Group.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).Register">UNIT:Register(UnitName)</a></td>
<td class="summary">
<p>Create a new UNIT from DCSUnit.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).Smoke">UNIT:Smoke(SmokeColor, Range)</a></td>
<td class="summary">
<p>Smoke the UNIT.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).SmokeBlue">UNIT:SmokeBlue()</a></td>
<td class="summary">
<p>Smoke the UNIT Blue.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).SmokeGreen">UNIT:SmokeGreen()</a></td>
<td class="summary">
<p>Smoke the UNIT Green.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).SmokeOrange">UNIT:SmokeOrange()</a></td>
<td class="summary">
<p>Smoke the UNIT Orange.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).SmokeRed">UNIT:SmokeRed()</a></td>
<td class="summary">
<p>Smoke the UNIT Red.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).SmokeWhite">UNIT:SmokeWhite()</a></td>
<td class="summary">
<p>Smoke the UNIT White.</p>
</td>
</tr>
</table>
<h2><a id="#(Unit.SensorType)">Type <code>Unit.SensorType</code></a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="##(Unit.SensorType).IRST">Unit.SensorType.IRST</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(Unit.SensorType).OPTIC">Unit.SensorType.OPTIC</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(Unit.SensorType).RADAR">Unit.SensorType.RADAR</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(Unit.SensorType).RWR">Unit.SensorType.RWR</a></td>
<td class="summary">
</td>
</tr>
</table>
<h2>Global(s)</h2>
<dl class="function">
<dt>
<em><a href="##(UNIT)">#UNIT</a></em>
<a id="UNIT" >
<strong>UNIT</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<em>#number</em>
<a id="i" >
<strong>i</strong>
</a>
</dt>
<dd>
<p> Remove obscolete units from the group structure</p>
</dd>
</dl>
<h2><a id="#(Unit)" >Type <code>Unit</code></a></h2>
<h2><a id="#(UNIT)" >Type <code>UNIT</code></a></h2>
<p>The UNIT class</p>
<h3>Field(s)</h3>
<dl class="function">
<dt>
<em>#string</em>
<a id="#(UNIT).ClassName" >
<strong>UNIT.ClassName</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).Find" >
<strong>UNIT:Find(DCSUnit)</strong>
</a>
</dt>
<dd>
<p>Finds a UNIT from the _DATABASE using a DCSUnit object.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Dcs.DCSWrapper.Unit.html##(Unit)">Dcs.DCSWrapper.Unit#Unit</a> DCSUnit </em></code>:
An existing DCS Unit object reference.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(UNIT)">#UNIT</a>:</em>
self</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).FindByName" >
<strong>UNIT:FindByName(UnitName)</strong>
</a>
</dt>
<dd>
<p>Find a UNIT in the _DATABASE using the name of an existing DCS Unit.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em>#string UnitName </em></code>:
The Unit Name.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(UNIT)">#UNIT</a>:</em>
self</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).Flare" >
<strong>UNIT:Flare(FlareColor)</strong>
</a>
</dt>
<dd>
<p>Signal a flare at the position of the UNIT.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Utilities.Utils.html##(FLARECOLOR)">Utilities.Utils#FLARECOLOR</a> FlareColor </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).FlareGreen" >
<strong>UNIT:FlareGreen()</strong>
</a>
</dt>
<dd>
<p>Signal a green flare at the position of the UNIT.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).FlareRed" >
<strong>UNIT:FlareRed()</strong>
</a>
</dt>
<dd>
<p>Signal a red flare at the position of the UNIT.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).FlareWhite" >
<strong>UNIT:FlareWhite()</strong>
</a>
</dt>
<dd>
<p>Signal a white flare at the position of the UNIT.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).FlareYellow" >
<strong>UNIT:FlareYellow()</strong>
</a>
</dt>
<dd>
<p>Signal a yellow flare at the position of the UNIT.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetAmmo" >
<strong>UNIT:GetAmmo()</strong>
</a>
</dt>
<dd>
<p>Returns the Unit's ammunition.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em><a href="Dcs.DCSWrapper.Unit.html##(Unit.Ammo)">Dcs.DCSWrapper.Unit#Unit.Ammo</a>:</em></p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetCallsign" >
<strong>UNIT:GetCallsign()</strong>
</a>
</dt>
<dd>
<p>Returns the Unit's callsign - the localized string.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em>#string:</em>
The Callsign of the Unit.</p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetDCSObject" >
<strong>UNIT:GetDCSObject()</strong>
</a>
</dt>
<dd>
<h3>Return value</h3>
<p><em><a href="Dcs.DCSWrapper.Unit.html##(Unit)">Dcs.DCSWrapper.Unit#Unit</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetFuel" >
<strong>UNIT:GetFuel()</strong>
</a>
</dt>
<dd>
<p>Returns relative amount of fuel (from 0.0 to 1.0) the unit has in its internal tanks.</p>
<p>If there are additional fuel tanks the value may be greater than 1.0.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em>#number:</em>
The relative amount of fuel (from 0.0 to 1.0).</p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetGroup" >
<strong>UNIT:GetGroup()</strong>
</a>
</dt>
<dd>
<p>Returns the unit's group if it exist and nil otherwise.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em><a href="Wrapper.Group.html##(GROUP)">Wrapper.Group#GROUP</a>:</em>
The Group of the Unit.</p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetLife" >
<strong>UNIT:GetLife()</strong>
</a>
</dt>
<dd>
<p>Returns the unit's health.</p>
<p>Dead units has health &lt;= 1.0.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em>#number:</em>
The Unit's health value.</p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetLife0" >
<strong>UNIT:GetLife0()</strong>
</a>
</dt>
<dd>
<p>Returns the Unit's initial health.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em>#number:</em>
The Unit's initial health value.</p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetNumber" >
<strong>UNIT:GetNumber()</strong>
</a>
</dt>
<dd>
<p>Returns the unit's number in the group.</p>
<p>The number is the same number the unit has in ME.
It may not be changed during the mission.
If any unit in the group is destroyed, the numbers of another units will not be changed.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em>#number:</em>
The Unit number. </p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetPlayerName" >
<strong>UNIT:GetPlayerName()</strong>
</a>
</dt>
<dd>
<p>Returns name of the player that control the unit or nil if the unit is controlled by A.I.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em>#string:</em>
Player Name</p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetPrefix" >
<strong>UNIT:GetPrefix()</strong>
</a>
</dt>
<dd>
<p>Returns the prefix name of the DCS Unit.</p>
<p>A prefix name is a part of the name before a '#'-sign.
DCS Units spawned with the <a href="SPAWN.html">SPAWN</a> class contain a '#'-sign to indicate the end of the (base) DCS Unit name.
The spawn sequence number and unit number are contained within the name after the '#' sign. </p>
<h3>Return values</h3>
<ol>
<li>
<p><em>#string:</em>
The name of the DCS Unit.</p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetRadar" >
<strong>UNIT:GetRadar()</strong>
</a>
</dt>
<dd>
<p>Returns two values:</p>
<ul>
<li>First value indicates if at least one of the unit's radar(s) is on.</li>
</ul>
<ul>
<li>Second value is the object of the radar's interest. Not nil only if at least one radar of the unit is tracking a target.</li>
</ul>
<h3>Return values</h3>
<ol>
<li>
<p><em>#boolean:</em>
Indicates if at least one of the unit's radar(s) is on.</p>
</li>
<li>
<p><em><a href="Dcs.DCSWrapper.Object.html##(Object)">Dcs.DCSWrapper.Object#Object</a>:</em>
The object of the radar's interest. Not nil only if at least one radar of the unit is tracking a target.</p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetSensors" >
<strong>UNIT:GetSensors()</strong>
</a>
</dt>
<dd>
<p>Returns the unit sensors.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em><a href="Dcs.DCSWrapper.Unit.html##(Unit.Sensors)">Dcs.DCSWrapper.Unit#Unit.Sensors</a>:</em></p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetThreatLevel" >
<strong>UNIT:GetThreatLevel()</strong>
</a>
</dt>
<dd>
<p>Returns the Unit's A2G threat level on a scale from 1 to 10 ...</p>
<p>The following threat levels are foreseen:</p>
<ul>
<li>Threat level 0: Unit is unarmed.</li>
<li>Threat level 1: Unit is infantry.</li>
<li>Threat level 2: Unit is an infantry vehicle.</li>
<li>Threat level 3: Unit is ground artillery.</li>
<li>Threat level 4: Unit is a tank.</li>
<li>Threat level 5: Unit is a modern tank or ifv with ATGM.</li>
<li>Threat level 6: Unit is a AAA.</li>
<li>Threat level 7: Unit is a SAM or manpad, IR guided.</li>
<li>Threat level 8: Unit is a Short Range SAM, radar guided.</li>
<li>Threat level 9: Unit is a Medium Range SAM, radar guided.</li>
<li>Threat level 10: Unit is a Long Range SAM, radar guided.</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetUnits" >
<strong>UNIT:GetUnits()</strong>
</a>
</dt>
<dd>
<p>Returns the UNIT in a UNIT list of one element.</p>
<h3>Return value</h3>
<p><em><a href="##(list)">#list</a>:</em>
Wrapper.Unit#UNIT> The UNITs wrappers.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).HasSEAD" >
<strong>UNIT:HasSEAD()</strong>
</a>
</dt>
<dd>
<p>Returns if the unit is SEADable.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em>#boolean:</em>
returns true if the unit is SEADable. </p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).HasSensors" >
<strong>UNIT:HasSensors(...)</strong>
</a>
</dt>
<dd>
<p>Returns if the unit has sensors of a certain type.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em> ... </em></code>: </p>
</li>
</ul>
<h3>Return values</h3>
<ol>
<li>
<p><em>#boolean:</em>
returns true if the unit has specified types of sensors. This function is more preferable than Unit.getSensors() if you don't want to get information about all the unit's sensors, and just want to check if the unit has specified types of sensors. </p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).IsActive" >
<strong>UNIT:IsActive()</strong>
</a>
</dt>
<dd>
<p>Returns if the unit is activated.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em>#boolean:</em>
true if Unit is activated.</p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).IsAir" >
<strong>UNIT:IsAir()</strong>
</a>
</dt>
<dd>
<p>Returns if the unit is of an air category.</p>
<p>If the unit is a helicopter or a plane, then this method will return true, otherwise false.</p>
<h3>Return value</h3>
<p><em>#boolean:</em>
Air category evaluation result.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).IsFriendly" >
<strong>UNIT:IsFriendly(FriendlyCoalition)</strong>
</a>
</dt>
<dd>
<p>Returns if the unit is a friendly unit.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em> FriendlyCoalition </em></code>: </p>
</li>
</ul>
<h3>Return value</h3>
<p><em>#boolean:</em>
IsFriendly evaluation result.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).IsGround" >
<strong>UNIT:IsGround()</strong>
</a>
</dt>
<dd>
<p>Returns if the unit is of an ground category.</p>
<p>If the unit is a ground vehicle or infantry, this method will return true, otherwise false.</p>
<h3>Return value</h3>
<p><em>#boolean:</em>
Ground category evaluation result.</p>
</dd>
</dl>
<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="Core.Zone.html##(ZONE_BASE)">Core.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="Core.Zone.html##(ZONE_BASE)">Core.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="Core.Zone.html##(ZONE_BASE)">Core.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="Core.Zone.html##(ZONE_BASE)">Core.Zone#ZONE_BASE</a></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).IsShip" >
<strong>UNIT:IsShip()</strong>
</a>
</dt>
<dd>
<p>Returns if the unit is of a ship category.</p>
<p>If the unit is a ship, this method will return true, otherwise false.</p>
<h3>Return value</h3>
<p><em>#boolean:</em>
Ship category evaluation result.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).Name" >
<strong>UNIT:Name()</strong>
</a>
</dt>
<dd>
<p>Return the name of the UNIT.</p>
<h3>Return value</h3>
<p><em>#string:</em>
The UNIT name.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).OtherUnitInRadius" >
<strong>UNIT:OtherUnitInRadius(AwaitUnit, Radius)</strong>
</a>
</dt>
<dd>
<p>Returns true if there is an <strong>other</strong> DCS Unit within a radius of the current 2D point of the DCS Unit.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="##(UNIT)">#UNIT</a> AwaitUnit </em></code>:
The other UNIT wrapper object.</p>
</li>
<li>
<p><code><em> Radius </em></code>:
The radius in meters with the DCS Unit in the centre.</p>
</li>
</ul>
<h3>Return values</h3>
<ol>
<li>
<p>true If the other DCS Unit is within the radius of the 2D point of the DCS Unit. </p>
</li>
<li>
<p><em>#nil:</em>
The DCS Unit is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).ReSpawn" >
<strong>UNIT:ReSpawn(SpawnVec3, Heading)</strong>
</a>
</dt>
<dd>
<p>Respawn the <a href="Unit.html">Unit</a> using a (tweaked) template of the parent Group.</p>
<p>This function will:</p>
<ul>
<li>Get the current position and heading of the group.</li>
<li>When the unit is alive, it will tweak the template x, y and heading coordinates of the group and the embedded units to the current units positions.</li>
<li>Then it will respawn the re-modelled group.
</li>
</ul>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Dcs.DCSTypes.html##(Vec3)">Dcs.DCSTypes#Vec3</a> SpawnVec3 </em></code>:
The position where to Spawn the new Unit at.</p>
</li>
<li>
<p><code><em>#number Heading </em></code>:
The heading of the unit respawn.</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).Register" >
<strong>UNIT:Register(UnitName)</strong>
</a>
</dt>
<dd>
<p>Create a new UNIT from DCSUnit.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em>#string UnitName </em></code>:
The name of the DCS unit.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(UNIT)">#UNIT</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).Smoke" >
<strong>UNIT:Smoke(SmokeColor, Range)</strong>
</a>
</dt>
<dd>
<p>Smoke the UNIT.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em> SmokeColor </em></code>: </p>
</li>
<li>
<p><code><em> Range </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).SmokeBlue" >
<strong>UNIT:SmokeBlue()</strong>
</a>
</dt>
<dd>
<p>Smoke the UNIT Blue.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).SmokeGreen" >
<strong>UNIT:SmokeGreen()</strong>
</a>
</dt>
<dd>
<p>Smoke the UNIT Green.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).SmokeOrange" >
<strong>UNIT:SmokeOrange()</strong>
</a>
</dt>
<dd>
<p>Smoke the UNIT Orange.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).SmokeRed" >
<strong>UNIT:SmokeRed()</strong>
</a>
</dt>
<dd>
<p>Smoke the UNIT Red.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).SmokeWhite" >
<strong>UNIT:SmokeWhite()</strong>
</a>
</dt>
<dd>
<p>Smoke the UNIT White.</p>
</dd>
</dl>
<h2><a id="#(Unit.SensorType)" >Type <code>Unit.SensorType</code></a></h2>
<p>Unit.SensorType</p>
<h3>Field(s)</h3>
<dl class="function">
<dt>
<a id="#(Unit.SensorType).IRST" >
<strong>Unit.SensorType.IRST</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(Unit.SensorType).OPTIC" >
<strong>Unit.SensorType.OPTIC</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(Unit.SensorType).RADAR" >
<strong>Unit.SensorType.RADAR</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(Unit.SensorType).RWR" >
<strong>Unit.SensorType.RWR</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<h2><a id="#(list)" >Type <code>list</code></a></h2>
</div>
</div>
</body>
</html>