Merge remote-tracking branch 'refs/remotes/origin/master' into Bugfix

This commit is contained in:
FlightControl 2016-05-26 09:13:19 +02:00
commit 611741d7af
156 changed files with 27284 additions and 5869 deletions

View File

@ -1,2 +0,0 @@
-- @type ModelTime
-- @extends #number

View File

@ -1,894 +0,0 @@
<!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="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="DEPLOYTASK.html">DEPLOYTASK</a></li>
<li><a href="DESTROYBASETASK.html">DESTROYBASETASK</a></li>
<li><a href="DESTROYGROUPSTASK.html">DESTROYGROUPSTASK</a></li>
<li><a href="DESTROYRADARSTASK.html">DESTROYRADARSTASK</a></li>
<li><a href="DESTROYUNITTYPESTASK.html">DESTROYUNITTYPESTASK</a></li>
<li><a href="Database.html">Database</a></li>
<li><a href="Escort.html">Escort</a></li>
<li><a href="Event.html">Event</a></li>
<li><a href="GOHOMETASK.html">GOHOMETASK</a></li>
<li><a href="Group.html">Group</a></li>
<li><a href="MISSION.html">MISSION</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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="TASK.html">TASK</a></li>
<li>Unit</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>UNIT Classes</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>
</table>
<h2><a id="#(UNIT)">Type <code>UNIT</code></a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).CategoryName">UNIT.CategoryName</a></td>
<td class="summary">
</td>
</tr>
<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).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).FlareColor">UNIT.FlareColor</a></td>
<td class="summary">
</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).GetCallSign">UNIT:GetCallSign()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetCategoryName">UNIT:GetCategoryName()</a></td>
<td class="summary">
</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).GetID">UNIT:GetID()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetName">UNIT:GetName()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetPlayerName">UNIT:GetPlayerName()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetPointVec2">UNIT:GetPointVec2()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetPositionVec3">UNIT:GetPositionVec3()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<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).GetTypeName">UNIT:GetTypeName()</a></td>
<td class="summary">
</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).IsAlive">UNIT:IsAlive()</a></td>
<td class="summary">
</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).OtherUnitInRadius">UNIT:OtherUnitInRadius(AwaitUnit, Radius)</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).Smoke">UNIT:Smoke(SmokeColor)</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).SmokeColor">UNIT.SmokeColor</a></td>
<td class="summary">
</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.FlareColor)">Type <code>UNIT.FlareColor</code></a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT.FlareColor).Green">UNIT.FlareColor.Green</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT.FlareColor).Red">UNIT.FlareColor.Red</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT.FlareColor).White">UNIT.FlareColor.White</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT.FlareColor).Yellow">UNIT.FlareColor.Yellow</a></td>
<td class="summary">
</td>
</tr>
</table>
<h2><a id="#(UNIT.SmokeColor)">Type <code>UNIT.SmokeColor</code></a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT.SmokeColor).Blue">UNIT.SmokeColor.Blue</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT.SmokeColor).Green">UNIT.SmokeColor.Green</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT.SmokeColor).Orange">UNIT.SmokeColor.Orange</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT.SmokeColor).Red">UNIT.SmokeColor.Red</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT.SmokeColor).White">UNIT.SmokeColor.White</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>
<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></em>
<a id="#(UNIT).CategoryName" >
<strong>UNIT.CategoryName</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<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).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> FlareColor </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<em><a href="##(UNIT.FlareColor)">#UNIT.FlareColor</a></em>
<a id="#(UNIT).FlareColor" >
<strong>UNIT.FlareColor</strong>
</a>
</dt>
<dd>
</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).GetCallSign" >
<strong>UNIT:GetCallSign()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetCategoryName" >
<strong>UNIT:GetCategoryName()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetDCSUnit" >
<strong>UNIT:GetDCSUnit()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetID" >
<strong>UNIT:GetID()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetName" >
<strong>UNIT:GetName()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetPlayerName" >
<strong>UNIT:GetPlayerName()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetPointVec2" >
<strong>UNIT:GetPointVec2()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetPositionVec3" >
<strong>UNIT:GetPositionVec3()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetPrefix" >
<strong>UNIT:GetPrefix()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).GetTypeName" >
<strong>UNIT:GetTypeName()</strong>
</a>
</dt>
<dd>
</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).IsAlive" >
<strong>UNIT:IsAlive()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).New" >
<strong>UNIT:New(DCSUnit)</strong>
</a>
</dt>
<dd>
<p>Create a new UNIT from DCSUnit.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="DCSUnit.html##(Unit)">DCSUnit#Unit</a> DCSUnit </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">
<dt>
<a id="#(UNIT).OtherUnitInRadius" >
<strong>UNIT:OtherUnitInRadius(AwaitUnit, Radius)</strong>
</a>
</dt>
<dd>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em> AwaitUnit </em></code>: </p>
</li>
<li>
<p><code><em> Radius </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT).Smoke" >
<strong>UNIT:Smoke(SmokeColor)</strong>
</a>
</dt>
<dd>
<p>Smoke the UNIT.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em> SmokeColor </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>
<em><a href="##(UNIT.SmokeColor)">#UNIT.SmokeColor</a></em>
<a id="#(UNIT).SmokeColor" >
<strong>UNIT.SmokeColor</strong>
</a>
</dt>
<dd>
</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.FlareColor)" >Type <code>UNIT.FlareColor</code></a></h2>
<p>FlareColor</p>
<h3>Field(s)</h3>
<dl class="function">
<dt>
<a id="#(UNIT.FlareColor).Green" >
<strong>UNIT.FlareColor.Green</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT.FlareColor).Red" >
<strong>UNIT.FlareColor.Red</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT.FlareColor).White" >
<strong>UNIT.FlareColor.White</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT.FlareColor).Yellow" >
<strong>UNIT.FlareColor.Yellow</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<h2><a id="#(UNIT.SmokeColor)" >Type <code>UNIT.SmokeColor</code></a></h2>
<p>SmokeColor</p>
<h3>Field(s)</h3>
<dl class="function">
<dt>
<a id="#(UNIT.SmokeColor).Blue" >
<strong>UNIT.SmokeColor.Blue</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT.SmokeColor).Green" >
<strong>UNIT.SmokeColor.Green</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT.SmokeColor).Orange" >
<strong>UNIT.SmokeColor.Orange</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT.SmokeColor).Red" >
<strong>UNIT.SmokeColor.Red</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(UNIT.SmokeColor).White" >
<strong>UNIT.SmokeColor.White</strong>
</a>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
</body>
</html>

View File

@ -1,36 +0,0 @@
del Moose_Embedded.lua
echo env.info( 'Moose Embedded' ) > Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Routines.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Base.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Event.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Menu.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Group.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Unit.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Zone.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Client.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Database.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Moose.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Scheduler.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Scoring.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Cargo.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Message.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Stage.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Task.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\GoHomeTask.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\DestroyBaseTask.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\DestroyGroupsTask.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\DestroyRadarsTask.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\DestroyUnitTypesTask.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\PickupTask.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\DeployTask.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\NoTask.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\RouteTask.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Mission.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\CleanUp.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Spawn.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Movement.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Sead.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\Escort.lua Moose_Embedded.lua
copy /b Moose_Embedded.lua + ..\Moose\MissileTrainer.lua Moose_Embedded.lua

Binary file not shown.

Binary file not shown.

View File

@ -1,37 +0,0 @@
--Initialization script for the Mission lua Environment (SSE)
dofile('Scripts/ScriptingSystem.lua')
Include = {}
Include.LoadPath = 'Scripts/MOOSE'
Include.Files = {}
Include.File = function( IncludeFile )
if not Include.Files[ IncludeFile ] then
Include.Files[IncludeFile] = IncludeFile
dofile( Include.LoadPath .. "/" .. IncludeFile .. ".lua" )
env.info( "Include:" .. IncludeFile .. " loaded." )
end
end
Include.File( "Database" )
--Include.File( "StatHandler" )
--Sanitize Mission Scripting environment
--This makes unavailable some unsecure functions.
--Mission downloaded from server to client may contain potentialy harmful lua code that may use these functions.
--You can remove the code below and make availble these functions at your own risk.
local function sanitizeModule(name)
_G[name] = nil
package.loaded[name] = nil
end
do
--sanitizeModule('os')
--sanitizeModule('io')
sanitizeModule('lfs')
require = nil
loadlib = nil
end

View File

@ -37,10 +37,11 @@
-- @return #Group.Category
--TODO check coalition.side
--- Returns coalition of the group.
--- Returns the coalition of the group.
-- @function [parent=#Group] getCoalition
-- @param #Group self
-- @return #coalition.side
-- @return DCSCoalitionObject#coalition.side
--- Returns the group's name. This is the same name assigned to the group in Mission Editor.
-- @function [parent=#Group] getName

View File

@ -0,0 +1,8 @@
-------------------------------------------------------------------------------
-- @module DCSTime
--- @type ModelTime
-- @extends #number
--- @type Time
-- @extends #number

View 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

View File

@ -0,0 +1,8 @@
Include.File( "Group" )
Include.File( "Unit" )
local UnitAirPlaneAI = _DATABASE:FindUnit( "Airplane AI" )
UnitAirPlaneAI:FlareRed()

View File

@ -4,6 +4,8 @@
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Message" )
Include.File( "Scheduler" )
--- Clients are those Groups defined within the Mission Editor that have the skillset defined as "Client" or "Player".
-- These clients are defined within the Mission Orchestration Framework (MOF)
@ -146,7 +148,7 @@ function CARGO_ZONE:Signal()
if SignalUnit then
self:T( 'Signalling Unit' )
local SignalVehiclePos = SignalUnit:GetPositionVec3()
local SignalVehiclePos = SignalUnit:GetPointVec3()
SignalVehiclePos.y = SignalVehiclePos.y + 2
if self.SignalType.ID == CARGO_ZONE.SIGNAL.TYPE.SMOKE.ID then
@ -586,7 +588,7 @@ function CARGO_GROUP:IsNear( Client, LandingZone )
if self.CargoGroupName then
local CargoGroup = Group.getByName( self.CargoGroupName )
if routines.IsPartOfGroupInRadius( CargoGroup, Client:ClientPosition(), 250 ) then
if routines.IsPartOfGroupInRadius( CargoGroup, Client:GetPositionVec3(), 250 ) then
Near = true
end
end
@ -673,7 +675,8 @@ function CARGO_GROUP:OnBoard( Client, LandingZone, OnBoardSide )
end
self:T( "TransportCargoOnBoard: Routing " .. self.CargoGroupName )
routines.scheduleFunction( routines.goRoute, { self.CargoGroupName, Points}, timer.getTime() + 4 )
--routines.scheduleFunction( routines.goRoute, { self.CargoGroupName, Points}, timer.getTime() + 4 )
SCHEDULER:New( self, routines.goRoute, { self.CargoGroupName, Points}, 4 )
end
self:StatusLoading( Client )
@ -691,7 +694,7 @@ function CARGO_GROUP:OnBoarded( Client, LandingZone )
local CargoGroup = Group.getByName( self.CargoGroupName )
if not self.CargoInAir then
if routines.IsPartOfGroupInRadius( CargoGroup, Client:ClientPosition(), 25 ) then
if routines.IsPartOfGroupInRadius( CargoGroup, Client:GetPositionVec3(), 25 ) then
CargoGroup:destroy()
self:StatusLoaded( Client )
OnBoarded = true
@ -790,7 +793,7 @@ function CARGO_PACKAGE:IsNear( Client, LandingZone )
self:T( self.CargoClient.ClientName )
self:T( 'Client Exists.' )
if routines.IsUnitInRadius( self.CargoClient:GetClientGroupDCSUnit(), Client:ClientPosition(), 150 ) then
if routines.IsUnitInRadius( self.CargoClient:GetClientGroupDCSUnit(), Client:GetPositionVec3(), 150 ) then
Near = true
end
end
@ -884,7 +887,8 @@ function CARGO_PACKAGE:OnBoard( Client, LandingZone, OnBoardSide )
end
self:T( "Routing " .. CargoHostName )
routines.scheduleFunction( routines.goRoute, { CargoHostName, Points}, timer.getTime() + 4 )
--routines.scheduleFunction( routines.goRoute, { CargoHostName, Points}, timer.getTime() + 4 )
SCHEDULER:New( self, routines.goRoute, { CargoHostName, Points }, 4 )
return Valid
@ -897,7 +901,7 @@ function CARGO_PACKAGE:OnBoarded( Client, LandingZone )
local OnBoarded = false
if self.CargoClient and self.CargoClient:GetDCSGroup() then
if routines.IsUnitInRadius( self.CargoClient:GetClientGroupDCSUnit(), self.CargoClient:ClientPosition(), 10 ) then
if routines.IsUnitInRadius( self.CargoClient:GetClientGroupDCSUnit(), self.CargoClient:GetPositionVec3(), 10 ) then
-- Switch Cargo from self.CargoClient to Client ... Each cargo can have only one client. So assigning the new client for the cargo is enough.
self:StatusLoaded( Client )

View File

@ -43,7 +43,8 @@ function CLEANUP:New( ZoneNames, TimeInterval ) local self = BASE:Inherit( self,
_EVENTDISPATCHER:OnBirth( self._OnEventBirth, self )
self.CleanUpScheduler = routines.scheduleFunction( self._CleanUpScheduler, { self }, timer.getTime() + 1, TimeInterval )
--self.CleanUpScheduler = routines.scheduleFunction( self._CleanUpScheduler, { self }, timer.getTime() + 1, TimeInterval )
self.CleanUpScheduler = SCHEDULER:New( self, self._CleanUpScheduler, {}, 1, TimeInterval )
return self
end
@ -170,7 +171,8 @@ function CLEANUP:_EventShot( Event )
if ( CurrentLandingZoneID ) then
-- Okay, the missile was fired within the CLEANUP.ZoneNames, destroy the fired weapon.
--_SEADmissile:destroy()
routines.scheduleFunction( CLEANUP._DestroyMissile, { self, Event.Weapon }, timer.getTime() + 0.1)
--routines.scheduleFunction( CLEANUP._DestroyMissile, { self, Event.Weapon }, timer.getTime() + 0.1)
SCHEDULER:New( self, CLEANUP._DestroyMissile, { Event.Weapon }, 0.1 )
end
end
@ -186,7 +188,8 @@ function CLEANUP:_EventHitCleanUp( Event )
self:T( { "Life: ", Event.IniDCSUnitName, ' = ', Event.IniDCSUnit:getLife(), "/", Event.IniDCSUnit:getLife0() } )
if Event.IniDCSUnit:getLife() < Event.IniDCSUnit:getLife0() then
self:T( "CleanUp: Destroy: " .. Event.IniDCSUnitName )
routines.scheduleFunction( CLEANUP._DestroyUnit, { self, Event.IniDCSUnit }, timer.getTime() + 0.1)
--routines.scheduleFunction( CLEANUP._DestroyUnit, { self, Event.IniDCSUnit }, timer.getTime() + 0.1)
SCHEDULER:New( self, CLEANUP._DestroyUnit, { Event.IniDCSUnit }, 0.1 )
end
end
end
@ -196,7 +199,8 @@ function CLEANUP:_EventHitCleanUp( Event )
self:T( { "Life: ", Event.TgtDCSUnitName, ' = ', Event.TgtDCSUnit:getLife(), "/", Event.TgtDCSUnit:getLife0() } )
if Event.TgtDCSUnit:getLife() < Event.TgtDCSUnit:getLife0() then
self:T( "CleanUp: Destroy: " .. Event.TgtDCSUnitName )
routines.scheduleFunction( CLEANUP._DestroyUnit, { self, Event.TgtDCSUnit }, timer.getTime() + 0.1 )
--routines.scheduleFunction( CLEANUP._DestroyUnit, { self, Event.TgtDCSUnit }, timer.getTime() + 0.1 )
SCHEDULER:New( self, CLEANUP._DestroyUnit, { Event.TgtDCSUnit }, 0.1 )
end
end
end
@ -319,5 +323,7 @@ function CLEANUP:_CleanUpScheduler()
end
end
self:T(CleanUpCount)
return true
end

View File

@ -4,15 +4,36 @@
-- ================
-- Clients are those **Units** defined within the Mission Editor that have the skillset defined as __Client__ or __Player__.
-- Note that clients are NOT the same as Units, they are NOT necessarily alive.
-- The @{CLIENT} class is a wrapper class to handle the DCS Unit objects that have the skillset defined as __Client__ or __Player__:
--
-- * Wraps the DCS Unit objects with skill level set to Player or Client.
-- * Support all DCS Unit APIs.
-- * Enhance with Unit specific APIs not in the DCS Group API set.
-- * When player joins Unit, execute alive init logic.
-- * Handles messages to players.
-- * Manage the "state" of the DCS Unit.
--
-- Clients are being used by the @{MISSION} class to follow players and register their successes.
--
-- CLIENT construction methods:
-- ============================
-- Create a new CLIENT object with the @{#CLIENT.New} method:
--
-- * @{#CLIENT.New}: Creates a new CLIENT object taking the name of the **DCSUnit** that is a client as defined within the mission editor.
--
-- CLIENT reference methods
-- =======================
-- For each DCS Unit having skill level Player or Client, a CLIENT wrapper object (instance) will be created within the _@{DATABASE} object.
-- This is done at the beginning of the mission (when the mission starts).
--
-- 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.
--
-- 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.
--
-- The CLIENT class provides the following functions to retrieve quickly the relevant CLIENT instance:
--
-- * @{#CLIENT.Find}(): Find a CLIENT instance from the _DATABASE object using a DCS Unit object.
-- * @{#CLIENT.FindByName}(): Find a CLIENT instance from the _DATABASE object using a DCS Unit name.
--
-- IMPORTANT: ONE SHOULD NEVER SANATIZE these CLIENT OBJECT REFERENCES! (make the CLIENT object references nil).
--
-- @module Client
-- @author FlightControl
@ -24,7 +45,7 @@ Include.File( "Message" )
--- The CLIENT class
-- @type CLIENT
-- @extends Base#BASE
-- @extends Unit#UNIT
CLIENT = {
ONBOARDSIDE = {
NONE = 0,
@ -45,7 +66,35 @@ CLIENT = {
}
--- Use this method to register new Clients within a mission.
--- Finds a CLIENT from the _DATABASE using the relevant DCS Unit.
-- @param #CLIENT self
-- @param #string ClientName Name of the DCS **Unit** as defined within the Mission Editor.
-- @param #string ClientBriefing Text that describes the briefing of the mission when a Player logs into the Client.
-- @return #CLIENT
-- @usage
-- -- 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() )
function CLIENT:Find( DCSUnit )
local ClientName = DCSUnit:getName()
local ClientFound = _DATABASE:FindClient( ClientName )
if ClientFound then
ClientFound:F( ClientName )
return ClientFound
end
error( "CLIENT not found for: " .. ClientName )
end
--- Finds a CLIENT from the _DATABASE using the relevant Client Unit Name.
-- As an optional parameter, a briefing text can be given also.
-- @param #CLIENT self
-- @param #string ClientName Name of the DCS **Unit** as defined within the Mission Editor.
-- @param #string ClientBriefing Text that describes the briefing of the mission when a Player logs into the Client.
@ -55,21 +104,39 @@ CLIENT = {
-- 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() )
function CLIENT:New( ClientName, ClientBriefing )
local self = BASE:Inherit( self, BASE:New() )
self:F( ClientName, ClientBriefing )
-- 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() )
function CLIENT:FindByName( ClientName, ClientBriefing )
local ClientFound = _DATABASE:FindClient( ClientName )
self.ClientName = ClientName
self:AddBriefing( ClientBriefing )
self.MessageSwitch = true
return self
if ClientFound then
ClientFound:F( { ClientName, ClientBriefing } )
ClientFound:AddBriefing( ClientBriefing )
ClientFound.MessageSwitch = true
return ClientFound
end
error( "CLIENT not found for: " .. ClientName )
end
function CLIENT:Register( ClientName )
local self = BASE:Inherit( self, UNIT:Register( ClientName ) )
self:F( ClientName )
self.ClientName = ClientName
self.MessageSwitch = true
self.ClientAlive2 = false
--self.AliveCheckScheduler = routines.scheduleFunction( self._AliveCheckScheduler, { self }, timer.getTime() + 1, 5 )
self.AliveCheckScheduler = SCHEDULER:New( self, self._AliveCheckScheduler, {}, 1, 5 )
return self
end
--- Transport defines that the Client is a Transport. Transports show cargo.
-- @param #CLIENT self
-- @return #CLIENT
@ -83,13 +150,38 @@ end
--- AddBriefing adds a briefing to a CLIENT when a player joins a mission.
-- @param #CLIENT self
-- @param #string ClientBriefing is the text defining the Mission briefing.
-- @return #CLIENT
-- @return #CLIENT self
function CLIENT:AddBriefing( ClientBriefing )
self:F()
self:F( ClientBriefing )
self.ClientBriefing = ClientBriefing
self.ClientBriefingShown = false
return self
end
--- Show the briefing of the MISSION to the CLIENT.
-- @param #CLIENT self
-- @return #CLIENT self
function CLIENT:ShowBriefing()
self:F( { self.ClientName, self.ClientBriefingShown } )
if not self.ClientBriefingShown then
self.ClientBriefingShown = true
local Briefing = ""
if self.MissionBriefing then
Briefing = Briefing .. self.MissionBriefing
end
if self.ClientBriefing then
Briefing = Briefing .. "\n" .. self.ClientBriefing
end
Briefing = Briefing .. "\nPress [LEFT ALT]+[B] to view the complete mission briefing."
self:Message( Briefing, 30, self.ClientName .. '/MissionBriefing', "Briefing" )
end
return self
end
--- Resets a CLIENT.
-- @param #CLIENT self
@ -99,21 +191,6 @@ function CLIENT:Reset( ClientName )
self._Menus = {}
end
--- Checks for a client alive event and calls a function on a continuous basis.
-- @param #CLIENT self
-- @param #function CallBack Function.
-- @return #CLIENT
function CLIENT:Alive( CallBack, ... )
self:F()
self.ClientAlive2 = false
self.ClientCallBack = CallBack
self.ClientParameters = arg
self.AliveCheckScheduler = routines.scheduleFunction( self._AliveCheckScheduler, { self }, timer.getTime() + 1, 5 )
return self
end
-- Is Functions
--- Checks if the CLIENT is a multi-seated UNIT.
@ -138,32 +215,30 @@ function CLIENT:IsMultiSeated()
return false
end
--- Checks if client is alive and returns true or false.
--- Checks for a client alive event and calls a function on a continuous basis.
-- @param #CLIENT self
-- @returns #boolean Returns true if client is alive.
function CLIENT:IsAlive()
self:F( self.ClientName )
-- @param #function CallBack Function.
-- @return #CLIENT
function CLIENT:Alive( CallBack, ... )
self:F()
local ClientUnit = Unit.getByName( self.ClientName )
if ClientUnit and ClientUnit:isExist() then
self:T("true")
return true
end
self:T( "false" )
return false
end
self.ClientCallBack = CallBack
self.ClientParameters = arg
return self
end
--- @param #CLIENT self
function CLIENT:_AliveCheckScheduler()
self:F( { self.ClientName, self.ClientAlive2 } )
self:F( { self.ClientName, self.ClientAlive2, self.ClientBriefingShown } )
if self:IsAlive() then
if self:IsAlive() then -- Polymorphic call of UNIT
if self.ClientAlive2 == false then
self:T("Calling Callback function")
self.ClientCallBack( self, unpack( self.ClientParameters ) )
self:ShowBriefing()
if self.ClientCallBack then
self:T("Calling Callback function")
self.ClientCallBack( self, unpack( self.ClientParameters ) )
end
self.ClientAlive2 = true
end
else
@ -171,6 +246,8 @@ function CLIENT:_AliveCheckScheduler()
self.ClientAlive2 = false
end
end
return true
end
--- Return the DCSGroup of a Client.
@ -284,7 +361,7 @@ function CLIENT:GetClientGroupUnit()
self:T( self.ClientDCSUnit )
if ClientDCSUnit and ClientDCSUnit:isExist() then
local ClientUnit = _DATABASE.Units[ self.ClientName ]
local ClientUnit = _DATABASE:FindUnit( self.ClientName )
self:T2( ClientUnit )
return ClientUnit
end
@ -304,109 +381,6 @@ function CLIENT:GetClientGroupDCSUnit()
end
end
-- TODO what is this??? check. possible double function.
function CLIENT:GetUnit()
self:F()
return UNIT:New( self:GetClientGroupDCSUnit() )
end
--- Returns the position of the CLIENT in @{DCSTypes#Vec2} format..
-- @param #CLIENT self
-- @return DCSTypes#Vec2
function CLIENT:GetPointVec2()
self:F()
local ClientGroupUnit = self:GetClientGroupDCSUnit()
if ClientGroupUnit then
if ClientGroupUnit:isExist() then
local PointVec3 = ClientGroupUnit:getPoint() --DCSTypes#Vec3
local PointVec2 = {} --DCSTypes#Vec2
PointVec2.x = PointVec3.x
PointVec2.y = PointVec3.z
self:T( { PointVec2 } )
return PointVec2
end
end
return nil
end
function CLIENT:GetPositionVec3()
self:F( self.ClientName )
local DCSUnit = Unit.getByName( self.ClientName )
local UnitPos = DCSUnit:getPosition().p
self:T( UnitPos )
return UnitPos
end
function CLIENT:GetID()
self:F( self.ClientName )
local DCSUnit = Unit.getByName( self.ClientName )
local UnitID = DCSUnit:getID()
self:T( UnitID )
return UnitID
end
function CLIENT:GetName()
self:F( self.ClientName )
self:T( self.ClientName )
return self.ClientName
end
function CLIENT:GetTypeName()
self:F( self.ClientName )
local DCSUnit = Unit.getByName( self.ClientName )
local TypeName = DCSUnit:getTypeName()
self:T( TypeName )
return TypeName
end
--- Returns the position of the CLIENT in @{DCSTypes#Vec3} format.
-- @param #CLIENT self
-- @return DCSTypes#Vec3
function CLIENT:ClientPosition()
self:F()
local ClientGroupUnit = self:GetClientGroupDCSUnit()
if ClientGroupUnit then
if ClientGroupUnit:isExist() then
return ClientGroupUnit:getPosition()
end
end
return nil
end
--- Returns the altitude of the CLIENT.
-- @param #CLIENT self
-- @return DCSTypes#Distance
function CLIENT:GetAltitude()
self:F()
local ClientGroupUnit = self:GetClientGroupDCSUnit()
if ClientGroupUnit then
if ClientGroupUnit:isExist() then
local PointVec3 = ClientGroupUnit:getPoint() --DCSTypes#Vec3
return PointVec3.y
end
end
return nil
end
--- Evaluates if the CLIENT is a transport.
-- @param #CLIENT self
@ -453,7 +427,7 @@ end
-- @param #string MessageCategory is the category of the message (the title).
-- @param #number MessageInterval is the interval in seconds between the display of the @{Message#MESSAGE} when the CLIENT is in the air.
function CLIENT:Message( Message, MessageDuration, MessageId, MessageCategory, MessageInterval )
self:F()
self:F( { Message, MessageDuration, MessageId, MessageCategory, MessageInterval } )
if not self.MenuMessages then
if self:GetClientGroupID() then

View File

@ -82,18 +82,14 @@ DATABASE = {
ClientsByID = {},
},
DCSUnits = {},
DCSUnitsAlive = {},
DCSGroups = {},
DCSGroupsAlive = {},
Units = {},
UnitsAlive = {},
Groups = {},
GroupsAlive = {},
UNITS = {},
GROUPS = {},
NavPoints = {},
Statics = {},
Players = {},
PlayersAlive = {},
Clients = {},
CLIENTS = {},
ClientsAlive = {},
Filter = {
Coalitions = nil,
@ -161,168 +157,67 @@ function DATABASE:New()
return self
end
--- Builds a set of units of coalitons.
-- Possible current coalitions are red, blue and neutral.
--- Finds a Unit based on the Unit Name.
-- @param #DATABASE self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral".
-- @return #DATABASE self
function DATABASE:FilterCoalitions( Coalitions )
if not self.Filter.Coalitions then
self.Filter.Coalitions = {}
end
if type( Coalitions ) ~= "table" then
Coalitions = { Coalitions }
end
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
-- @param #string UnitName
-- @return Unit#UNIT The found Unit.
function DATABASE:FindUnit( UnitName )
local UnitFound = self.UNITS[UnitName]
return UnitFound
end
--- Builds a set of units out of categories.
-- Possible current categories are plane, helicopter, ground, ship.
--- Adds a Unit based on the Unit Name in the DATABASE.
-- @param #DATABASE self
-- @param #string Categories Can take the following values: "plane", "helicopter", "ground", "ship".
-- @return #DATABASE self
function DATABASE:FilterCategories( Categories )
if not self.Filter.Categories then
self.Filter.Categories = {}
end
if type( Categories ) ~= "table" then
Categories = { Categories }
end
for CategoryID, Category in pairs( Categories ) do
self.Filter.Categories[Category] = Category
end
return self
function DATABASE:AddUnit( DCSUnit, DCSUnitName )
self.DCSUnits[DCSUnitName] = DCSUnit
self.UNITS[DCSUnitName] = UNIT:Register( DCSUnitName )
end
--- Builds a set of units of defined unit types.
-- Possible current types are those types known within DCS world.
--- Deletes a Unit from the DATABASE based on the Unit Name.
-- @param #DATABASE self
-- @param #string Types Can take those type strings known within DCS world.
-- @return #DATABASE self
function DATABASE:FilterTypes( Types )
if not self.Filter.Types then
self.Filter.Types = {}
end
if type( Types ) ~= "table" then
Types = { Types }
end
for TypeID, Type in pairs( Types ) do
self.Filter.Types[Type] = Type
end
return self
function DATABASE:DeleteUnit( DCSUnitName )
self.DCSUnits[DCSUnitName] = nil
end
--- Builds a set of units of defined countries.
-- Possible current countries are those known within DCS world.
--- Finds a CLIENT based on the ClientName.
-- @param #DATABASE self
-- @param #string Countries Can take those country strings known within DCS world.
-- @return #DATABASE self
function DATABASE:FilterCountries( Countries )
if not self.Filter.Countries then
self.Filter.Countries = {}
end
if type( Countries ) ~= "table" then
Countries = { Countries }
end
for CountryID, Country in pairs( Countries ) do
self.Filter.Countries[Country] = Country
end
return self
-- @param #string ClientName
-- @return Client#CLIENT The found CLIENT.
function DATABASE:FindClient( ClientName )
local ClientFound = self.CLIENTS[ClientName]
return ClientFound
end
--- Builds a set of units of defined unit prefixes.
-- All the units starting with the given prefixes will be included within the set.
--- Adds a CLIENT based on the ClientName in the DATABASE.
-- @param #DATABASE self
-- @param #string Prefixes The prefix of which the unit name starts with.
-- @return #DATABASE self
function DATABASE:FilterUnitPrefixes( Prefixes )
if not self.Filter.UnitPrefixes then
self.Filter.UnitPrefixes = {}
end
if type( Prefixes ) ~= "table" then
Prefixes = { Prefixes }
end
for PrefixID, Prefix in pairs( Prefixes ) do
self.Filter.UnitPrefixes[Prefix] = Prefix
end
return self
function DATABASE:AddClient( ClientName )
self.CLIENTS[ClientName] = CLIENT:Register( ClientName )
self:E( self.CLIENTS[ClientName]:GetClassNameAndID() )
end
--- Builds a set of units of defined group prefixes.
-- All the units starting with the given group prefixes will be included within the set.
--- Finds a GROUP based on the GroupName.
-- @param #DATABASE self
-- @param #string Prefixes The prefix of which the group name where the unit belongs to starts with.
-- @return #DATABASE self
function DATABASE:FilterGroupPrefixes( Prefixes )
if not self.Filter.GroupPrefixes then
self.Filter.GroupPrefixes = {}
end
if type( Prefixes ) ~= "table" then
Prefixes = { Prefixes }
end
for PrefixID, Prefix in pairs( Prefixes ) do
self.Filter.GroupPrefixes[Prefix] = Prefix
end
return self
-- @param #string GroupName
-- @return Group#GROUP The found GROUP.
function DATABASE:FindGroup( GroupName )
local GroupFound = self.GROUPS[GroupName]
return GroupFound
end
--- Starts the filtering.
--- Adds a GROUP based on the GroupName in the DATABASE.
-- @param #DATABASE self
-- @return #DATABASE self
function DATABASE:FilterStart()
function DATABASE:AddGroup( DCSGroup, GroupName )
if _DATABASE then
-- OK, we have a _DATABASE
-- Now use the different filters to build the set.
-- We first take ALL of the Units of the _DATABASE.
self:E( { "Adding Database Datapoints with filters" } )
for DCSUnitName, DCSUnit in pairs( _DATABASE.DCSUnits ) do
if self:_IsIncludeDCSUnit( DCSUnit ) then
self:E( { "Adding Unit:", DCSUnitName } )
self.DCSUnits[DCSUnitName] = _DATABASE.DCSUnits[DCSUnitName]
self.Units[DCSUnitName] = _DATABASE.Units[DCSUnitName]
if _DATABASE.DCSUnitsAlive[DCSUnitName] then
self.DCSUnitsAlive[DCSUnitName] = _DATABASE.DCSUnitsAlive[DCSUnitName]
self.UnitsAlive[DCSUnitName] = _DATABASE.UnitsAlive[DCSUnitName]
end
end
end
for DCSGroupName, DCSGroup in pairs( _DATABASE.DCSGroups ) do
--if self:_IsIncludeDCSGroup( DCSGroup ) then
self:E( { "Adding Group:", DCSGroupName } )
self.DCSGroups[DCSGroupName] = _DATABASE.DCSGroups[DCSGroupName]
self.Groups[DCSGroupName] = _DATABASE.Groups[DCSGroupName]
--end
if _DATABASE.DCSGroupsAlive[DCSGroupName] then
self.DCSGroupsAlive[DCSGroupName] = _DATABASE.DCSGroupsAlive[DCSGroupName]
self.GroupsAlive[DCSGroupName] = _DATABASE.GroupsAlive[DCSGroupName]
end
end
for DCSUnitName, Client in pairs( _DATABASE.Clients ) do
self:E( { "Adding Client for Unit:", DCSUnitName } )
self.Clients[DCSUnitName] = _DATABASE.Clients[DCSUnitName]
end
else
self:E( "There is a structural error in MOOSE. No _DATABASE has been defined! Cannot build this custom DATABASE." )
end
return self
self.DCSGroups[GroupName] = DCSGroup
self.GROUPS[GroupName] = GROUP:Register( GroupName )
end
--- Instantiate new Groups within the DCSRTE.
-- This method expects EXACTLY the same structure as a structure within the ME, and needs 2 additional fields defined:
-- SpawnCountryID, SpawnCategoryID
@ -354,7 +249,7 @@ function DATABASE:Spawn( SpawnTemplate )
SpawnTemplate.SpawnCategoryID = SpawnCategoryID
local SpawnGroup = GROUP:New( Group.getByName( SpawnTemplate.name ) )
local SpawnGroup = GROUP:Register( SpawnTemplate.name )
return SpawnGroup
end
@ -449,7 +344,7 @@ end
-- @return #DATABASE self
function DATABASE:_RegisterDatabase()
local CoalitionsData = { AlivePlayersRed = coalition.getGroups( coalition.side.RED ), AlivePlayersBlue = coalition.getGroups( coalition.side.BLUE ) }
local CoalitionsData = { GroupsRed = coalition.getGroups( coalition.side.RED ), GroupsBlue = coalition.getGroups( coalition.side.BLUE ) }
for CoalitionId, CoalitionData in pairs( CoalitionsData ) do
for DCSGroupId, DCSGroup in pairs( CoalitionData ) do
@ -457,43 +352,29 @@ function DATABASE:_RegisterDatabase()
local DCSGroupName = DCSGroup:getName()
self:E( { "Register Group:", DCSGroup, DCSGroupName } )
self.DCSGroups[DCSGroupName] = DCSGroup
self.Groups[DCSGroupName] = GROUP:New( DCSGroup )
if self:_IsAliveDCSGroup(DCSGroup) then
self:E( { "Register Alive Group:", DCSGroup, DCSGroupName } )
self.DCSGroupsAlive[DCSGroupName] = DCSGroup
self.GroupsAlive[DCSGroupName] = self.Groups[DCSGroupName]
end
self:AddGroup( DCSGroup, DCSGroupName )
for DCSUnitId, DCSUnit in pairs( DCSGroup:getUnits() ) do
local DCSUnitName = DCSUnit:getName()
self:E( { "Register Unit:", DCSUnit, DCSUnitName } )
self.DCSUnits[DCSUnitName] = DCSUnit
self.Units[DCSUnitName] = UNIT:New( DCSUnit )
if self:_IsAliveDCSUnit(DCSUnit) then
self:E( { "Register Alive Unit:", DCSUnit, DCSUnitName } )
self.DCSUnitsAlive[DCSUnitName] = DCSUnit
self.UnitsAlive[DCSUnitName] = self.Units[DCSUnitName]
end
self:AddUnit( DCSUnit, DCSUnitName )
end
else
self:E( "Group does not exist: " .. DCSGroup )
self:E( { "Group does not exist: ", DCSGroup } )
end
for ClientName, ClientTemplate in pairs( self.Templates.ClientsByName ) do
self.Clients[ClientName] = CLIENT:New( ClientName )
end
end
end
for ClientName, ClientTemplate in pairs( self.Templates.ClientsByName ) do
self:E( { "Adding Client:", ClientName } )
self:AddClient( ClientName )
end
return self
end
--- Events
--- Handles the OnBirth event for the alive units set.
@ -504,15 +385,8 @@ function DATABASE:_EventOnBirth( Event )
if Event.IniDCSUnit then
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 )
--if not self.DCSGroups[Event.IniDCSGroupName] then
-- self.DCSGroups[Event.IniDCSGroupName] = Event.IniDCSGroupName
-- self.DCSGroupsAlive[Event.IniDCSGroupName] = Event.IniDCSGroupName
-- self.Groups[Event.IniDCSGroupName] = GROUP:New( Event.IniDCSGroup )
--end
self:AddUnit( Event.IniDCSUnit, Event.IniDCSUnitName )
self:AddGroup( Event.IniDCSGroup, Event.IniDCSGroupName )
self:_EventOnPlayerEnterUnit( Event )
end
end
@ -525,9 +399,9 @@ function DATABASE:_EventOnDeadOrCrash( Event )
self:F( { Event } )
if Event.IniDCSUnit then
if self.DCSUnitsAlive[Event.IniDCSUnitName] then
self.DCSUnits[Event.IniDCSUnitName] = nil
self.DCSUnitsAlive[Event.IniDCSUnitName] = nil
if self.DCSUnits[Event.IniDCSUnitName] then
self:DeleteUnit( Event.IniDCSUnitName )
-- add logic to correctly remove a group once all units are destroyed...
end
end
end
@ -543,7 +417,7 @@ function DATABASE:_EventOnPlayerEnterUnit( Event )
if not self.PlayersAlive[Event.IniDCSUnitName] then
self:E( { "Add player for unit:", Event.IniDCSUnitName, Event.IniDCSUnit:getPlayerName() } )
self.PlayersAlive[Event.IniDCSUnitName] = Event.IniDCSUnit:getPlayerName()
self.ClientsAlive[Event.IniDCSUnitName] = _DATABASE.Clients[ Event.IniDCSUnitName ]
self.ClientsAlive[Event.IniDCSUnitName] = self.CLIENTS[ Event.IniDCSUnitName ]
end
end
end
@ -615,10 +489,10 @@ end
-- @param #DATABASE self
-- @param #function IteratorFunction The function that will be called when there is an alive unit in the database. The function needs to accept a UNIT parameter.
-- @return #DATABASE self
function DATABASE:ForEachDCSUnitAlive( IteratorFunction, ... )
function DATABASE:ForEachDCSUnit( IteratorFunction, ... )
self:F( arg )
self:ForEach( IteratorFunction, arg, self.DCSUnitsAlive )
self:ForEach( IteratorFunction, arg, self.DCSUnits )
return self
end
@ -643,7 +517,7 @@ end
function DATABASE:ForEachClient( IteratorFunction, ... )
self:F( arg )
self:ForEach( IteratorFunction, arg, self.Clients )
self:ForEach( IteratorFunction, arg, self.CLIENTS )
return self
end
@ -653,7 +527,7 @@ function DATABASE:ScanEnvironment()
self:F()
self.Navpoints = {}
self.Units = {}
self.UNITS = {}
--Build routines.db.units and self.Navpoints
for coa_name, coa_data in pairs(env.mission.coalition) do
@ -826,7 +700,6 @@ function DATABASE:TraceDatabase()
self:F()
self:T( { "DCSUnits:", self.DCSUnits } )
self:T( { "DCSUnitsAlive:", self.DCSUnitsAlive } )
end

View File

@ -527,7 +527,8 @@ function ESCORT:MenuReportTargets( Seconds )
self.EscortMenuAttackNearbyTargets = MENU_CLIENT:New( self.EscortClient, "Attack targets", self.EscortMenu )
self.ReportTargetsScheduler = routines.scheduleFunction( self._ReportTargetsScheduler, { self }, timer.getTime() + 1, Seconds )
--self.ReportTargetsScheduler = routines.scheduleFunction( self._ReportTargetsScheduler, { self }, timer.getTime() + 1, Seconds )
self.ReportTargetsScheduler = SCHEDULER:New( self, self._ReportTargetsScheduler, {}, 1, Seconds )
return self
end
@ -635,7 +636,7 @@ function ESCORT._HoldPosition( MenuParam )
routines.removeFunction( self.FollowScheduler )
local PointFrom = {}
local GroupPoint = EscortGroup:GetUnit(1):GetPositionVec3()
local GroupPoint = EscortGroup:GetUnit(1):GetPointVec3()
PointFrom = {}
PointFrom.x = GroupPoint.x
PointFrom.y = GroupPoint.z
@ -694,7 +695,8 @@ function ESCORT:JoinUpAndFollow( EscortGroup, EscortClient, Distance )
self.CT1 = 0
self.GT1 = 0
self.FollowScheduler = routines.scheduleFunction( self._FollowScheduler, { self, Distance }, timer.getTime() + 1, .5 )
--self.FollowScheduler = routines.scheduleFunction( self._FollowScheduler, { self, Distance }, timer.getTime() + 1, .5 )
self.FollowScheduler = SCHEDULER:New( self, self._FollowScheduler, { Distance }, 1, .5, .1 )
EscortGroup:MessageToClient( "Rejoining and Following at " .. Distance .. "!", 30, EscortClient )
end
@ -748,7 +750,8 @@ function ESCORT._SwitchReportNearbyTargets( MenuParam )
if self.ReportTargets then
if not self.ReportTargetsScheduler then
self.ReportTargetsScheduler = routines.scheduleFunction( self._ReportTargetsScheduler, { self }, timer.getTime() + 1, 30 )
--self.ReportTargetsScheduler = routines.scheduleFunction( self._ReportTargetsScheduler, { self }, timer.getTime() + 1, 30 )
self.ReportTargetsScheduler = SCHEDULER:New( self, self._ReportTargetsScheduler, {}, 1, 30 )
end
else
routines.removeFunction( self.ReportTargetsScheduler )
@ -772,31 +775,30 @@ function ESCORT._ScanTargets( MenuParam )
self:T( { "FollowScheduler after removefunction: ", self.FollowScheduler } )
if EscortGroup:IsHelicopter() then
routines.scheduleFunction( EscortGroup.PushTask,
{ EscortGroup,
EscortGroup:TaskControlled(
SCHEDULER:New( EscortGroup, EscortGroup.PushTask,
{ EscortGroup:TaskControlled(
EscortGroup:TaskOrbitCircle( 200, 20 ),
EscortGroup:TaskCondition( nil, nil, nil, nil, ScanDuration, nil )
)
},
timer.getTime() + 1
1
)
elseif EscortGroup:IsAirPlane() then
routines.scheduleFunction( EscortGroup.PushTask,
{ EscortGroup,
EscortGroup:TaskControlled(
SCHEDULER:New( EscortGroup, EscortGroup.PushTask,
{ EscortGroup:TaskControlled(
EscortGroup:TaskOrbitCircle( 1000, 500 ),
EscortGroup:TaskCondition( nil, nil, nil, nil, ScanDuration, nil )
)
},
timer.getTime() + 1
1
)
end
EscortGroup:MessageToClient( "Scanning targets for " .. ScanDuration .. " seconds.", ScanDuration, EscortClient )
if self.EscortMode == ESCORT.MODE.FOLLOW then
self.FollowScheduler = routines.scheduleFunction( self._FollowScheduler, { self, Distance }, timer.getTime() + ScanDuration, 1 )
--self.FollowScheduler = routines.scheduleFunction( self._FollowScheduler, { self, Distance }, timer.getTime() + ScanDuration, 1 )
self.FollowScheduler:Start()
end
end
@ -830,25 +832,42 @@ function ESCORT._AttackTarget( MenuParam )
EscortGroup:OptionROEOpenFire()
EscortGroup:OptionROTPassiveDefense()
EscortGroup.Escort = self -- Need to do this trick to get the reference for the escort in the _Resume function.
routines.scheduleFunction(
-- routines.scheduleFunction(
-- EscortGroup.PushTask,
-- { EscortGroup,
-- EscortGroup:TaskCombo(
-- { EscortGroup:TaskAttackUnit( AttackUnit ),
-- EscortGroup:TaskFunction( 1, 2, "_Resume", {"''"} )
-- }
-- )
-- }, timer.getTime() + 10
-- )
SCHEDULER:New( EscortGroup,
EscortGroup.PushTask,
{ EscortGroup,
EscortGroup:TaskCombo(
{ EscortGroup:TaskCombo(
{ EscortGroup:TaskAttackUnit( AttackUnit ),
EscortGroup:TaskFunction( 1, 2, "_Resume", {"''"} )
}
)
}, timer.getTime() + 10
}, 10
)
else
routines.scheduleFunction(
-- routines.scheduleFunction(
-- EscortGroup.PushTask,
-- { EscortGroup,
-- EscortGroup:TaskCombo(
-- { EscortGroup:TaskFireAtPoint( AttackUnit:GetPointVec2(), 50 )
-- }
-- )
-- }, timer.getTime() + 10
-- )
SCHEDULER:New( EscortGroup,
EscortGroup.PushTask,
{ EscortGroup,
EscortGroup:TaskCombo(
{ EscortGroup:TaskCombo(
{ EscortGroup:TaskFireAtPoint( AttackUnit:GetPointVec2(), 50 )
}
)
}, timer.getTime() + 10
}, 10
)
end
EscortGroup:MessageToClient( "Engaging Designated Unit!", 10, EscortClient )
@ -875,25 +894,42 @@ function ESCORT._AssistTarget( MenuParam )
if EscortGroupAttack:IsAir() then
EscortGroupAttack:OptionROEOpenFire()
EscortGroupAttack:OptionROTVertical()
routines.scheduleFunction(
-- routines.scheduleFunction(
-- EscortGroupAttack.PushTask,
-- { EscortGroupAttack,
-- EscortGroupAttack:TaskCombo(
-- { EscortGroupAttack:TaskAttackUnit( AttackUnit ),
-- EscortGroupAttack:TaskOrbitCircle( 500, 350 )
-- }
-- )
-- }, timer.getTime() + 10
-- )
SCHDULER:New( EscortGroupAttack,
EscortGroupAttack.PushTask,
{ EscortGroupAttack,
EscortGroupAttack:TaskCombo(
{ EscortGroupAttack:TaskCombo(
{ EscortGroupAttack:TaskAttackUnit( AttackUnit ),
EscortGroupAttack:TaskOrbitCircle( 500, 350 )
}
)
}, timer.getTime() + 10
}, 10
)
else
routines.scheduleFunction(
-- routines.scheduleFunction(
-- EscortGroupAttack.PushTask,
-- { EscortGroupAttack,
-- EscortGroupAttack:TaskCombo(
-- { EscortGroupAttack:TaskFireAtPoint( AttackUnit:GetPointVec2(), 50 )
-- }
-- )
-- }, timer.getTime() + 10
-- )
SCHEDULER:New( EscortGroupAttack,
EscortGroupAttack.PushTask,
{ EscortGroupAttack,
EscortGroupAttack:TaskCombo(
{ EscortGroupAttack:TaskCombo(
{ EscortGroupAttack:TaskFireAtPoint( AttackUnit:GetPointVec2(), 50 )
}
)
}, timer.getTime() + 10
}, 10
)
end
EscortGroupAttack:MessageToClient( "Assisting with the destroying the enemy unit!", 10, EscortClient )
@ -947,7 +983,8 @@ function ESCORT._ResumeMission( MenuParam )
table.remove( WayPoints, 1 )
end
routines.scheduleFunction( EscortGroup.SetTask, {EscortGroup, EscortGroup:TaskRoute( WayPoints ) }, timer.getTime() + 1 )
--routines.scheduleFunction( EscortGroup.SetTask, {EscortGroup, EscortGroup:TaskRoute( WayPoints ) }, timer.getTime() + 1 )
SCHEDULER:New( EscortGroup, EscortGroup.SetTask, { EscortGroup:TaskRoute( WayPoints ) }, 1 )
EscortGroup:MessageToClient( "Resuming mission from waypoint " .. WayPoint .. ".", 10, EscortClient )
end
@ -977,15 +1014,15 @@ function ESCORT:_FollowScheduler( FollowDistance )
local GroupUnit = self.EscortGroup:GetUnit( 1 )
if self.CT1 == 0 and self.GT1 == 0 then
self.CV1 = ClientUnit:GetPositionVec3()
self.CV1 = ClientUnit:GetPointVec3()
self.CT1 = timer.getTime()
self.GV1 = GroupUnit:GetPositionVec3()
self.GV1 = GroupUnit:GetPointVec3()
self.GT1 = timer.getTime()
else
local CT1 = self.CT1
local CT2 = timer.getTime()
local CV1 = self.CV1
local CV2 = ClientUnit:GetPositionVec3()
local CV2 = ClientUnit:GetPointVec3()
self.CT1 = CT2
self.CV1 = CV2
@ -999,7 +1036,7 @@ function ESCORT:_FollowScheduler( FollowDistance )
local GT1 = self.GT1
local GT2 = timer.getTime()
local GV1 = self.GV1
local GV2 = GroupUnit:GetPositionVec3()
local GV2 = GroupUnit:GetPointVec3()
self.GT1 = GT2
self.GV1 = GV2
@ -1036,6 +1073,8 @@ function ESCORT:_FollowScheduler( FollowDistance )
-- Now we can calculate the group destination vector GDV.
local GDV = { x = DVu.x * CS * 8 + CVI.x, y = CVI.y, z = DVu.z * CS * 8 + CVI.z }
--trigger.action.smoke( GDV, trigger.smokeColor.Red )
self:T2( { "CV2:", CV2 } )
self:T2( { "CVI:", CVI } )
self:T2( { "GDV:", GDV } )
@ -1058,10 +1097,10 @@ function ESCORT:_FollowScheduler( FollowDistance )
-- Now route the escort to the desired point with the desired speed.
self.EscortGroup:TaskRouteToVec3( GDV, Speed / 3.6 ) -- DCS models speed in Mps (Miles per second)
end
else
routines.removeFunction( self.FollowScheduler )
return true
end
return false
end
@ -1082,7 +1121,7 @@ function ESCORT:_ReportTargetsScheduler()
self:T( EscortObject )
if EscortObject and EscortObject:isExist() and EscortObject.id_ < 50000000 then
local EscortTargetUnit = UNIT:New( EscortObject )
local EscortTargetUnit = UNIT:Find( EscortObject )
local EscortTargetUnitName = EscortTargetUnit:GetName()
@ -1105,8 +1144,8 @@ function ESCORT:_ReportTargetsScheduler()
-- EscortTargetLastVelocity } )
local EscortTargetUnitPositionVec3 = EscortTargetUnit:GetPositionVec3()
local EscortPositionVec3 = self.EscortGroup:GetPositionVec3()
local EscortTargetUnitPositionVec3 = EscortTargetUnit:GetPointVec3()
local EscortPositionVec3 = self.EscortGroup:GetPointVec3()
local Distance = ( ( EscortTargetUnitPositionVec3.x - EscortPositionVec3.x )^2 +
( EscortTargetUnitPositionVec3.y - EscortPositionVec3.y )^2 +
( EscortTargetUnitPositionVec3.z - EscortPositionVec3.z )^2
@ -1164,8 +1203,8 @@ function ESCORT:_ReportTargetsScheduler()
EscortTargetMessage = EscortTargetMessage .. "Unknown target at "
end
local EscortTargetUnitPositionVec3 = ClientEscortTargetData.AttackUnit:GetPositionVec3()
local EscortPositionVec3 = self.EscortGroup:GetPositionVec3()
local EscortTargetUnitPositionVec3 = ClientEscortTargetData.AttackUnit:GetPointVec3()
local EscortPositionVec3 = self.EscortGroup:GetPointVec3()
local Distance = ( ( EscortTargetUnitPositionVec3.x - EscortPositionVec3.x )^2 +
( EscortTargetUnitPositionVec3.y - EscortPositionVec3.y )^2 +
( EscortTargetUnitPositionVec3.z - EscortPositionVec3.z )^2
@ -1232,16 +1271,15 @@ function ESCORT:_ReportTargetsScheduler()
local TaskPoints = self:RegisterRoute()
for WayPointID, WayPoint in pairs( TaskPoints ) do
local EscortPositionVec3 = self.EscortGroup:GetPositionVec3()
local EscortPositionVec3 = self.EscortGroup:GetPointVec3()
local Distance = ( ( WayPoint.x - EscortPositionVec3.x )^2 +
( WayPoint.y - EscortPositionVec3.z )^2
) ^ 0.5 / 1000
MENU_CLIENT_COMMAND:New( self.EscortClient, "Waypoint " .. WayPointID .. " at " .. string.format( "%.2f", Distance ).. "km", self.EscortMenuResumeMission, ESCORT._ResumeMission, { ParamSelf = self, ParamWayPoint = WayPointID } )
end
end
else
routines.removeFunction( self.ReportTargetsScheduler )
self.ReportTargetsScheduler = nil
return true
end
return false
end

File diff suppressed because it is too large Load Diff

View File

@ -187,7 +187,8 @@ function MESSAGEQUEUE:New( RefreshInterval )
self.RefreshInterval = RefreshInterval
self.DisplayFunction = routines.scheduleFunction( self._DisplayMessages, { self }, 0, RefreshInterval )
--self.DisplayFunction = routines.scheduleFunction( self._DisplayMessages, { self }, 0, RefreshInterval )
self.DisplayFunction = SCHEDULER:New( self, self._DisplayMessages, {}, 0, RefreshInterval )
return self
end
@ -240,6 +241,8 @@ function MESSAGEQUEUE:_DisplayMessages()
end
end
end
return true
end
--- The _MessageQueue object is created when the MESSAGE class module is loaded.

View File

@ -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:Find( TrainerSourceDCSUnit )
local TrainerTargetUnit = UNIT:Find( TrainerTargetDCSUnit )
if self.MessagesOnOff == true and self.AlertsLaunchesOnOff == true then
@ -489,7 +489,7 @@ function MISSILETRAINER:_AddRange( Client, TrainerWeapon )
if self.DetailsRangeOnOff then
local PositionMissile = TrainerWeapon:getPoint()
local PositionTarget = Client:GetPositionVec3()
local PositionTarget = Client:GetPointVec3()
local Range = ( ( PositionMissile.x - PositionTarget.x )^2 +
( PositionMissile.y - PositionTarget.y )^2 +
@ -509,7 +509,7 @@ function MISSILETRAINER:_AddBearing( Client, TrainerWeapon )
if self.DetailsBearingOnOff then
local PositionMissile = TrainerWeapon:getPoint()
local PositionTarget = Client:GetPositionVec3()
local PositionTarget = Client:GetPointVec3()
self:T2( { PositionTarget, PositionMissile })
@ -557,7 +557,7 @@ function MISSILETRAINER:_TrackMissiles()
if Client and Client:IsAlive() and TrainerSourceUnit and TrainerSourceUnit:IsAlive() and TrainerWeapon and TrainerWeapon:isExist() and TrainerTargetUnit and TrainerTargetUnit:IsAlive() then
local PositionMissile = TrainerWeapon:getPosition().p
local PositionTarget = Client:GetPositionVec3()
local PositionTarget = Client:GetPointVec3()
local Distance = ( ( PositionMissile.x - PositionTarget.x )^2 +
( PositionMissile.y - PositionTarget.y )^2 +

View File

@ -231,25 +231,6 @@ function MISSION:AddGoalFunction( GoalFunction )
self.GoalFunction = GoalFunction
end
--- Show the briefing of the MISSION to the CLIENT.
-- @param CLIENT Client to show briefing to.
-- @return CLIENT
function MISSION:ShowBriefing( Client )
self:F( { Client.ClientName } )
if not Client.ClientBriefingShown then
Client.ClientBriefingShown = true
local Briefing = self.MissionBriefing
if Client.ClientBriefing then
Briefing = Briefing .. "\n" .. Client.ClientBriefing
end
Briefing = Briefing .. "\n (Press [LEFT ALT]+[B] to view the graphical documentation.)"
Client:Message( Briefing, 30, self.Name .. '/MissionBriefing', "Command: Mission Briefing" )
end
return Client
end
--- Register a new @{CLIENT} to participate within the mission.
-- @param CLIENT Client is the @{CLIENT} object. The object must have been instantiated with @{CLIENT:New}.
-- @return CLIENT
@ -539,12 +520,15 @@ function MISSIONSCHEDULER.Scheduler()
Mission:ReportToAll()
end
end
return true
end
--- Start the MISSIONSCHEDULER.
function MISSIONSCHEDULER.Start()
if MISSIONSCHEDULER ~= nil then
MISSIONSCHEDULER.SchedulerId = routines.scheduleFunction( MISSIONSCHEDULER.Scheduler, { }, 0, 2 )
--MISSIONSCHEDULER.SchedulerId = routines.scheduleFunction( MISSIONSCHEDULER.Scheduler, { }, 0, 2 )
MISSIONSCHEDULER.SchedulerId = SCHEDULER:New( nil, MISSIONSCHEDULER.Scheduler, { }, 0, 2 )
end
end

View File

@ -49,7 +49,8 @@ end
--- Call this function to start the MOVEMENT scheduling.
function MOVEMENT:ScheduleStart()
self:F()
self.MoveFunction = routines.scheduleFunction( self._Scheduler, { self }, timer.getTime() + 1, 120 )
--self.MoveFunction = routines.scheduleFunction( self._Scheduler, { self }, timer.getTime() + 1, 120 )
self.MoveFunction = SCHEDULER:New( self, self._Scheduler, {}, 1, 120 )
end
--- Call this function to stop the MOVEMENT scheduling.
@ -125,4 +126,5 @@ function MOVEMENT:_Scheduler()
end
end
end
return true
end

View File

@ -461,102 +461,6 @@ do
end
do
local Tasks = {}
local task_id = 0
--[[ routines.scheduleFunction:
int id = routines.schedule_task(f function, vars table, t number, rep number, st number)
id - integer id of this function task
f - function to run
vars - table of vars for that function
t - time to run function
rep - time between repetitions of this function (OPTIONAL)
st - time when repetitions of this function will stop automatically (OPTIONAL)
]]
--- Schedule a function
-- @param #function f
-- @param #table parameters
-- @param #Time t
-- @param #Time rep seconds
-- @param #Time st
routines.scheduleFunction = function(f, vars, t, rep, st)
--verify correct types
assert(type(f) == 'function', 'variable 1, expected function, got ' .. type(f))
assert(type(vars) == 'table' or vars == nil, 'variable 2, expected table or nil, got ' .. type(f))
assert(type(t) == 'number', 'variable 3, expected number, got ' .. type(t))
assert(type(rep) == 'number' or rep == nil, 'variable 4, expected number or nil, got ' .. type(rep))
assert(type(st) == 'number' or st == nil, 'variable 5, expected number or nil, got ' .. type(st))
if not vars then
vars = {}
end
task_id = task_id + 1
table.insert(Tasks, {f = f, vars = vars, t = t, rep = rep, st = st, id = task_id})
return task_id
end
-- removes a scheduled function based on the function's id. returns true if successful, false if not successful.
routines.removeFunction = function(id)
local i = 1
while i <= #Tasks do
if Tasks[i].id == id then
table.remove(Tasks, i)
else
i = i + 1
end
end
end
routines.errhandler = function(errmsg)
env.info( "Error in scheduled function:" .. errmsg )
env.info( debug.traceback() )
return errmsg
end
--------------------------------------------------------------------------------------------------------------------
-- not intended for users to use this function.
routines.do_scheduled_functions = function()
local i = 1
while i <= #Tasks do
if not Tasks[i].rep then -- not a repeated process
if Tasks[i].t <= timer.getTime() then
local Task = Tasks[i] -- local reference
--env.info("do_scheduled_functions:call function " .. i )
table.remove(Tasks, i)
local err, errmsg = xpcall(function() Task.f( unpack(Task.vars, 1, table.maxn(Task.vars))) end, routines.errhandler )
if not err then
--env.info('routines.scheduleFunction, error in scheduled function: ' .. errmsg)
end
--Task.f(unpack(Task.vars, 1, table.maxn(Task.vars))) -- do the task, do not increment i
else
i = i + 1
end
else
if Tasks[i].st and Tasks[i].st <= timer.getTime() then --if a stoptime was specified, and the stop time exceeded
--env.info("do_scheduled_functions:remove repeated")
table.remove(Tasks, i) -- stop time exceeded, do not execute, do not increment i
elseif Tasks[i].t <= timer.getTime() then
local Task = Tasks[i] -- local reference
Task.t = timer.getTime() + Task.rep --schedule next run
--env.info("do_scheduled_functions:call function " .. i )
local err, errmsg = xpcall(function() Task.f( unpack(Task.vars, 1, table.maxn(Task.vars))) end, routines.errhandler )
if not err then
--env.info('routines.scheduleFunction, error in scheduled function: ' .. errmsg)
end
--Tasks[i].f(unpack(Tasks[i].vars, 1, table.maxn(Tasks[i].vars))) -- do the task
i = i + 1
else
i = i + 1
end
end
end
end
end
do
local idNum = 0

View File

@ -1,11 +1,27 @@
--- Models time events calling event handing functions.
--
-- @{SCHEDULER} class
-- ===================
-- The @{SCHEDULER} class models time events calling given event handling functions.
--
-- SCHEDULER constructor
-- =====================
-- The SCHEDULER class is quite easy to use:
--
-- * @{#SCHEDULER.New}: Setup a new scheduler and start it with the specified parameters.
--
-- SCHEDULER timer methods
-- =======================
-- The SCHEDULER can be stopped and restarted with the following methods:
--
-- * @{#SCHEDULER.Start}: (Re-)Start the scheduler.
-- * @{#SCHEDULER.Start}: Stop the scheduler.
--
-- @module Scheduler
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Cargo" )
Include.File( "Message" )
--- The SCHEDULER class
@ -16,19 +32,19 @@ SCHEDULER = {
}
--- SCHEDULER constructor.
--- Constructor.
-- @param #SCHEDULER self
-- @param #table TimeEventObject
-- @param #function TimeEventFunction
-- @param #table TimeEventFunctionArguments
-- @param #number StartSeconds
-- @param #number RepeatSecondsInterval
-- @param #number RandomizationFactor
-- @param #number StopSeconds
-- @return #SCHEDULER
-- @param #table TimeEventObject Specified for which Moose object the timer is setup. If a value of nil is provided, a scheduler will be setup without an object reference.
-- @param #function TimeEventFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in TimeEventFunctionArguments.
-- @param #table TimeEventFunctionArguments Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
-- @param #number StartSeconds Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
-- @param #number RepeatSecondsInterval Specifies the interval in seconds when the scheduler will call the event function.
-- @param #number RandomizationFactor Specifies a randomization factor between 0 and 1 to randomize the RepeatSecondsInterval.
-- @param #number StopSeconds Specifies the amount of seconds when the scheduler will be stopped.
-- @return #SCHEDULER self
function SCHEDULER:New( TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
local self = BASE:Inherit( self, BASE:New() )
self:F( { TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
self:F2( { TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
self.TimeEventObject = TimeEventObject
self.TimeEventFunction = TimeEventFunction
@ -60,8 +76,33 @@ function SCHEDULER:New( TimeEventObject, TimeEventFunction, TimeEventFunctionArg
return self
end
function SCHEDULER:Scheduler()
self:F( self.TimeEventFunctionArguments )
--- (Re-)Starts the scheduler.
-- @param #SCHEDULER self
-- @return #SCHEDULER self
function SCHEDULER:Start()
self:F2( self.TimeEventObject )
self.Repeat = true
timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
return self
end
--- Stops the scheduler.
-- @param #SCHEDULER self
-- @return #SCHEDULER self
function SCHEDULER:Stop()
self:F2( self.TimeEventObject )
self.Repeat = false
return self
end
-- Private Functions
function SCHEDULER:_Scheduler()
self:F2( self.TimeEventFunctionArguments )
local ErrorHandler = function( errmsg )
@ -83,7 +124,7 @@ function SCHEDULER:Scheduler()
if Status and Status == true and Result and Result == true then
if self.Repeat and ( not self.StopSeconds or ( self.StopSeconds and timer.getTime() <= self.StartTime + self.StopSeconds ) ) then
timer.scheduleFunction(
self.Scheduler,
self._Scheduler,
self,
timer.getTime() + self.RepeatSecondsInterval + math.random( - ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ), ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ) ) + 0.01
)
@ -92,20 +133,7 @@ function SCHEDULER:Scheduler()
end
function SCHEDULER:Start()
self:F( self.TimeEventObject )
self.Repeat = true
timer.scheduleFunction( self.Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
return self
end
function SCHEDULER:Stop()
self:F( self.TimeEventObject )
self.Repeat = false
end

View File

@ -62,7 +62,8 @@ function SCORING:New( GameName )
_EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self )
_EVENTDISPATCHER:OnHit( self._EventOnHit, self )
self.SchedulerId = routines.scheduleFunction( SCORING._FollowPlayersScheduled, { self }, 0, 5 )
--self.SchedulerId = routines.scheduleFunction( SCORING._FollowPlayersScheduled, { self }, 0, 5 )
self.SchedulerId = SCHEDULER:New( self, self._FollowPlayersScheduled, {}, 0, 5 )
self:ScoreMenu()
@ -97,6 +98,8 @@ function SCORING:_FollowPlayersScheduled()
self:_AddPlayerFromUnit( UnitData )
end
end
return true
end

View File

@ -0,0 +1,758 @@
--- Manage sets of units and groups.
--
-- @{#Set} class
-- ==================
-- Mission designers can use the SET class to build sets of units belonging to certain:
--
-- * Coalitions
-- * Categories
-- * Countries
-- * Unit types
-- * Starting with certain prefix strings.
--
-- This list will grow over time. Planned developments are to include filters and iterators.
-- Additional filters will be added around @{Zone#ZONEs}, Radiuses, Active players, ...
-- More iterators will be implemented in the near future ...
--
-- Administers the Initial Sets of the Mission Templates as defined within the Mission Editor.
--
-- SET construction methods:
-- =================================
-- Create a new SET object with the @{#SET.New} method:
--
-- * @{#SET.New}: Creates a new SET object.
--
--
-- SET filter criteria:
-- =========================
-- You can set filter criteria to define the set of units within the SET.
-- Filter criteria are defined by:
--
-- * @{#SET.FilterCoalitions}: Builds the SET with the units belonging to the coalition(s).
-- * @{#SET.FilterCategories}: Builds the SET with the units belonging to the category(ies).
-- * @{#SET.FilterTypes}: Builds the SET with the units belonging to the unit type(s).
-- * @{#SET.FilterCountries}: Builds the SET with the units belonging to the country(ies).
-- * @{#SET.FilterUnitPrefixes}: Builds the SET with the units starting with the same prefix string(s).
--
-- Once the filter criteria have been set for the SET, you can start filtering using:
--
-- * @{#SET.FilterStart}: Starts the filtering of the units within the SET.
--
-- Planned filter criteria within development are (so these are not yet available):
--
-- * @{#SET.FilterGroupPrefixes}: Builds the SET with the groups of the units starting with the same prefix string(s).
-- * @{#SET.FilterZones}: Builds the SET with the units within a @{Zone#ZONE}.
--
--
-- SET iterators:
-- ===================
-- Once the filters have been defined and the SET has been built, you can iterate the SET with the available iterator methods.
-- The iterator methods will walk the SET set, and call for each element within the set a function that you provide.
-- The following iterator methods are currently available within the SET:
--
-- * @{#SET.ForEachAliveUnit}: Calls a function for each alive unit it finds within the SET.
--
-- Planned iterators methods in development are (so these are not yet available):
--
-- * @{#SET.ForEachUnit}: Calls a function for each unit contained within the SET.
-- * @{#SET.ForEachGroup}: Calls a function for each group contained within the SET.
-- * @{#SET.ForEachUnitInZone}: Calls a function for each unit within a certain zone contained within the SET.
--
-- ====
-- @module Set
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Menu" )
Include.File( "Group" )
Include.File( "Unit" )
Include.File( "Event" )
Include.File( "Client" )
--- SET class
-- @type SET
-- @extends Base#BASE
SET = {
ClassName = "SET",
Templates = {
Units = {},
Groups = {},
ClientsByName = {},
ClientsByID = {},
},
DCSUnits = {},
DCSUnitsAlive = {},
DCSGroups = {},
DCSGroupsAlive = {},
Units = {},
UnitsAlive = {},
Groups = {},
GroupsAlive = {},
NavPoints = {},
Statics = {},
Players = {},
PlayersAlive = {},
Clients = {},
ClientsAlive = {},
Filter = {
Coalitions = nil,
Categories = nil,
Types = nil,
Countries = nil,
UnitPrefixes = nil,
GroupPrefixes = nil,
},
FilterMeta = {
Coalitions = {
red = coalition.side.RED,
blue = coalition.side.BLUE,
neutral = coalition.side.NEUTRAL,
},
Categories = {
plane = Unit.Category.AIRPLANE,
helicopter = Unit.Category.HELICOPTER,
ground = Unit.Category.GROUND_UNIT,
ship = Unit.Category.SHIP,
structure = Unit.Category.STRUCTURE,
},
},
}
local _DATABASECoalition =
{
[1] = "Red",
[2] = "Blue",
}
local _DATABASECategory =
{
[Unit.Category.AIRPLANE] = "Plane",
[Unit.Category.HELICOPTER] = "Helicopter",
[Unit.Category.GROUND_UNIT] = "Vehicle",
[Unit.Category.SHIP] = "Ship",
[Unit.Category.STRUCTURE] = "Structure",
}
--- Creates a new SET object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.
-- @param #SET self
-- @return #SET
-- @usage
-- -- Define a new SET Object. This DBObject will contain a reference to all Group and Unit Templates defined within the ME and the DCSRTE.
-- DBObject = SET:New()
function SET:New()
-- Inherits from BASE
local self = BASE:Inherit( self, BASE:New() )
_EVENTDISPATCHER:OnBirth( self._EventOnBirth, self )
_EVENTDISPATCHER:OnDead( self._EventOnDeadOrCrash, self )
_EVENTDISPATCHER:OnCrash( self._EventOnDeadOrCrash, self )
-- Add SET with registered clients and already alive players
-- Follow alive players and clients
_EVENTDISPATCHER:OnPlayerEnterUnit( self._EventOnPlayerEnterUnit, self )
_EVENTDISPATCHER:OnPlayerLeaveUnit( self._EventOnPlayerLeaveUnit, self )
return self
end
--- Finds a Unit based on the Unit Name.
-- @param #SET self
-- @param #string UnitName
-- @return Unit#UNIT The found Unit.
function SET:FindUnit( UnitName )
local UnitFound = self.Units[UnitName]
return UnitFound
end
--- Finds a Unit based on the Unit Name.
-- @param #SET self
-- @param Unit#UNIT UnitToAdd
-- @return Unit#UNIT The added Unit.
function SET: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 #SET self
-- @param #string Coalitions Can take the following values: "red", "blue", "neutral".
-- @return #SET self
function SET:FilterCoalitions( Coalitions )
if not self.Filter.Coalitions then
self.Filter.Coalitions = {}
end
if type( Coalitions ) ~= "table" then
Coalitions = { Coalitions }
end
for CoalitionID, Coalition in pairs( Coalitions ) do
self.Filter.Coalitions[Coalition] = Coalition
end
return self
end
--- Builds a set of units out of categories.
-- Possible current categories are plane, helicopter, ground, ship.
-- @param #SET self
-- @param #string Categories Can take the following values: "plane", "helicopter", "ground", "ship".
-- @return #SET self
function SET:FilterCategories( Categories )
if not self.Filter.Categories then
self.Filter.Categories = {}
end
if type( Categories ) ~= "table" then
Categories = { Categories }
end
for CategoryID, Category in pairs( Categories ) do
self.Filter.Categories[Category] = Category
end
return self
end
--- Builds a set of units of defined unit types.
-- Possible current types are those types known within DCS world.
-- @param #SET self
-- @param #string Types Can take those type strings known within DCS world.
-- @return #SET self
function SET:FilterTypes( Types )
if not self.Filter.Types then
self.Filter.Types = {}
end
if type( Types ) ~= "table" then
Types = { Types }
end
for TypeID, Type in pairs( Types ) do
self.Filter.Types[Type] = Type
end
return self
end
--- Builds a set of units of defined countries.
-- Possible current countries are those known within DCS world.
-- @param #SET self
-- @param #string Countries Can take those country strings known within DCS world.
-- @return #SET self
function SET:FilterCountries( Countries )
if not self.Filter.Countries then
self.Filter.Countries = {}
end
if type( Countries ) ~= "table" then
Countries = { Countries }
end
for CountryID, Country in pairs( Countries ) do
self.Filter.Countries[Country] = Country
end
return self
end
--- Builds a set of units of defined unit prefixes.
-- All the units starting with the given prefixes will be included within the set.
-- @param #SET self
-- @param #string Prefixes The prefix of which the unit name starts with.
-- @return #SET self
function SET:FilterUnitPrefixes( Prefixes )
if not self.Filter.UnitPrefixes then
self.Filter.UnitPrefixes = {}
end
if type( Prefixes ) ~= "table" then
Prefixes = { Prefixes }
end
for PrefixID, Prefix in pairs( Prefixes ) do
self.Filter.UnitPrefixes[Prefix] = Prefix
end
return self
end
--- Builds a set of units of defined group prefixes.
-- All the units starting with the given group prefixes will be included within the set.
-- @param #SET self
-- @param #string Prefixes The prefix of which the group name where the unit belongs to starts with.
-- @return #SET self
function SET:FilterGroupPrefixes( Prefixes )
if not self.Filter.GroupPrefixes then
self.Filter.GroupPrefixes = {}
end
if type( Prefixes ) ~= "table" then
Prefixes = { Prefixes }
end
for PrefixID, Prefix in pairs( Prefixes ) do
self.Filter.GroupPrefixes[Prefix] = Prefix
end
return self
end
--- Starts the filtering.
-- @param #SET self
-- @return #SET self
function SET:FilterStart()
if _DATABASE then
-- OK, we have a _DATABASE
-- Now use the different filters to build the set.
-- We first take ALL of the Units of the _DATABASE.
self:E( { "Adding Set Datapoints with filters" } )
for DCSUnitName, DCSUnit in pairs( _DATABASE.DCSUnits ) do
if self:_IsIncludeDCSUnit( DCSUnit ) then
self:E( { "Adding Unit:", DCSUnitName } )
self.DCSUnits[DCSUnitName] = _DATABASE.DCSUnits[DCSUnitName]
self.Units[DCSUnitName] = _DATABASE:FindUnit( DCSUnitName )
if _DATABASE.DCSUnitsAlive[DCSUnitName] then
self.DCSUnitsAlive[DCSUnitName] = _DATABASE.DCSUnitsAlive[DCSUnitName]
self.UnitsAlive[DCSUnitName] = _DATABASE.UnitsAlive[DCSUnitName]
end
end
end
for DCSGroupName, DCSGroup in pairs( _DATABASE.DCSGroups ) do
--if self:_IsIncludeDCSGroup( DCSGroup ) then
self:E( { "Adding Group:", DCSGroupName } )
self.DCSGroups[DCSGroupName] = _DATABASE.DCSGroups[DCSGroupName]
self.Groups[DCSGroupName] = _DATABASE:FindGroups( DCSGroupName )
--end
if _DATABASE.DCSGroupsAlive[DCSGroupName] then
self.DCSGroupsAlive[DCSGroupName] = _DATABASE.DCSGroupsAlive[DCSGroupName]
self.GroupsAlive[DCSGroupName] = _DATABASE.GroupsAlive[DCSGroupName]
end
end
for DCSUnitName, Client in pairs( _DATABASE.CLIENTS ) do
self:E( { "Adding Client for Unit:", DCSUnitName } )
self.Clients[DCSUnitName] = _DATABASE.Clients[DCSUnitName]
end
else
self:E( "There is a structural error in MOOSE. No _DATABASE has been defined! Cannot build this custom SET." )
end
return self
end
--- Private method that registers all alive players in the mission.
-- @param #SET self
-- @return #SET self
function SET:_RegisterPlayers()
local CoalitionsData = { AlivePlayersRed = coalition.getPlayers( coalition.side.RED ), AlivePlayersBlue = coalition.getPlayers( coalition.side.BLUE ) }
for CoalitionId, CoalitionData in pairs( CoalitionsData ) do
for UnitId, UnitData in pairs( CoalitionData ) do
self:T3( { "UnitData:", UnitData } )
if UnitData and UnitData:isExist() then
local UnitName = UnitData:getName()
if not self.PlayersAlive[UnitName] then
self:E( { "Add player for unit:", UnitName, UnitData:getPlayerName() } )
self.PlayersAlive[UnitName] = UnitData:getPlayerName()
end
end
end
end
return self
end
--- Private method that registers all datapoints within in the mission.
-- @param #SET self
-- @return #SET self
function SET:_RegisterDatabase()
local CoalitionsData = { AlivePlayersRed = coalition.getGroups( coalition.side.RED ), AlivePlayersBlue = coalition.getGroups( coalition.side.BLUE ) }
for CoalitionId, CoalitionData in pairs( CoalitionsData ) do
for DCSGroupId, DCSGroup in pairs( CoalitionData ) do
if DCSGroup:isExist() then
local DCSGroupName = DCSGroup:getName()
self:E( { "Register Group:", DCSGroup, DCSGroupName } )
self.DCSGroups[DCSGroupName] = DCSGroup
self.Groups[DCSGroupName] = GROUP:New( DCSGroup )
if self:_IsAliveDCSGroup(DCSGroup) then
self:E( { "Register Alive Group:", DCSGroup, DCSGroupName } )
self.DCSGroupsAlive[DCSGroupName] = DCSGroup
self.GroupsAlive[DCSGroupName] = self.Groups[DCSGroupName]
end
for DCSUnitId, DCSUnit in pairs( DCSGroup:getUnits() ) do
local DCSUnitName = DCSUnit:getName()
self:E( { "Register Unit:", DCSUnit, DCSUnitName } )
self.DCSUnits[DCSUnitName] = DCSUnit
self:AddUnit( UNIT:Find( DCSUnit ) )
--self.Units[DCSUnitName] = UNIT:Register( DCSUnit )
if self:_IsAliveDCSUnit(DCSUnit) then
self:E( { "Register Alive Unit:", DCSUnit, DCSUnitName } )
self.DCSUnitsAlive[DCSUnitName] = DCSUnit
self.UnitsAlive[DCSUnitName] = self.Units[DCSUnitName]
end
end
else
self:E( "Group does not exist: " .. DCSGroup )
end
for ClientName, ClientTemplate in pairs( self.Templates.ClientsByName ) do
self.Clients[ClientName] = CLIENT:Find( ClientName )
end
end
end
return self
end
--- Events
--- Handles the OnBirth event for the alive units set.
-- @param #SET self
-- @param Event#EVENTDATA Event
function SET:_EventOnBirth( Event )
self:F( { Event } )
if Event.IniDCSUnit then
if self:_IsIncludeDCSUnit( Event.IniDCSUnit ) then
self.DCSUnits[Event.IniDCSUnitName] = Event.IniDCSUnit
self.DCSUnitsAlive[Event.IniDCSUnitName] = 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
-- self.DCSGroupsAlive[Event.IniDCSGroupName] = Event.IniDCSGroupName
-- self.Groups[Event.IniDCSGroupName] = GROUP:New( Event.IniDCSGroup )
--end
self:_EventOnPlayerEnterUnit( Event )
end
end
end
--- Handles the OnDead or OnCrash event for alive units set.
-- @param #SET self
-- @param Event#EVENTDATA Event
function SET:_EventOnDeadOrCrash( Event )
self:F( { Event } )
if Event.IniDCSUnit then
if self.DCSUnitsAlive[Event.IniDCSUnitName] then
self.DCSUnits[Event.IniDCSUnitName] = nil
self.DCSUnitsAlive[Event.IniDCSUnitName] = nil
end
end
end
--- Handles the OnPlayerEnterUnit event to fill the active players table (with the unit filter applied).
-- @param #SET self
-- @param Event#EVENTDATA Event
function SET:_EventOnPlayerEnterUnit( Event )
self:F( { Event } )
if Event.IniDCSUnit then
if self:_IsIncludeDCSUnit( Event.IniDCSUnit ) then
if not self.PlayersAlive[Event.IniDCSUnitName] then
self:E( { "Add player for unit:", Event.IniDCSUnitName, Event.IniDCSUnit:getPlayerName() } )
self.PlayersAlive[Event.IniDCSUnitName] = Event.IniDCSUnit:getPlayerName()
self.ClientsAlive[Event.IniDCSUnitName] = _DATABASE.Clients[ Event.IniDCSUnitName ]
end
end
end
end
--- Handles the OnPlayerLeaveUnit event to clean the active players table.
-- @param #SET self
-- @param Event#EVENTDATA Event
function SET:_EventOnPlayerLeaveUnit( Event )
self:F( { Event } )
if Event.IniDCSUnit then
if self:_IsIncludeDCSUnit( Event.IniDCSUnit ) then
if self.PlayersAlive[Event.IniDCSUnitName] then
self:E( { "Cleaning player for unit:", Event.IniDCSUnitName, Event.IniDCSUnit:getPlayerName() } )
self.PlayersAlive[Event.IniDCSUnitName] = nil
self.ClientsAlive[Event.IniDCSUnitName] = nil
end
end
end
end
--- Iterators
--- Interate the SET and call an interator function for the given set, providing the Object for each element within the set and optional parameters.
-- @param #SET self
-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET.
-- @return #SET self
function SET:ForEach( IteratorFunction, arg, Set )
self:F( arg )
local function CoRoutine()
local Count = 0
for ObjectID, Object in pairs( Set ) do
self:T2( Object )
IteratorFunction( Object, unpack( arg ) )
Count = Count + 1
if Count % 10 == 0 then
coroutine.yield( false )
end
end
return true
end
local co = coroutine.create( CoRoutine )
local function Schedule()
local status, res = coroutine.resume( co )
self:T( { status, res } )
if status == false then
error( res )
end
if res == false then
return true -- resume next time the loop
end
return false
end
local Scheduler = SCHEDULER:New( self, Schedule, {}, 0.001, 0.001, 0 )
return self
end
--- Interate the SET and call an interator function for each **alive** unit, providing the Unit and optional parameters.
-- @param #SET self
-- @param #function IteratorFunction The function that will be called when there is an alive unit in the SET. The function needs to accept a UNIT parameter.
-- @return #SET self
function SET:ForEachDCSUnitAlive( IteratorFunction, ... )
self:F( arg )
self:ForEach( IteratorFunction, arg, self.DCSUnitsAlive )
return self
end
--- Interate the SET and call an interator function for each **alive** player, providing the Unit of the player and optional parameters.
-- @param #SET self
-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET. The function needs to accept a UNIT parameter.
-- @return #SET self
function SET:ForEachPlayer( IteratorFunction, ... )
self:F( arg )
self:ForEach( IteratorFunction, arg, self.PlayersAlive )
return self
end
--- Interate the SET and call an interator function for each client, providing the Client to the function and optional parameters.
-- @param #SET self
-- @param #function IteratorFunction The function that will be called when there is an alive player in the SET. The function needs to accept a CLIENT parameter.
-- @return #SET self
function SET:ForEachClient( IteratorFunction, ... )
self:F( arg )
self:ForEach( IteratorFunction, arg, self.Clients )
return self
end
function SET:ScanEnvironment()
self:F()
self.Navpoints = {}
self.Units = {}
--Build routines.db.units and self.Navpoints
for coa_name, coa_data in pairs(env.mission.coalition) do
if (coa_name == 'red' or coa_name == 'blue') and type(coa_data) == 'table' then
--self.Units[coa_name] = {}
----------------------------------------------
-- build nav points DB
self.Navpoints[coa_name] = {}
if coa_data.nav_points then --navpoints
for nav_ind, nav_data in pairs(coa_data.nav_points) do
if type(nav_data) == 'table' then
self.Navpoints[coa_name][nav_ind] = routines.utils.deepCopy(nav_data)
self.Navpoints[coa_name][nav_ind]['name'] = nav_data.callsignStr -- name is a little bit more self-explanatory.
self.Navpoints[coa_name][nav_ind]['point'] = {} -- point is used by SSE, support it.
self.Navpoints[coa_name][nav_ind]['point']['x'] = nav_data.x
self.Navpoints[coa_name][nav_ind]['point']['y'] = 0
self.Navpoints[coa_name][nav_ind]['point']['z'] = nav_data.y
end
end
end
-------------------------------------------------
if coa_data.country then --there is a country table
for cntry_id, cntry_data in pairs(coa_data.country) do
local countryName = string.lower(cntry_data.name)
--self.Units[coa_name][countryName] = {}
--self.Units[coa_name][countryName]["countryId"] = cntry_data.id
if type(cntry_data) == 'table' then --just making sure
for obj_type_name, obj_type_data in pairs(cntry_data) do
if obj_type_name == "helicopter" or obj_type_name == "ship" or obj_type_name == "plane" or obj_type_name == "vehicle" or obj_type_name == "static" then --should be an unncessary check
local category = obj_type_name
if ((type(obj_type_data) == 'table') and obj_type_data.group and (type(obj_type_data.group) == 'table') and (#obj_type_data.group > 0)) then --there's a group!
--self.Units[coa_name][countryName][category] = {}
for group_num, GroupTemplate in pairs(obj_type_data.group) do
if GroupTemplate and GroupTemplate.units and type(GroupTemplate.units) == 'table' then --making sure again- this is a valid group
self:_RegisterGroup( GroupTemplate )
end --if GroupTemplate and GroupTemplate.units then
end --for group_num, GroupTemplate in pairs(obj_type_data.group) do
end --if ((type(obj_type_data) == 'table') and obj_type_data.group and (type(obj_type_data.group) == 'table') and (#obj_type_data.group > 0)) then
end --if obj_type_name == "helicopter" or obj_type_name == "ship" or obj_type_name == "plane" or obj_type_name == "vehicle" or obj_type_name == "static" then
end --for obj_type_name, obj_type_data in pairs(cntry_data) do
end --if type(cntry_data) == 'table' then
end --for cntry_id, cntry_data in pairs(coa_data.country) do
end --if coa_data.country then --there is a country table
end --if coa_name == 'red' or coa_name == 'blue' and type(coa_data) == 'table' then
end --for coa_name, coa_data in pairs(mission.coalition) do
self:_RegisterDatabase()
self:_RegisterPlayers()
return self
end
---
-- @param #SET self
-- @param DCSUnit#Unit DCSUnit
-- @return #SET self
function SET:_IsIncludeDCSUnit( DCSUnit )
self:F( DCSUnit )
local DCSUnitInclude = true
if self.Filter.Coalitions then
local DCSUnitCoalition = false
for CoalitionID, CoalitionName in pairs( self.Filter.Coalitions ) do
self:T( { "Coalition:", DCSUnit:getCoalition(), self.FilterMeta.Coalitions[CoalitionName], CoalitionName } )
if self.FilterMeta.Coalitions[CoalitionName] and self.FilterMeta.Coalitions[CoalitionName] == DCSUnit:getCoalition() then
DCSUnitCoalition = true
end
end
DCSUnitInclude = DCSUnitInclude and DCSUnitCoalition
end
if self.Filter.Categories then
local DCSUnitCategory = false
for CategoryID, CategoryName in pairs( self.Filter.Categories ) do
self:T( { "Category:", DCSUnit:getDesc().category, self.FilterMeta.Categories[CategoryName], CategoryName } )
if self.FilterMeta.Categories[CategoryName] and self.FilterMeta.Categories[CategoryName] == DCSUnit:getDesc().category then
DCSUnitCategory = true
end
end
DCSUnitInclude = DCSUnitInclude and DCSUnitCategory
end
if self.Filter.Types then
local DCSUnitType = false
for TypeID, TypeName in pairs( self.Filter.Types ) do
self:T( { "Type:", DCSUnit:getTypeName(), TypeName } )
if TypeName == DCSUnit:getTypeName() then
DCSUnitType = true
end
end
DCSUnitInclude = DCSUnitInclude and DCSUnitType
end
if self.Filter.Countries then
local DCSUnitCountry = false
for CountryID, CountryName in pairs( self.Filter.Countries ) do
self:T( { "Country:", DCSUnit:getCountry(), CountryName } )
if country.id[CountryName] == DCSUnit:getCountry() then
DCSUnitCountry = true
end
end
DCSUnitInclude = DCSUnitInclude and DCSUnitCountry
end
if self.Filter.UnitPrefixes then
local DCSUnitPrefix = false
for UnitPrefixId, UnitPrefix in pairs( self.Filter.UnitPrefixes ) do
self:T( { "Unit Prefix:", string.find( DCSUnit:getName(), UnitPrefix, 1 ), UnitPrefix } )
if string.find( DCSUnit:getName(), UnitPrefix, 1 ) then
DCSUnitPrefix = true
end
end
DCSUnitInclude = DCSUnitInclude and DCSUnitPrefix
end
self:T( DCSUnitInclude )
return DCSUnitInclude
end
---
-- @param #SET self
-- @param DCSUnit#Unit DCSUnit
-- @return #SET self
function SET:_IsAliveDCSUnit( DCSUnit )
self:F( DCSUnit )
local DCSUnitAlive = false
if DCSUnit and DCSUnit:isExist() and DCSUnit:isActive() then
if self.DCSUnits[DCSUnit:getName()] then
DCSUnitAlive = true
end
end
self:T( DCSUnitAlive )
return DCSUnitAlive
end
---
-- @param #SET self
-- @param DCSGroup#Group DCSGroup
-- @return #SET self
function SET:_IsAliveDCSGroup( DCSGroup )
self:F( DCSGroup )
local DCSGroupAlive = false
if DCSGroup and DCSGroup:isExist() then
if self.DCSGroups[DCSGroup:getName()] then
DCSGroupAlive = true
end
end
self:T( DCSGroupAlive )
return DCSGroupAlive
end
--- Traces the current SET contents in the log ... (for debug reasons).
-- @param #SET self
-- @return #SET self
function SET:TraceDatabase()
self:F()
self:T( { "DCSUnits:", self.DCSUnits } )
self:T( { "DCSUnitsAlive:", self.DCSUnitsAlive } )
end

View File

@ -69,7 +69,7 @@ end
function STAGEBRIEF:Execute( Mission, Client, Task )
local Valid = BASE:Inherited(self):Execute( Mission, Client, Task )
self:F()
Mission:ShowBriefing( Client )
Client:ShowBriefing()
self.StageBriefingTime = timer.getTime()
return Valid
end

View File

@ -0,0 +1,775 @@
--- UNIT Class
--
-- @{UNIT} class
-- ==============
-- The @{UNIT} class is a wrapper class to handle the DCS Unit objects:
--
-- * Support all DCS Unit APIs.
-- * Enhance with Unit specific APIs not in the DCS Unit API set.
-- * Handle local Unit Controller.
-- * Manage the "state" of the DCS Unit.
--
--
-- UNIT reference methods
-- ======================
-- For each DCS Unit object alive within a running mission, a UNIT wrapper object (instance) will be created within the _@{DATABASE} 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 @{SPAWN} class).
--
-- The UNIT 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.
--
-- 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.
--
-- The UNIT class provides the following functions to retrieve quickly the relevant UNIT instance:
--
-- * @{#UNIT.Find}(): Find a UNIT instance from the _DATABASE object using a DCS Unit object.
-- * @{#UNIT.FindByName}(): Find a UNIT instance from the _DATABASE object using a DCS Unit name.
--
-- IMPORTANT: ONE SHOULD NEVER SANATIZE these UNIT OBJECT REFERENCES! (make the UNIT object references nil).
--
-- DCS UNIT APIs
-- =============
-- 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 @{DCSUnit#Unit.getName}()
-- is implemented in the UNIT class as @{#UNIT.GetName}().
--
-- Additional UNIT APIs
-- ====================
-- The UNIT class comes with additional methods. Find below a summary.
--
-- Smoke, Flare Units
-- ------------------
-- The UNIT class provides methods to smoke or flare units easily.
-- The @{#UNIT.SmokeBlue}(), @{#UNIT.SmokeGreen}(),@{#UNIT.SmokeOrange}(), @{#UNIT.SmokeRed}(), @{#UNIT.SmokeRed}() 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 @{#UNIT.FlareGreen}(), @{#UNIT.FlareRed}(), @{#UNIT.FlareWhite}(), @{#UNIT.FlareYellow}()
-- 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.
--
-- Position, Point
-- ---------------
-- The UNIT class provides methods to obtain the current point or position of the DCS Unit.
-- The @{#UNIT.GetPointVec2}(), @{#UNIT.GetPointVec3}() 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 @{#UNIT.GetPositionVec3}() method respectively.
--
-- Alive
-- -----
-- The @{#UNIT.IsAlive}(), @{#UNIT.IsActive}() methods determines if the DCS Unit is alive, meaning, it is existing and active.
--
-- Test for other units in radius
-- ------------------------------
-- One can test if another DCS Unit is within a given radius of the current DCS Unit, by using the @{#UNIT.OtherUnitInRadius}() method.
--
-- More functions will be added
-- ----------------------------
-- During the MOOSE development, more functions will be added. A complete list of the current functions is below.
--
--
--
--
-- @module Unit
-- @author FlightControl
Include.File( "Routines" )
Include.File( "Base" )
Include.File( "Message" )
--- The UNIT class
-- @type UNIT
-- @extends Base#BASE
-- @field #UNIT.FlareColor FlareColor
-- @field #UNIT.SmokeColor SmokeColor
UNIT = {
ClassName="UNIT",
CategoryName = {
[Unit.Category.AIRPLANE] = "Airplane",
[Unit.Category.HELICOPTER] = "Helicoper",
[Unit.Category.GROUND_UNIT] = "Ground Unit",
[Unit.Category.SHIP] = "Ship",
[Unit.Category.STRUCTURE] = "Structure",
},
FlareColor = {
Green = trigger.flareColor.Green,
Red = trigger.flareColor.Red,
White = trigger.flareColor.White,
Yellow = trigger.flareColor.Yellow
},
SmokeColor = {
Green = trigger.smokeColor.Green,
Red = trigger.smokeColor.Red,
White = trigger.smokeColor.White,
Orange = trigger.smokeColor.Orange,
Blue = trigger.smokeColor.Blue
},
}
--- FlareColor
-- @type UNIT.FlareColor
-- @field Green
-- @field Red
-- @field White
-- @field Yellow
--- SmokeColor
-- @type UNIT.SmokeColor
-- @field Green
-- @field Red
-- @field White
-- @field Orange
-- @field Blue
-- Registration.
--- Create a new UNIT from DCSUnit.
-- @param #UNIT self
-- @param DCSUnit#Unit DCSUnit
-- @param Database#DATABASE Database
-- @return Unit#UNIT
function UNIT:Register( UnitName )
local self = BASE:Inherit( self, BASE:New() )
self:F2( UnitName )
self.UnitName = UnitName
return self
end
-- Reference methods.
--- Finds a UNIT from the _DATABASE using a DCSUnit object.
-- @param #UNIT self
-- @param DCSUnit#Unit DCSUnit An existing DCS Unit object reference.
-- @return Unit#UNIT self
function UNIT:Find( DCSUnit )
local UnitName = DCSUnit:getName()
local UnitFound = _DATABASE:FindUnit( UnitName )
return UnitFound
end
--- Find a UNIT in the _DATABASE using the name of an existing DCS Unit.
-- @param #UNIT self
-- @param #string UnitName The Unit Name.
-- @return Unit#UNIT self
function UNIT:FindByName( UnitName )
local UnitFound = _DATABASE:FindUnit( UnitName )
return UnitFound
end
function UNIT:GetDCSUnit()
local DCSUnit = Unit.getByName( self.UnitName )
if DCSUnit then
return DCSUnit
end
return nil
end
--- Returns coalition of the Unit.
-- @param Unit#UNIT self
-- @return DCSCoalitionObject#coalition.side The side of the coalition.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetCoalition()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitCoalition = DCSUnit:getCoalition()
self:T3( UnitCoalition )
return UnitCoalition
end
return nil
end
--- Returns country of the Unit.
-- @param Unit#UNIT self
-- @return DCScountry#country.id The country identifier.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetCountry()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitCountry = DCSUnit:getCountry()
self:T3( UnitCountry )
return UnitCountry
end
return nil
end
--- Returns DCS Unit object name.
-- The function provides access to non-activated units too.
-- @param Unit#UNIT self
-- @return #string The name of the DCS Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetName()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitName = self.UnitName
return UnitName
end
return nil
end
--- Returns if the unit is alive.
-- @param Unit#UNIT self
-- @return #boolean true if Unit is alive.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:IsAlive()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitIsAlive = DCSUnit:isExist()
return UnitIsAlive
end
return false
end
--- Returns if the unit is activated.
-- @param Unit#UNIT self
-- @return #boolean true if Unit is activated.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:IsActive()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitIsActive = DCSUnit:isActive()
return UnitIsActive
end
return nil
end
--- Returns name of the player that control the unit or nil if the unit is controlled by A.I.
-- @param Unit#UNIT self
-- @return #string Player Name
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetPlayerName()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local PlayerName = DCSUnit:getPlayerName()
if PlayerName == nil then
PlayerName = ""
end
return PlayerName
end
return nil
end
--- Returns the unit's unique identifier.
-- @param Unit#UNIT self
-- @return DCSUnit#Unit.ID Unit ID
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetID()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitID = DCSUnit:getID()
return UnitID
end
return nil
end
--- Returns the unit's number in the group.
-- 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.
-- @param Unit#UNIT self
-- @return #number The Unit number.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetNumber()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitNumber = DCSUnit:getNumber()
return UnitNumber
end
return nil
end
--- Returns the unit's group if it exist and nil otherwise.
-- @param Unit#UNIT self
-- @return Group#GROUP The Group of the Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetGroup()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitGroup = DCSUnit:getGroup()
return UnitGroup
end
return nil
end
--- Returns the unit's callsign - the localized string.
-- @param Unit#UNIT self
-- @return #string The Callsign of the Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetCallSign()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitCallSign = DCSUnit:getCallsign()
return UnitCallSign
end
return nil
end
--- Returns the unit's health. Dead units has health <= 1.0.
-- @param Unit#UNIT self
-- @return #number The Unit's health value.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetLife()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitLife = DCSUnit:getLife()
return UnitLife
end
return nil
end
--- Returns the Unit's initial health.
-- @param Unit#UNIT self
-- @return #number The Unit's initial health value.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetLife0()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitLife0 = DCSUnit:getLife0()
return UnitLife0
end
return nil
end
--- Returns relative amount of fuel (from 0.0 to 1.0) the unit has in its internal tanks. If there are additional fuel tanks the value may be greater than 1.0.
-- @param Unit#UNIT self
-- @return #number The relative amount of fuel (from 0.0 to 1.0).
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetFuel()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitFuel = DCSUnit:getFuel()
return UnitFuel
end
return nil
end
--- Returns the Unit's ammunition.
-- @param Unit#UNIT self
-- @return DCSUnit#Unit.Ammo
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetAmmo()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitAmmo = DCSUnit:getAmmo()
return UnitAmmo
end
return nil
end
--- Returns the unit sensors.
-- @param Unit#UNIT self
-- @return DCSUnit#Unit.Sensors
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetSensors()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitSensors = DCSUnit:getSensors()
return UnitSensors
end
return nil
end
-- Need to add here a function per sensortype
-- unit:hasSensors(Unit.SensorType.RADAR, Unit.RadarType.AS)
--- Returns two values:
--
-- * First value indicates if at least one of the unit's radar(s) is on.
-- * 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.
-- @param Unit#UNIT self
-- @return #boolean Indicates if at least one of the unit's radar(s) is on.
-- @return DCSObject#Object The object of the radar's interest. Not nil only if at least one radar of the unit is tracking a target.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetRadar()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitRadarOn, UnitRadarObject = DCSUnit:getRadar()
return UnitRadarOn, UnitRadarObject
end
return nil, nil
end
-- Need to add here functions to check if radar is on and which object etc.
--- Returns unit descriptor. Descriptor type depends on unit category.
-- @param Unit#UNIT self
-- @return DCSUnit#Unit.Desc The Unit descriptor.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetDesc()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitDesc = DCSUnit:getDesc()
return UnitDesc
end
return nil
end
--- Returns the type name of the DCS Unit.
-- @param Unit#UNIT self
-- @return #string The type name of the DCS Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetTypeName()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitTypeName = DCSUnit:getTypeName()
self:T3( UnitTypeName )
return UnitTypeName
end
return nil
end
--- Returns the prefix name of the DCS Unit. A prefix name is a part of the name before a '#'-sign.
-- DCS Units spawned with the @{SPAWN} 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.
-- @param Unit#UNIT self
-- @return #string The name of the DCS Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetPrefix()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitPrefix = string.match( self.UnitName, ".*#" ):sub( 1, -2 )
self:T3( UnitPrefix )
return UnitPrefix
end
return nil
end
--- Returns the @{DCSTypes#Vec2} vector indicating the point in 2D of the DCS Unit within the mission.
-- @param Unit#UNIT self
-- @return DCSTypes#Vec2 The 2D point vector of the DCS Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetPointVec2()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitPointVec3 = DCSUnit:getPosition().p
local UnitPointVec2 = {}
UnitPointVec2.x = UnitPointVec3.x
UnitPointVec2.y = UnitPointVec3.z
self:T3( UnitPointVec2 )
return UnitPointVec2
end
return nil
end
--- Returns the @{DCSTypes#Vec3} vector indicating the point in 3D of the DCS Unit within the mission.
-- @param Unit#UNIT self
-- @return DCSTypes#Vec3 The 3D point vector of the DCS Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetPointVec3()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitPointVec3 = DCSUnit:getPosition().p
self:T3( UnitPointVec3 )
return UnitPointVec3
end
return nil
end
--- Returns the @{DCSTypes#Position3} position vectors indicating the point and direction vectors in 3D of the DCS Unit within the mission.
-- @param Unit#UNIT self
-- @return DCSTypes#Position The 3D position vectors of the DCS Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetPositionVec3()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitPosition = DCSUnit:getPosition()
self:T3( UnitPosition )
return UnitPosition
end
return nil
end
--- Returns the DCS Unit velocity vector.
-- @param Unit#UNIT self
-- @return DCSTypes#Vec3 The velocity vector
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetVelocity()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitVelocityVec3 = DCSUnit:getVelocity()
self:T3( UnitVelocityVec3 )
return UnitVelocityVec3
end
return nil
end
--- Returns true if the DCS Unit is in the air.
-- @param Unit#UNIT self
-- @return #boolean true if in the air.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:InAir()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitInAir = DCSUnit:inAir()
self:T3( UnitInAir )
return UnitInAir
end
return nil
end
--- Returns the altitude of the DCS Unit.
-- @param Unit#UNIT self
-- @return DCSTypes#Distance The altitude of the DCS Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:GetAltitude()
self:F2()
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitPointVec3 = DCSUnit:getPoint() --DCSTypes#Vec3
return UnitPointVec3.y
end
return nil
end
--- Returns true if there is an **other** DCS Unit within a radius of the current 2D point of the DCS Unit.
-- @param Unit#UNIT self
-- @param Unit#UNIT AwaitUnit The other UNIT wrapper object.
-- @param Radius The radius in meters with the DCS Unit in the centre.
-- @return true If the other DCS Unit is within the radius of the 2D point of the DCS Unit.
-- @return #nil The DCS Unit is not existing or alive.
function UNIT:OtherUnitInRadius( AwaitUnit, Radius )
self:F2( { self.UnitName, AwaitUnit.UnitName, Radius } )
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitPos = self:GetPointVec3()
local AwaitUnitPos = AwaitUnit:GetPointVec3()
if (((UnitPos.x - AwaitUnitPos.x)^2 + (UnitPos.z - AwaitUnitPos.z)^2)^0.5 <= Radius) then
self:T3( "true" )
return true
else
self:T3( "false" )
return false
end
end
return nil
end
--- Returns the DCS Unit category name as defined within the DCS Unit Descriptor.
-- @param Unit#UNIT self
-- @return #string The DCS Unit Category Name
function UNIT:GetCategoryName()
local DCSUnit = self:GetDCSUnit()
if DCSUnit then
local UnitCategoryName = self.CategoryName[ self:GetDesc().category ]
return UnitCategoryName
end
return nil
end
--- Signal a flare at the position of the UNIT.
-- @param #UNIT self
function UNIT:Flare( FlareColor )
self:F2()
trigger.action.signalFlare( self:GetPointVec3(), FlareColor , 0 )
end
--- Signal a white flare at the position of the UNIT.
-- @param #UNIT self
function UNIT:FlareWhite()
self:F2()
trigger.action.signalFlare( self:GetPointVec3(), trigger.flareColor.White , 0 )
end
--- Signal a yellow flare at the position of the UNIT.
-- @param #UNIT self
function UNIT:FlareYellow()
self:F2()
trigger.action.signalFlare( self:GetPointVec3(), trigger.flareColor.Yellow , 0 )
end
--- Signal a green flare at the position of the UNIT.
-- @param #UNIT self
function UNIT:FlareGreen()
self:F2()
trigger.action.signalFlare( self:GetPointVec3(), trigger.flareColor.Green , 0 )
end
--- Signal a red flare at the position of the UNIT.
-- @param #UNIT self
function UNIT:FlareRed()
self:F2()
trigger.action.signalFlare( self:GetPointVec3(), trigger.flareColor.Red, 0 )
end
--- Smoke the UNIT.
-- @param #UNIT self
function UNIT:Smoke( SmokeColor )
self:F2()
trigger.action.smoke( self:GetPointVec3(), SmokeColor )
end
--- Smoke the UNIT Green.
-- @param #UNIT self
function UNIT:SmokeGreen()
self:F2()
trigger.action.smoke( self:GetPointVec3(), trigger.smokeColor.Green )
end
--- Smoke the UNIT Red.
-- @param #UNIT self
function UNIT:SmokeRed()
self:F2()
trigger.action.smoke( self:GetPointVec3(), trigger.smokeColor.Red )
end
--- Smoke the UNIT White.
-- @param #UNIT self
function UNIT:SmokeWhite()
self:F2()
trigger.action.smoke( self:GetPointVec3(), trigger.smokeColor.White )
end
--- Smoke the UNIT Orange.
-- @param #UNIT self
function UNIT:SmokeOrange()
self:F2()
trigger.action.smoke( self:GetPointVec3(), trigger.smokeColor.Orange )
end
--- Smoke the UNIT Blue.
-- @param #UNIT self
function UNIT:SmokeBlue()
self:F2()
trigger.action.smoke( self:GetPointVec3(), trigger.smokeColor.Blue )
end
-- Is methods
--- Returns if the unit is of an air category.
-- If the unit is a helicopter or a plane, then this method will return true, otherwise false.
-- @param #UNIT self
-- @return #boolean Air category evaluation result.
function UNIT:IsAir()
self:F2()
local UnitDescriptor = self.DCSUnit:getDesc()
self:T3( { UnitDescriptor.category, Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } )
local IsAirResult = ( UnitDescriptor.category == Unit.Category.AIRPLANE ) or ( UnitDescriptor.category == Unit.Category.HELICOPTER )
self:T3( IsAirResult )
return IsAirResult
end

View File

@ -0,0 +1,8 @@
echo off
rem Update Missions with a new version of Moose.lua
rem Run this batch file with the following command arguments in Eclipse: "${resource_loc:/Moose/Moose Development/Moose}" "${current_date}"
echo Path to Mission Files: %1
For /R %1 %%G IN (*.miz) do 7z u "%%G" "l10n\DEFAULT\Moose.lua"

16693
Moose Mission Setup/Moose.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,78 @@
ECHO OFF
REM Create Moose.lua File
ECHO Path to Moose *.lua files: %1
ECHO Current Date: %2
ECHO Path to Update Missions: %3
ECHO Dynamic or Static: %4
DEL Moose.lua
IF %4 == D GOTO Dynamic
IF %4 == S GOTO Static
GOTO End
:Dynamic
ECHO Dynamic Moose.lua
REM Create a timestamp with is logged in the DCS.log file.
ECHO env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' ) > Moose.lua
ECHO env.info( 'Moose Generation Timestamp: %2' ) >> Moose.lua
COPY /b Moose.lua + "Moose Create Dynamic\Moose_Dynamic_Loader.lua" Moose.lua
GOTO End
:Static
ECHO Static Moose.lua
REM Create a timestamp with is logged in the DCS.log file.
ECHO env.info( '*** MOOSE STATIC INCLUDE START *** ' ) > Moose.lua
ECHO env.info( 'Moose Generation Timestamp: %2' ) >> Moose.lua
COPY /b Moose.lua + "Moose Create Static\Moose_Static_Loader.lua" Moose.lua
COPY /b Moose.lua + %1\Routines.lua Moose.lua
COPY /b Moose.lua + %1\Base.lua Moose.lua
COPY /b Moose.lua + %1\Scheduler.lua Moose.lua
COPY /b Moose.lua + %1\Event.lua Moose.lua
COPY /b Moose.lua + %1\Menu.lua Moose.lua
COPY /b Moose.lua + %1\Group.lua Moose.lua
COPY /b Moose.lua + %1\Unit.lua Moose.lua
COPY /b Moose.lua + %1\Zone.lua Moose.lua
COPY /b Moose.lua + %1\Client.lua Moose.lua
COPY /b Moose.lua + %1\Database.lua Moose.lua
COPY /b Moose.lua + %1\Moose.lua Moose.lua
COPY /b Moose.lua + %1\Scoring.lua Moose.lua
COPY /b Moose.lua + %1\Cargo.lua Moose.lua
COPY /b Moose.lua + %1\Message.lua Moose.lua
COPY /b Moose.lua + %1\Stage.lua Moose.lua
COPY /b Moose.lua + %1\Task.lua Moose.lua
COPY /b Moose.lua + %1\GoHomeTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyBaseTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyGroupsTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyRadarsTask.lua Moose.lua
COPY /b Moose.lua + %1\DestroyUnitTypesTask.lua Moose.lua
COPY /b Moose.lua + %1\PickupTask.lua Moose.lua
COPY /b Moose.lua + %1\DeployTask.lua Moose.lua
COPY /b Moose.lua + %1\NoTask.lua Moose.lua
COPY /b Moose.lua + %1\RouteTask.lua Moose.lua
COPY /b Moose.lua + %1\Mission.lua Moose.lua
COPY /b Moose.lua + %1\CleanUp.lua Moose.lua
COPY /b Moose.lua + %1\Spawn.lua Moose.lua
COPY /b Moose.lua + %1\Movement.lua Moose.lua
COPY /b Moose.lua + %1\Sead.lua Moose.lua
COPY /b Moose.lua + %1\Escort.lua Moose.lua
COPY /b Moose.lua + %1\MissileTrainer.lua Moose.lua
GOTO End
:End
ECHO env.info( '*** MOOSE INCLUDE END *** ' ) >> Moose.lua
COPY Moose.lua %3

View File

@ -12,7 +12,7 @@ Include.File( "Event" )
do
local Mission = MISSION:New( 'Destroy Gound', 'Ground', 'Briefing', 'CCCP' )
Mission:AddClient( CLIENT:New( 'Client Plane', "Just wait and observe the SU-25T destoying targets. Your mission goal should increase..." ) )
Mission:AddClient( CLIENT:FindByName( 'Client Plane', "Just wait and observe the SU-25T destoying targets. Your mission goal should increase..." ) )
local DESTROYGROUPSTASK = DESTROYGROUPSTASK:New( 'Ground Vehicle', 'Ground Vehicles', { 'DESTROY Test 1' }, 100 ) -- 75% of a patriot battery needs to be destroyed to achieve mission success...
DESTROYGROUPSTASK:SetGoalTotal( 1 )
@ -25,7 +25,7 @@ end
do
local Mission = MISSION:New( 'Destroy Helicopters', 'Helicopters', 'Briefing', 'CCCP' )
Mission:AddClient( CLIENT:New( 'Client Plane', "Just wait and observe the SU-25T destoying the helicopters. The helicopter mission goal should increase once all are destroyed ..." ) )
Mission:AddClient( CLIENT:FindByName( 'Client Plane', "Just wait and observe the SU-25T destoying the helicopters. The helicopter mission goal should increase once all are destroyed ..." ) )
local DESTROYGROUPSTASK = DESTROYGROUPSTASK:New( 'Helicopter', 'Helicopters', { 'DESTROY Test 2' }, 50 )
DESTROYGROUPSTASK:SetGoalTotal( 2 )

View File

@ -53,8 +53,8 @@ do
SpawnEscortGround = SPAWN:New( "Escort Ground" )
SpawnEscortShip = SPAWN:New( "Escort Ship" )
EscortClientHeli = CLIENT:New( "Lead Helicopter", "Fly around and observe the behaviour of the escort helicopter" ):Alive( EventAliveHelicopter )
EscortClientPlane = CLIENT:New( "Lead Plane", "Fly around and observe the behaviour of the escort airplane. Select Navigate->Joun-Up and airplane should follow you. Change speed and directions." )
EscortClientHeli = CLIENT:FindByName( "Lead Helicopter", "Fly around and observe the behaviour of the escort helicopter" ):Alive( EventAliveHelicopter )
EscortClientPlane = CLIENT:FindByName( "Lead Plane", "Fly around and observe the behaviour of the escort airplane. Select Navigate->Joun-Up and airplane should follow you. Change speed and directions." )
:Alive( EventAlivePlane )
end

View File

@ -26,7 +26,7 @@ Group_Vehicle6 = Spawn_Vehicle:Spawn()
Group_Vehicle1:TaskRouteToZone( ZONE:New( "Landing Zone" ), true, 40, "Cone" )
-- Now land the spawned plane on to the Vinson, by copying the route of another object.
Route_Plane = GROUP:NewFromName( "Spawn Helicopter Route Copy" ):CopyRoute( 1, 0 )
Route_Plane = GROUP:FindByName( "Spawn Helicopter Route Copy" ):CopyRoute( 1, 0 )
Group_Plane:Route( Route_Plane )

View File

@ -14,8 +14,8 @@ Include.File( "CleanUp" )
do
local Mission = MISSION:New( 'Pickup', 'Operational', 'Pickup Troops', 'NATO' )
Mission:AddClient( CLIENT:New( 'DE Pickup Test 1' ):Transport() )
Mission:AddClient( CLIENT:New( 'DE Pickup Test 2' ):Transport() )
Mission:AddClient( CLIENT:FindByName( 'DE Pickup Test 1' ):Transport() )
Mission:AddClient( CLIENT:FindByName( 'DE Pickup Test 2' ):Transport() )
local CargoTable = {}
@ -62,7 +62,7 @@ end
do
local Mission = MISSION:New( 'Deliver secret letter', 'Operational', 'Pickup letter to the commander.', 'NATO' )
Client_Package_1 = CLIENT:New( 'BE Package Test 1' ):Transport()
Client_Package_1 = CLIENT:FindByName( 'BE Package Test 1' ):Transport()
Mission:AddClient( Client_Package_1 )
@ -95,8 +95,8 @@ end
do
local Mission = MISSION:New( 'Sling load Cargo', 'Operational', 'Sling Load Cargo to Deploy Zone.', 'NATO' )
Mission:AddClient( CLIENT:New( 'Sling Load Test Client 1' ):Transport() )
Mission:AddClient( CLIENT:New( 'Sling Load Test Client 2' ):Transport() )
Mission:AddClient( CLIENT:FindByName( 'Sling Load Test Client 1' ):Transport() )
Mission:AddClient( CLIENT:FindByName( 'Sling Load Test Client 2' ):Transport() )
Sling_Load_Pickup_Zone = CARGO_ZONE:New( 'Sling Load Pickup Zone', 'Sling Load Guard' ):RedSmoke()

View File

@ -0,0 +1,39 @@
Include.File( "Group" )
Include.File( "Unit" )
Include.File( "Client" )
BASE:TraceClass( "UNIT" )
BASE:TraceClass( "GROUP" )
BASE:TraceClass( "CLIENT" )
UnitTankAI1 = _DATABASE:FindUnit( "Smoke Test 1" )
UnitTankAI2 = _DATABASE:FindUnit( "Smoke Test 2" )
UnitTankAI3 = UNIT:FindByName( "Smoke Test 3" )
UnitTankAI4 = _DATABASE:FindUnit( "Smoke Test 4" )
UnitTankAI1:SmokeBlue()
UnitTankAI3:SmokeOrange()
UnitTankAI2:T( UnitTankAI2:GetAmmo() )
GroupTanks = GROUP:FindByName( "Smoke Test" )
GroupTanks:T( GroupTanks:OptionROEOpenFirePossible() )
GroupTanks:OptionROEOpenFire()
local function ClientAlive( Client, ClientNumber )
GroupTanks:MessageToClient( "Hello Client " .. ClientNumber .. "! We are reporting to you on our way...", 5, Client )
end
ClientHeli = CLIENT:FindByName( "Client Test 1", "Fly slowly to waypoint 3 of the Command Post!" ):Alive( ClientAlive, 1 )
ClientHeli2 = CLIENT:FindByName( "Client Test 2", "Fly slowly to waypoint 3 of the Command Post!" ):Alive( ClientAlive, 2 )

View File

@ -21,6 +21,17 @@
<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="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>
@ -43,10 +54,14 @@
<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="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>

View File

@ -21,6 +21,17 @@
<li>CARGO</li>
<li><a href="CleanUp.html">CleanUp</a></li>
<li><a href="Client.html">Client</a></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>
@ -43,10 +54,14 @@
<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="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>

View File

@ -21,6 +21,17 @@
<li><a href="CARGO.html">CARGO</a></li>
<li>CleanUp</li>
<li><a href="Client.html">Client</a></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>
@ -43,10 +54,14 @@
<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="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>

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>
@ -43,10 +54,14 @@
<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="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>
@ -59,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>
@ -92,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>
@ -164,12 +196,6 @@ Note that clients are NOT the same as Units, they are NOT necessarily alive.</p>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).ClientParameters">CLIENT.ClientParameters</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).ClientPosition">CLIENT:ClientPosition()</a></td>
<td class="summary">
<p>Returns the position of the CLIENT in <a href="DCSTypes.html##(Vec3)">DCSTypes#Vec3</a> format.</p>
</td>
</tr>
<tr>
@ -179,9 +205,15 @@ Note that clients are NOT the same as Units, they are NOT necessarily alive.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).GetAltitude">CLIENT:GetAltitude()</a></td>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).Find">CLIENT:Find(ClientName, ClientBriefing, DCSUnit)</a></td>
<td class="summary">
<p>Returns the altitude of the CLIENT.</p>
<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>
@ -212,48 +244,6 @@ Note that clients are NOT the same as Units, they are NOT necessarily alive.</p>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).GetDCSGroup">CLIENT:GetDCSGroup()</a></td>
<td class="summary">
<p>Return the DCSGroup of a Client.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).GetID">CLIENT:GetID()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).GetName">CLIENT:GetName()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).GetPointVec2">CLIENT:GetPointVec2()</a></td>
<td class="summary">
<p>Returns the position of the CLIENT in <a href="DCSTypes.html##(Vec2)">DCSTypes#Vec2</a> format..</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).GetPositionVec3">CLIENT:GetPositionVec3()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).GetTypeName">CLIENT:GetTypeName()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).GetUnit">CLIENT:GetUnit()</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).IsAlive">CLIENT:IsAlive()</a></td>
<td class="summary">
<p>Checks if client is alive and returns true or false.</p>
</td>
</tr>
<tr>
@ -299,13 +289,13 @@ Note that clients are NOT the same as Units, they are NOT necessarily alive.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).New">CLIENT:New(ClientName, ClientBriefing)</a></td>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).ONBOARDSIDE">CLIENT.ONBOARDSIDE</a></td>
<td class="summary">
<p>Use this method to register new Clients within a mission.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).ONBOARDSIDE">CLIENT.ONBOARDSIDE</a></td>
<td class="name" nowrap="nowrap"><a href="##(CLIENT).Register">CLIENT:Register(ClientName)</a></td>
<td class="summary">
</td>
@ -314,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>
@ -398,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>
@ -433,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">
@ -599,24 +581,6 @@ Function.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).ClientPosition" >
<strong>CLIENT:ClientPosition()</strong>
</a>
</dt>
<dd>
<p>Returns the position of the CLIENT in <a href="DCSTypes.html##(Vec3)">DCSTypes#Vec3</a> format.</p>
<h3>Return value</h3>
<p><em><a href="DCSTypes.html##(Vec3)">DCSTypes#Vec3</a>:</em></p>
</dd>
</dl>
<dl class="function">
@ -636,19 +600,95 @@ Function.</p>
<dl class="function">
<dt>
<a id="#(CLIENT).GetAltitude" >
<strong>CLIENT:GetAltitude()</strong>
<a id="#(CLIENT).Find" >
<strong>CLIENT:Find(ClientName, ClientBriefing, DCSUnit)</strong>
</a>
</dt>
<dd>
<p>Returns the altitude of the CLIENT.</p>
<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="DCSTypes.html##(Distance)">DCSTypes#Distance</a>:</em></p>
<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">
@ -743,105 +783,6 @@ Function.</p>
<p><em><a href="DCSGroup.html##(Group)">DCSGroup#Group</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).GetID" >
<strong>CLIENT:GetID()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).GetName" >
<strong>CLIENT:GetName()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).GetPointVec2" >
<strong>CLIENT:GetPointVec2()</strong>
</a>
</dt>
<dd>
<p>Returns the position of the CLIENT in <a href="DCSTypes.html##(Vec2)">DCSTypes#Vec2</a> format..</p>
<h3>Return value</h3>
<p><em><a href="DCSTypes.html##(Vec2)">DCSTypes#Vec2</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).GetPositionVec3" >
<strong>CLIENT:GetPositionVec3()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).GetTypeName" >
<strong>CLIENT:GetTypeName()</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).GetUnit" >
<strong>CLIENT:GetUnit()</strong>
</a>
</dt>
<dd>
<p> TODO what is this??? check. possible double function.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).IsAlive" >
<strong>CLIENT:IsAlive()</strong>
</a>
</dt>
<dd>
<p>Checks if client is alive and returns true or false.</p>
</dd>
</dl>
<dl class="function">
@ -983,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">
@ -1040,6 +938,27 @@ Text that describes the briefing of the mission when a Player logs into the Clie
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLIENT).Register" >
<strong>CLIENT:Register(ClientName)</strong>
</a>
</dt>
<dd>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em> ClientName </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
@ -1067,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>

View File

@ -46,12 +46,15 @@
<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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>

View File

@ -46,12 +46,15 @@
<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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>

View File

@ -46,12 +46,15 @@
<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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>

View File

@ -46,12 +46,15 @@
<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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>

View File

@ -46,12 +46,15 @@
<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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>
@ -106,6 +109,12 @@
<td class="name" nowrap="nowrap"><a href="##(Group).getCategory">Group:getCategory()</a></td>
<td class="summary">
<p>Returns category of the group.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(Group).getCoalition">Group:getCoalition()</a></td>
<td class="summary">
<p>Returns the coalition of the group.</p>
</td>
</tr>
<tr>
@ -291,6 +300,24 @@
<p><em><a href="##(Group.Category)">#Group.Category</a>:</em></p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(Group).getCoalition" >
<strong>Group:getCoalition()</strong>
</a>
</dt>
<dd>
<p>Returns the coalition of the group.</p>
<h3>Return value</h3>
<p><em><a href="DCSCoalitionObject.html##(coalition.side)">DCSCoalitionObject#coalition.side</a>:</em></p>
</dd>
</dl>
<dl class="function">

View File

@ -46,12 +46,15 @@
<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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>

View File

@ -46,12 +46,15 @@
<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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>

View File

@ -46,12 +46,15 @@
<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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>

View File

@ -46,12 +46,15 @@
<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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>

View File

@ -46,12 +46,15 @@
<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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>

View File

@ -46,12 +46,15 @@
<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="NOTASK.html">NOTASK</a></li>
<li><a href="PICKUPTASK.html">PICKUPTASK</a></li>
<li><a href="ROUTETASK.html">ROUTETASK</a></li>
<li><a href="STAGE.html">STAGE</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="Spawn.html">Spawn</a></li>
<li><a href="StaticObject.html">StaticObject</a></li>
<li><a href="TASK.html">TASK</a></li>

Some files were not shown because too many files have changed in this diff Show More