mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Optimizations and register the database
This commit is contained in:
parent
b086ef50f7
commit
7e375c4895
26
Dcs/DCScountry.lua
Normal file
26
Dcs/DCScountry.lua
Normal file
@ -0,0 +1,26 @@
|
||||
-------------------------------------------------------------------------------
|
||||
-- @module DCScountry
|
||||
|
||||
--- @type country
|
||||
-- @field #country.id id
|
||||
|
||||
--- @type country.id
|
||||
-- @field RUSSIA
|
||||
-- @field UKRAINE
|
||||
-- @field USA
|
||||
-- @field TURKEY
|
||||
-- @field UK
|
||||
-- @field FRANCE
|
||||
-- @field GERMANY
|
||||
-- @field CANADA
|
||||
-- @field SPAIN
|
||||
-- @field THE_NETHERLANDS
|
||||
-- @field BELGIUM
|
||||
-- @field NORWAY
|
||||
-- @field DENMARK
|
||||
-- @field ISRAEL
|
||||
-- @field GEORGIA
|
||||
-- @field INSURGENTS
|
||||
-- @field ABKHAZIA
|
||||
-- @field SOUTH_OSETIA
|
||||
-- @field ITALY
|
||||
@ -1835,6 +1835,7 @@ self</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em></em>
|
||||
<a id="#(ESCORT).ReportTargetsScheduler" >
|
||||
<strong>ESCORT.ReportTargetsScheduler</strong>
|
||||
</a>
|
||||
|
||||
@ -90,9 +90,9 @@ It suports the following functionality:</p>
|
||||
<li><strong>Alerts</strong>: Menu to configure alert messages.
|
||||
<ul>
|
||||
<li><strong>To All</strong>: Shows alert messages to all players.</li>
|
||||
<li><strong>To Target</strong>: Shows alter messages only to the player where the missile is (was) targetted at.</li>
|
||||
<li><strong>To Target</strong>: Shows alert messages only to the player where the missile is (was) targetted at.</li>
|
||||
<li><strong>Hits On</strong>: Show missile hit alert messages.</li>
|
||||
<li><strong>Hits Off</strong>: Disable missile hit altert messages.</li>
|
||||
<li><strong>Hits Off</strong>: Disable missile hit alert messages.</li>
|
||||
<li><strong>Launches On</strong>: Show missile launch messages.</li>
|
||||
<li><strong>Launches Off</strong>: Disable missile launch messages.</li>
|
||||
</ul></li>
|
||||
|
||||
@ -112,42 +112,96 @@
|
||||
<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).GetCategoryName">UNIT:GetCategoryName()</a></td>
|
||||
<td class="summary">
|
||||
|
||||
<p>Returns the Unit's Category Name as defined within the Unit's Descriptor.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetCoalition">UNIT:GetCoalition()</a></td>
|
||||
<td class="summary">
|
||||
<p>Returns coalition of the Unit.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetCountry">UNIT:GetCountry()</a></td>
|
||||
<td class="summary">
|
||||
<p>Returns country of the Unit.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetDCSUnit">UNIT:GetDCSUnit()</a></td>
|
||||
<td class="summary">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetDesc">UNIT:GetDesc()</a></td>
|
||||
<td class="summary">
|
||||
<p>Returns unit descriptor.</p>
|
||||
</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).GetID">UNIT:GetID()</a></td>
|
||||
<td class="summary">
|
||||
|
||||
<p>Returns the unit's unique identifier.</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).GetName">UNIT:GetName()</a></td>
|
||||
<td class="summary">
|
||||
|
||||
<p>Returns unit object by the name assigned to the unit in Mission Editor.</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>
|
||||
@ -166,12 +220,46 @@
|
||||
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetPrefix">UNIT:GetPrefix()</a></td>
|
||||
<td class="summary">
|
||||
|
||||
</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).GetTypeName">UNIT:GetTypeName()</a></td>
|
||||
<td class="summary">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetVelocity">UNIT:GetVelocity()</a></td>
|
||||
<td class="summary">
|
||||
<p>Returns the unit's velocity vector.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(UNIT).InAir">UNIT:InAir()</a></td>
|
||||
<td class="summary">
|
||||
<p>Returns true if the Unit is in air.</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>
|
||||
@ -183,13 +271,19 @@
|
||||
<tr>
|
||||
<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).New">UNIT:New(DCSUnit)</a></td>
|
||||
<td class="summary">
|
||||
<p>Create a new UNIT from DCSUnit.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(UNIT).NewFromName">UNIT:NewFromName(Unit, UnitName)</a></td>
|
||||
<td class="summary">
|
||||
<p>Create a new UNIT from a Unit Name.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -439,6 +533,24 @@
|
||||
|
||||
<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 value</h3>
|
||||
|
||||
<p><em><a href="DCSUnit.html##(Unit.Ammo)">DCSUnit#Unit.Ammo</a>:</em></p>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
@ -450,7 +562,12 @@
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns the unit's callsign - the localized string.</p>
|
||||
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em>#string:</em>
|
||||
The Callsign of the Unit.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
@ -463,7 +580,48 @@
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns the Unit's Category Name as defined within the Unit's Descriptor.</p>
|
||||
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em>#string:</em>
|
||||
Unit's Category Name</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(UNIT).GetCoalition" >
|
||||
<strong>UNIT:GetCoalition()</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns coalition of the Unit.</p>
|
||||
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em><a href="DCSCoalitionObject.html##(coalition.side)">DCSCoalitionObject#coalition.side</a>:</em></p>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(UNIT).GetCountry" >
|
||||
<strong>UNIT:GetCountry()</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns country of the Unit.</p>
|
||||
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em><a href="DCScountry.html##(country.id)">DCScountry#country.id</a>:</em>
|
||||
The country identifyer.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
@ -478,6 +636,66 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(UNIT).GetDesc" >
|
||||
<strong>UNIT:GetDesc()</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns unit descriptor.</p>
|
||||
|
||||
|
||||
<p>Descriptor type depends on unit category.</p>
|
||||
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em><a href="DCSUnit.html##(Unit.Desc)">DCSUnit#Unit.Desc</a>:</em>
|
||||
The Unit descriptor.</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 value</h3>
|
||||
|
||||
<p><em>#number:</em>
|
||||
The relative amount of fuel (from 0.0 to 1.0).</p>
|
||||
|
||||
</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 value</h3>
|
||||
|
||||
<p><em><a href="Group.html##(GROUP)">Group#GROUP</a>:</em>
|
||||
The Group of the Unit.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
@ -489,7 +707,51 @@
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns the unit's unique identifier.</p>
|
||||
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em><a href="DCSUnit.html##(Unit.ID)">DCSUnit#Unit.ID</a>:</em>
|
||||
Unit ID</p>
|
||||
|
||||
</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 <= 1.0.</p>
|
||||
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em>#number:</em>
|
||||
The Unit's health value.</p>
|
||||
|
||||
</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 value</h3>
|
||||
|
||||
<p><em>#number:</em>
|
||||
The Unit's initial health value.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
@ -502,7 +764,35 @@
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns unit object by the name assigned to the unit in Mission Editor.</p>
|
||||
|
||||
|
||||
<p>If there is unit with such name or the unit is destroyed the function will return nil.
|
||||
The function provides access to non-activated units too.
|
||||
</p>
|
||||
|
||||
</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 value</h3>
|
||||
|
||||
<p><em>#number:</em>
|
||||
The Unit number. </p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
@ -515,7 +805,12 @@
|
||||
</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 value</h3>
|
||||
|
||||
<p><em>#string:</em>
|
||||
Player Name</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
@ -556,6 +851,61 @@
|
||||
|
||||
|
||||
|
||||
</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="DCSObject.html##(Object)">DCSObject#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>
|
||||
</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 value</h3>
|
||||
|
||||
<p><em><a href="DCSUnit.html##(Unit.Sensors)">DCSUnit#Unit.Sensors</a>:</em></p>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
@ -569,6 +919,60 @@
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(UNIT).GetVelocity" >
|
||||
<strong>UNIT:GetVelocity()</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns the unit's velocity vector.</p>
|
||||
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em><a href="DCSTypes.html##(Vec3)">DCSTypes#Vec3</a>:</em>
|
||||
Velocity Vector</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(UNIT).InAir" >
|
||||
<strong>UNIT:InAir()</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns true if the Unit is in air.</p>
|
||||
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em>#boolean:</em>
|
||||
true if in the air.</p>
|
||||
|
||||
</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 value</h3>
|
||||
|
||||
<p><em>#boolean:</em>
|
||||
true if Unit is activated.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
@ -601,7 +1005,12 @@ Air category evaluation result.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Returns if the unit is alive.</p>
|
||||
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em>#boolean:</em>
|
||||
true if Unit is alive.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
@ -629,6 +1038,38 @@ Air category evaluation result.</p>
|
||||
<p><em><a href="Unit.html##(UNIT)">Unit#UNIT</a>:</em></p>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<a id="#(UNIT).NewFromName" >
|
||||
<strong>UNIT:NewFromName(Unit, UnitName)</strong>
|
||||
</a>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Create a new UNIT from a Unit Name.</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<p><code><em>#string Unit </em></code>:
|
||||
Name</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p><code><em> UnitName </em></code>: </p>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Return value</h3>
|
||||
|
||||
<p><em><a href="Unit.html##(UNIT)">Unit#UNIT</a>:</em></p>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
|
||||
@ -161,6 +161,28 @@ function DATABASE:New()
|
||||
return self
|
||||
end
|
||||
|
||||
--- Finds a Unit based on the Unit Name.
|
||||
-- @param #DATABASE self
|
||||
-- @param #string UnitName
|
||||
-- @return Unit#UNIT The found Unit.
|
||||
function DATABASE:FindUnit( UnitName )
|
||||
|
||||
local UnitFound = self.Units[UnitName]
|
||||
return UnitFound
|
||||
end
|
||||
|
||||
--- Finds a Unit based on the Unit Name.
|
||||
-- @param #DATABASE self
|
||||
-- @param Unit#UNIT UnitToAdd
|
||||
-- @return Unit#UNIT The added Unit.
|
||||
function DATABASE:AddUnit( UnitToAdd )
|
||||
|
||||
self.Units[UnitToAdd.UnitName] = UnitToAdd
|
||||
return self.Units[UnitToAdd.UnitName]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Builds a set of units of coalitons.
|
||||
-- Possible current coalitions are red, blue and neutral.
|
||||
-- @param #DATABASE self
|
||||
@ -472,7 +494,8 @@ function DATABASE:_RegisterDatabase()
|
||||
self:E( { "Register Unit:", DCSUnit, DCSUnitName } )
|
||||
|
||||
self.DCSUnits[DCSUnitName] = DCSUnit
|
||||
self.Units[DCSUnitName] = UNIT:New( DCSUnit )
|
||||
self:AddUnit( UNIT:Register( DCSUnit ) )
|
||||
--self.Units[DCSUnitName] = UNIT:Register( DCSUnit )
|
||||
|
||||
if self:_IsAliveDCSUnit(DCSUnit) then
|
||||
self:E( { "Register Alive Unit:", DCSUnit, DCSUnitName } )
|
||||
@ -506,7 +529,8 @@ function DATABASE:_EventOnBirth( Event )
|
||||
if self:_IsIncludeDCSUnit( Event.IniDCSUnit ) then
|
||||
self.DCSUnits[Event.IniDCSUnitName] = Event.IniDCSUnit
|
||||
self.DCSUnitsAlive[Event.IniDCSUnitName] = Event.IniDCSUnit
|
||||
self.Units[Event.IniDCSUnitName] = UNIT:New( Event.IniDCSUnit )
|
||||
self:AddUnit( UNIT:Register( Event.IniDCSUnit ) )
|
||||
--self.Units[Event.IniDCSUnitName] = UNIT:Register( Event.IniDCSUnit )
|
||||
|
||||
--if not self.DCSGroups[Event.IniDCSGroupName] then
|
||||
-- self.DCSGroups[Event.IniDCSGroupName] = Event.IniDCSGroupName
|
||||
|
||||
@ -452,8 +452,8 @@ function MISSILETRAINER:_EventShot( Event )
|
||||
local Client = self.DBClients[TrainerTargetDCSUnitName]
|
||||
if Client then
|
||||
|
||||
local TrainerSourceUnit = UNIT:New(TrainerSourceDCSUnit)
|
||||
local TrainerTargetUnit = UNIT:New(TrainerTargetDCSUnit)
|
||||
local TrainerSourceUnit = UNIT:New( TrainerSourceDCSUnit )
|
||||
local TrainerTargetUnit = UNIT:New( TrainerTargetDCSUnit )
|
||||
|
||||
if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then
|
||||
|
||||
|
||||
107
Moose/Unit.lua
107
Moose/Unit.lua
@ -50,23 +50,44 @@ UNIT = {
|
||||
-- @field Blue
|
||||
|
||||
|
||||
--- Create a new UNIT from DCSUnit.
|
||||
--- Finds the Unit from the _DATABASE.
|
||||
-- @param #UNIT self
|
||||
-- @param DCSUnit#Unit DCSUnit
|
||||
-- @return Unit#UNIT
|
||||
function UNIT:New( DCSUnit )
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
self:F( DCSUnit )
|
||||
|
||||
if DCSUnit then
|
||||
self.UnitName = DCSUnit:getName()
|
||||
return self
|
||||
if DCSUnit then
|
||||
local UnitName = DCSUnit:getName()
|
||||
if _DATABASE then
|
||||
local UnitFound = _DATABASE:FindUnit( UnitName )
|
||||
if UnitFound then
|
||||
return UnitFound
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self.UnitName = nil
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Create a new UNIT from DCSUnit.
|
||||
-- @param #UNIT self
|
||||
-- @param DCSUnit#Unit DCSUnit
|
||||
-- @param Database#DATABASE Database
|
||||
-- @return Unit#UNIT
|
||||
function UNIT:Register( DCSUnit )
|
||||
|
||||
if DCSUnit then
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
self:F( DCSUnit )
|
||||
self.UnitName = DCSUnit:getName()
|
||||
return self
|
||||
end
|
||||
|
||||
self.UnitName = nil
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Create a new UNIT from a Unit Name.
|
||||
-- @param #UNIT self
|
||||
-- @param #string Unit Name
|
||||
@ -95,9 +116,9 @@ function UNIT:GetDCSUnit()
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns coalition of the object.
|
||||
--- Returns coalition of the Unit.
|
||||
-- @param Unit#UNIT self
|
||||
-- @return #DCSCoalitionObject#coalition.side
|
||||
-- @return DCSCoalitionObject#coalition.side
|
||||
function UNIT:GetCoalition()
|
||||
self:F( self.UnitName )
|
||||
|
||||
@ -110,9 +131,26 @@ function UNIT:GetCoalition()
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
end
|
||||
|
||||
--- Returns country of the Unit.
|
||||
-- @param Unit#UNIT self
|
||||
-- @return DCScountry#country.id The country identifyer.
|
||||
function UNIT:GetCountry()
|
||||
self:F( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitCountry = DCSUnit:getCountry()
|
||||
self:T( UnitCountry )
|
||||
return UnitCountry
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
--- Returns unit object by the name assigned to the unit in Mission Editor.
|
||||
-- If there is unit with such name or the unit is destroyed the function will return nil.
|
||||
-- The function provides access to non-activated units too.
|
||||
@ -420,6 +458,8 @@ end
|
||||
|
||||
|
||||
function UNIT:GetPositionVec3()
|
||||
self:F( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
|
||||
if DCSUnit then
|
||||
@ -431,6 +471,55 @@ function UNIT:GetPositionVec3()
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns the unit's velocity vector.
|
||||
-- @param Unit#UNIT self
|
||||
-- @return DCSTypes#Vec3 Velocity Vector
|
||||
function UNIT:GetVelocity()
|
||||
self:F( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitVelocityVec3 = DCSUnit:getVelocity()
|
||||
self:T( UnitVelocityVec3 )
|
||||
return UnitVelocityVec3
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns true if the Unit is in air.
|
||||
-- @param Unit#UNIT self
|
||||
-- @return #boolean true if in the air.
|
||||
function UNIT:InAir()
|
||||
self:F( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitInAir = DCSUnit:inAir()
|
||||
self:T( UnitInAir )
|
||||
return UnitInAir
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
function UNIT:GetPositionVec3()
|
||||
self:F( self.UnitName )
|
||||
|
||||
local DCSUnit = self:GetDCSUnit()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitPos = DCSUnit:getPosition().p
|
||||
self:T( UnitPos )
|
||||
return UnitPos
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
function UNIT:OtherUnitInRadius( AwaitUnit, Radius )
|
||||
self:F( { self.UnitName, AwaitUnit.UnitName, Radius } )
|
||||
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user