New revised CLEANUP class

This commit is contained in:
FlightControl
2017-06-30 10:27:44 +02:00
parent 862f2ab3ac
commit 133910ac3b
24 changed files with 524 additions and 577 deletions

View File

@@ -110,13 +110,24 @@
<p>It also prevents airplanes from firing within this area.</p>
<p><img src="..\Presentations\CLEANUP\Dia1.JPG" alt="Banner Image"/></p>
<hr/>
<h3>Author: <strong>Sven Van de Velde (FlightControl)</strong></h3>
<h3>Contributions:</h3>
<hr/>
<h2>Global(s)</h2>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="#CLEANUP">CLEANUP</a></td>
<td class="summary">
<h1>CLEANUP, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
<p>The CLEANUP class keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat.</p>
</td>
</tr>
@@ -124,99 +135,15 @@
<h2><a id="#(CLEANUP)">Type <code>CLEANUP</code></a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP).ClassName">CLEANUP.ClassName</a></td>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP).<">CLEANUP.<</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP).CleanUpList">CLEANUP.CleanUpList</a></td>
<td class="summary">
<p>string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP).CleanUpScheduler">CLEANUP.CleanUpScheduler</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP).New">CLEANUP:New(ZoneNames, TimeInterval)</a></td>
<td class="summary">
<p>Creates the main object which is handling the cleaning of the debris within the given Zone Names.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP).TimeInterval">CLEANUP.TimeInterval</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP).ZoneNames">CLEANUP.ZoneNames</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP)._AddForCleanUp">CLEANUP:_AddForCleanUp(CleanUpUnit, CleanUpUnitName)</a></td>
<td class="summary">
<p>Add the <a href="DCSWrapper.Unit.html##(Unit)">DCSWrapper.Unit#Unit</a> to the CleanUpList for CleanUp.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP)._CleanUpScheduler">CLEANUP:_CleanUpScheduler()</a></td>
<td class="summary">
<p>At the defined time interval, CleanUp the Groups within the CleanUpList.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP)._DestroyGroup">CLEANUP:_DestroyGroup(GroupObject, CleanUpGroupName)</a></td>
<td class="summary">
<p>Destroys a group from the simulator, but checks first if it is still existing!</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP)._DestroyMissile">CLEANUP:_DestroyMissile(MissileObject)</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP)._DestroyUnit">CLEANUP:_DestroyUnit(CleanUpUnit, CleanUpUnitName)</a></td>
<td class="summary">
<p>Destroys a <a href="DCSWrapper.Unit.html##(Unit)">DCSWrapper.Unit#Unit</a> from the simulator, but checks first if it is still existing!</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP)._EventAddForCleanUp">CLEANUP:_EventAddForCleanUp(event, Event)</a></td>
<td class="summary">
<p>Detects if the Unit has an S<em>EVENT</em>ENGINE<em>SHUTDOWN or an S</em>EVENT_HIT within the given ZoneNames.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP)._EventCrash">CLEANUP:_EventCrash(event, Event)</a></td>
<td class="summary">
<p>Detects if a crash event occurs.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP)._EventHitCleanUp">CLEANUP:_EventHitCleanUp(event, Event)</a></td>
<td class="summary">
<p>Detects if the Unit has an S<em>EVENT</em>HIT within the given ZoneNames.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP)._EventShot">CLEANUP:_EventShot(event, Event)</a></td>
<td class="summary">
<p>Detects if a unit shoots a missile.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CLEANUP)._OnEventBirth">CLEANUP:_OnEventBirth(EventData)</a></td>
<td class="summary">
</td>
</tr>
</table>
@@ -225,13 +152,16 @@
<dl class="function">
<dt>
<em><a href="##(CLEANUP)">#CLEANUP</a></em>
<em></em>
<a id="CLEANUP" >
<strong>CLEANUP</strong>
</a>
</dt>
<dd>
<h1>CLEANUP, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
<p>The CLEANUP class keeps airbases clean, and tries to guarantee continuous airbase operations, even under combat.</p>
</dd>
@@ -239,35 +169,18 @@
<h2><a id="#(CleanUp)" >Type <code>CleanUp</code></a></h2>
<h2><a id="#(CLEANUP)" >Type <code>CLEANUP</code></a></h2>
<p>The CLEANUP class.</p>
<h3>Field(s)</h3>
<h3>Field(s)</h3>
<dl class="function">
<dt>
<em>#string</em>
<a id="#(CLEANUP).ClassName" >
<strong>CLEANUP.ClassName</strong>
<em><a href="##(map)">#map</a></em>
<a id="#(CLEANUP).<" >
<strong>CLEANUP.<</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(CLEANUP).CleanUpList" >
<strong>CLEANUP.CleanUpList</strong>
</a>
</dt>
<dd>
<p>string,Wrapper.Airbase#AIRBASE> Airbases Map of Airbases.</p>
</dd>
</dl>
@@ -283,336 +196,13 @@
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLEANUP).New" >
<strong>CLEANUP:New(ZoneNames, TimeInterval)</strong>
</a>
</dt>
<dd>
<p>Creates the main object which is handling the cleaning of the debris within the given Zone Names.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#table ZoneNames </em></code>:
Is a table of zone names where the debris should be cleaned. Also a single string can be passed with one zone name.</p>
</li>
<li>
<p><code><em>#number TimeInterval </em></code>:
The interval in seconds when the clean activity takes place. The default is 300 seconds, thus every 5 minutes.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(CLEANUP)">#CLEANUP</a>:</em></p>
<h3>Usage:</h3>
<pre class="example"><code> -- Clean these Zones.
CleanUpAirports = CLEANUP:New( { 'CLEAN Tbilisi', 'CLEAN Kutaisi' }, 150 )
or
CleanUpTbilisi = CLEANUP:New( 'CLEAN Tbilisi', 150 )
CleanUpKutaisi = CLEANUP:New( 'CLEAN Kutaisi', 600 )</code></pre>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(CLEANUP).TimeInterval" >
<strong>CLEANUP.TimeInterval</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(CLEANUP).ZoneNames" >
<strong>CLEANUP.ZoneNames</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLEANUP)._AddForCleanUp" >
<strong>CLEANUP:_AddForCleanUp(CleanUpUnit, CleanUpUnitName)</strong>
</a>
</dt>
<dd>
<p>Add the <a href="DCSWrapper.Unit.html##(Unit)">DCSWrapper.Unit#Unit</a> to the CleanUpList for CleanUp.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em> CleanUpUnit </em></code>: </p>
</li>
<li>
<p><code><em> CleanUpUnitName </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLEANUP)._CleanUpScheduler" >
<strong>CLEANUP:_CleanUpScheduler()</strong>
</a>
</dt>
<dd>
<p>At the defined time interval, CleanUp the Groups within the CleanUpList.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLEANUP)._DestroyGroup" >
<strong>CLEANUP:_DestroyGroup(GroupObject, CleanUpGroupName)</strong>
</a>
</dt>
<dd>
<p>Destroys a group from the simulator, but checks first if it is still existing!</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Dcs.DCSWrapper.Group.html##(Group)">Dcs.DCSWrapper.Group#Group</a> GroupObject </em></code>:
The object to be destroyed.</p>
</li>
<li>
<p><code><em>#string CleanUpGroupName </em></code>:
The groupname...</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLEANUP)._DestroyMissile" >
<strong>CLEANUP:_DestroyMissile(MissileObject)</strong>
</a>
</dt>
<dd>
<p> TODO check Dcs.DCSTypes#Weapon
- Destroys a missile from the simulator, but checks first if it is still existing!
@param #CLEANUP self
@param Dcs.DCSTypes#Weapon MissileObject</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em> MissileObject </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLEANUP)._DestroyUnit" >
<strong>CLEANUP:_DestroyUnit(CleanUpUnit, CleanUpUnitName)</strong>
</a>
</dt>
<dd>
<p>Destroys a <a href="DCSWrapper.Unit.html##(Unit)">DCSWrapper.Unit#Unit</a> from the simulator, but checks first if it is still existing!</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Dcs.DCSWrapper.Unit.html##(Unit)">Dcs.DCSWrapper.Unit#Unit</a> CleanUpUnit </em></code>:
The object to be destroyed.</p>
</li>
<li>
<p><code><em>#string CleanUpUnitName </em></code>:
The Unit name ...</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLEANUP)._EventAddForCleanUp" >
<strong>CLEANUP:_EventAddForCleanUp(event, Event)</strong>
</a>
</dt>
<dd>
<p>Detects if the Unit has an S<em>EVENT</em>ENGINE<em>SHUTDOWN or an S</em>EVENT_HIT within the given ZoneNames.</p>
<p>If this is the case, add the Group to the CLEANUP List.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Dcs.DCSTypes.html##(Event)">Dcs.DCSTypes#Event</a> event </em></code>: </p>
</li>
<li>
<p><code><em> Event </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLEANUP)._EventCrash" >
<strong>CLEANUP:_EventCrash(event, Event)</strong>
</a>
</dt>
<dd>
<p>Detects if a crash event occurs.</p>
<p>Crashed units go into a CleanUpList for removal.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Dcs.DCSTypes.html##(Event)">Dcs.DCSTypes#Event</a> event </em></code>: </p>
</li>
<li>
<p><code><em> Event </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLEANUP)._EventHitCleanUp" >
<strong>CLEANUP:_EventHitCleanUp(event, Event)</strong>
</a>
</dt>
<dd>
<p>Detects if the Unit has an S<em>EVENT</em>HIT within the given ZoneNames.</p>
<p>If this is the case, destroy the unit.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Dcs.DCSTypes.html##(Event)">Dcs.DCSTypes#Event</a> event </em></code>: </p>
</li>
<li>
<p><code><em> Event </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLEANUP)._EventShot" >
<strong>CLEANUP:_EventShot(event, Event)</strong>
</a>
</dt>
<dd>
<p>Detects if a unit shoots a missile.</p>
<p>If this occurs within one of the zones, then the weapon used must be destroyed.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Dcs.DCSTypes.html##(Event)">Dcs.DCSTypes#Event</a> event </em></code>: </p>
</li>
<li>
<p><code><em> Event </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CLEANUP)._OnEventBirth" >
<strong>CLEANUP:_OnEventBirth(EventData)</strong>
</a>
</dt>
<dd>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em><a href="Core.Event.html##(EVENTDATA)">Core.Event#EVENTDATA</a> EventData </em></code>: </p>
</li>
</ul>
</dd>
</dl>
<h2><a id="#(list)" >Type <code>list</code></a></h2>
<h2><a id="#(map)" >Type <code>map</code></a></h2>
</div>
</div>