mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Documentation of the BASE class
This commit is contained in:
@@ -101,14 +101,17 @@
|
||||
<p>Note: Normally you would not use the BASE class unless you are extending the MOOSE framework with new classes.</p>
|
||||
|
||||
<h2>1.1) BASE constructor</h2>
|
||||
|
||||
<p>Any class derived from BASE, must use the <a href="Core.Base.html##(BASE).New">Core.Base#BASE.New</a> method how this is done.</p>
|
||||
|
||||
<h2>1.2) BASE Trace functionality</h2>
|
||||
|
||||
<p>The BASE class contains trace methods to trace progress within a mission execution of a certain object.
|
||||
Note that these trace methods are inherited by each MOOSE class interiting BASE.
|
||||
As such, each object created from derived class from BASE can use the tracing functions to trace its execution.</p>
|
||||
|
||||
<h2>1.2.1) Tracing functions</h2>
|
||||
<h3>1.2.1) Tracing functions</h3>
|
||||
|
||||
<p>There are basically 3 types of tracing methods available within BASE:</p>
|
||||
|
||||
<ul>
|
||||
@@ -117,7 +120,8 @@ As such, each object created from derived class from BASE can use the tracing fu
|
||||
<li><a href="##(BASE).E">BASE.E</a>: Trace an exception within a function giving optional variables or parameters. An E is indicated at column 44 in the DCS.log file. An exception will always be traced.</li>
|
||||
</ul>
|
||||
|
||||
<h2>1.2.2) Tracing levels</h2>
|
||||
<h3>1.2.2) Tracing levels</h3>
|
||||
|
||||
<p>There are 3 tracing levels within MOOSE. <br/>
|
||||
These tracing levels were defined to avoid bulks of tracing to be generated by lots of objects.</p>
|
||||
|
||||
@@ -130,12 +134,95 @@ These tracing levels were defined to avoid bulks of tracing to be generated by l
|
||||
<li><a href="##(BASE).T3">BASE.T3</a>: Trace further logic within a function giving optional variables or parameters with tracing level 3.</li>
|
||||
</ul>
|
||||
|
||||
<h1>1.3) BASE Inheritance support</h1>
|
||||
<h3>1.2.3) Trace activation.</h3>
|
||||
|
||||
<p>Tracing can be activated in several ways:</p>
|
||||
|
||||
<ul>
|
||||
<li>Switch tracing on or off through the <a href="##(BASE).TraceOnOff">BASE.TraceOnOff</a>() method.</li>
|
||||
<li>Activate all tracing through the <a href="##(BASE).TraceAll">BASE.TraceAll</a>() method.</li>
|
||||
<li>Activate only the tracing of a certain class (name) through the <a href="##(BASE).TraceClass">BASE.TraceClass</a>() method.</li>
|
||||
<li>Activate only the tracing of a certain method of a certain class through the <a href="##(BASE).TraceClassMethod">BASE.TraceClassMethod</a>() method.</li>
|
||||
<li>Activate only the tracing of a certain level through the <a href="##(BASE).TraceLevel">BASE.TraceLevel</a>() method.
|
||||
<h3>1.2.4) Check if tracing is on.</h3></li>
|
||||
</ul>
|
||||
|
||||
<p>The method <a href="##(BASE).IsTrace">BASE.IsTrace</a>() will validate if tracing is activated or not.</p>
|
||||
|
||||
<h2>1.3 DCS simulator Event Handling</h2>
|
||||
|
||||
<p>The BASE class provides methods to catch DCS Events. These are events that are triggered from within the DCS simulator,
|
||||
and handled through lua scripting. MOOSE provides an encapsulation to handle these events more efficiently.
|
||||
Therefore, the BASE class exposes the following event handling functions:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="##(BASE).EventOnBirth">BASE.EventOnBirth</a>(): Handle the birth of a new unit.</li>
|
||||
<li><a href="##(BASE).EventOnBaseCaptured">BASE.EventOnBaseCaptured</a>(): Handle the capturing of an airbase or a helipad.</li>
|
||||
<li><a href="##(BASE).EventOnCrash">BASE.EventOnCrash</a>(): Handle the crash of a unit.</li>
|
||||
<li><a href="##(BASE).EventOnDead">BASE.EventOnDead</a>(): Handle the death of a unit.</li>
|
||||
<li><a href="##(BASE).EventOnEjection">BASE.EventOnEjection</a>(): Handle the ejection of a player out of an airplane.</li>
|
||||
<li><a href="##(BASE).EventOnEngineShutdown">BASE.EventOnEngineShutdown</a>(): Handle the shutdown of an engine.</li>
|
||||
<li><a href="##(BASE).EventOnEngineStartup">BASE.EventOnEngineStartup</a>(): Handle the startup of an engine.</li>
|
||||
<li><a href="##(BASE).EventOnHit">BASE.EventOnHit</a>(): Handle the hit of a shell to a unit.</li>
|
||||
<li><a href="##(BASE).EventOnHumanFailure">BASE.EventOnHumanFailure</a>(): No a clue ...</li>
|
||||
<li><a href="##(BASE).EventOnLand">BASE.EventOnLand</a>(): Handle the event when a unit lands. </li>
|
||||
<li><a href="##(BASE).EventOnMissionStart">BASE.EventOnMissionStart</a>(): Handle the start of the mission.</li>
|
||||
<li><a href="##(BASE).EventOnPilotDead">BASE.EventOnPilotDead</a>(): Handle the event when a pilot is dead.</li>
|
||||
<li><a href="##(BASE).EventOnPlayerComment">BASE.EventOnPlayerComment</a>(): Handle the event when a player posts a comment.</li>
|
||||
<li><a href="##(BASE).EventOnPlayerEnterUnit">BASE.EventOnPlayerEnterUnit</a>(): Handle the event when a player enters a unit.</li>
|
||||
<li><a href="##(BASE).EventOnPlayerLeaveUnit">BASE.EventOnPlayerLeaveUnit</a>(): Handle the event when a player leaves a unit.</li>
|
||||
<li><a href="##(BASE).EventOnBirthPlayerMissionEnd">BASE.EventOnBirthPlayerMissionEnd</a>(): Handle the event when a player ends the mission. (Not a clue what that does).</li>
|
||||
<li><a href="##(BASE).EventOnRefueling">BASE.EventOnRefueling</a>(): Handle the event when a unit is refueling. </li>
|
||||
<li><a href="##(BASE).EventOnShootingEnd">BASE.EventOnShootingEnd</a>(): Handle the event when a unit starts shooting (guns).</li>
|
||||
<li><a href="##(BASE).EventOnShootingStart">BASE.EventOnShootingStart</a>(): Handle the event when a unit ends shooting (guns). </li>
|
||||
<li><a href="##(BASE).EventOnShot">BASE.EventOnShot</a>(): Handle the event when a unit shot a missile.</li>
|
||||
<li><a href="##(BASE).EventOnTakeOff">BASE.EventOnTakeOff</a>(): Handle the event when a unit takes off from a runway.</li>
|
||||
<li><a href="##(BASE).EventOnTookControl">BASE.EventOnTookControl</a>(): Handle the event when a player takes control of a unit.</li>
|
||||
</ul>
|
||||
|
||||
<p>The EventOn() methods provide the <a href="Core.Event.html##(EVENTDATA)">Core.Event#EVENTDATA</a> structure to the event handling function.
|
||||
The <a href="Core.Event.html##(EVENTDATA)">Core.Event#EVENTDATA</a> structure contains an enriched data set of information about the event being handled.</p>
|
||||
|
||||
<p>Find below an example of the prototype how to write an event handling function: </p>
|
||||
|
||||
<pre><code> CommandCenter:EventOnPlayerEnterUnit(
|
||||
--- @param #COMMANDCENTER self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function( self, EventData )
|
||||
local PlayerUnit = EventData.IniUnit
|
||||
for MissionID, Mission in pairs( self:GetMissions() ) do
|
||||
local Mission = Mission -- Tasking.Mission#MISSION
|
||||
Mission:JoinUnit( PlayerUnit )
|
||||
Mission:ReportDetails()
|
||||
end
|
||||
end
|
||||
)
|
||||
</code></pre>
|
||||
|
||||
<p>Note the function( self, EventData ). It takes two parameters:</p>
|
||||
|
||||
<ul>
|
||||
<li>self = the object that is handling the EventOnPlayerEnterUnit.</li>
|
||||
<li>EventData = the <a href="Core.Event.html##(EVENTDATA)">Core.Event#EVENTDATA</a> structure, containing more information of the Event.</li>
|
||||
</ul>
|
||||
|
||||
<h2>1.4) Class identification methods</h2>
|
||||
|
||||
<p>BASE provides methods to get more information of each object:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="##(BASE).GetClassID">BASE.GetClassID</a>(): Gets the ID (number) of the object. Each object created is assigned a number, that is incremented by one.</li>
|
||||
<li><a href="##(BASE).GetClassName">BASE.GetClassName</a>(): Gets the name of the object, which is the name of the class the object was instantiated from.</li>
|
||||
<li><a href="##(BASE).GetClassNameAndID">BASE.GetClassNameAndID</a>(): Gets the name and ID of the object.</li>
|
||||
</ul>
|
||||
|
||||
<h2>1.10) BASE Inheritance (tree) support</h2>
|
||||
|
||||
<p>The following methods are available to support inheritance:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="##(BASE).Inherit">BASE.Inherit</a>: Inherits from a class.</li>
|
||||
<li><a href="##(BASE).Inherited">BASE.Inherited</a>: Returns the parent class from the class.</li>
|
||||
<li><a href="##(BASE).GetParent">BASE.GetParent</a>: Returns the parent object from the object it is handling, or nil if there is no parent object.</li>
|
||||
</ul>
|
||||
|
||||
<h1>Future</h1>
|
||||
@@ -238,25 +325,25 @@ These tracing levels were defined to avoid bulks of tracing to be generated by l
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(BASE).EventOnBirth">BASE:EventOnBirth(EventFunction)</a></td>
|
||||
<td class="summary">
|
||||
<p>Subscribe to a S<em>EVENT</em>BIRTH event.</p>
|
||||
<p>Subscribe to a S_EVENT_BIRTH event.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(BASE).EventOnCrash">BASE:EventOnCrash(EventFunction)</a></td>
|
||||
<td class="summary">
|
||||
<p>Subscribe to a S<em>EVENT</em>CRASH event.</p>
|
||||
<p>Subscribe to a S_EVENT_CRASH event.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(BASE).EventOnDead">BASE:EventOnDead(EventFunction)</a></td>
|
||||
<td class="summary">
|
||||
<p>Subscribe to a S<em>EVENT</em>DEAD event.</p>
|
||||
<p>Subscribe to a S_EVENT_DEAD event.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(BASE).EventOnEjection">BASE:EventOnEjection(EventFunction)</a></td>
|
||||
<td class="summary">
|
||||
<p>Subscribe to a S<em>EVENT</em>EJECTION event.</p>
|
||||
<p>Subscribe to a S_EVENT_EJECTION event.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -274,7 +361,7 @@ These tracing levels were defined to avoid bulks of tracing to be generated by l
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(BASE).EventOnHit">BASE:EventOnHit(EventFunction)</a></td>
|
||||
<td class="summary">
|
||||
<p>Subscribe to a S<em>EVENT</em>HIT event.</p>
|
||||
<p>Subscribe to a S_EVENT_HIT event.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -286,7 +373,7 @@ These tracing levels were defined to avoid bulks of tracing to be generated by l
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(BASE).EventOnLand">BASE:EventOnLand(EventFunction)</a></td>
|
||||
<td class="summary">
|
||||
<p>Subscribe to a S<em>EVENT</em>LAND event.</p>
|
||||
<p>Subscribe to a S_EVENT_LAND event.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -310,13 +397,13 @@ These tracing levels were defined to avoid bulks of tracing to be generated by l
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(BASE).EventOnPlayerEnterUnit">BASE:EventOnPlayerEnterUnit(EventFunction)</a></td>
|
||||
<td class="summary">
|
||||
<p>Subscribe to a S<em>EVENT</em>PLAYER<em>ENTER</em>UNIT event.</p>
|
||||
<p>Subscribe to a S<em>EVENT</em>PLAYER_ENTER_UNIT event.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(BASE).EventOnPlayerLeaveUnit">BASE:EventOnPlayerLeaveUnit(EventFunction)</a></td>
|
||||
<td class="summary">
|
||||
<p>Subscribe to a S<em>EVENT</em>PLAYER<em>LEAVE</em>UNIT event.</p>
|
||||
<p>Subscribe to a S<em>EVENT</em>PLAYER_LEAVE_UNIT event.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -328,7 +415,7 @@ These tracing levels were defined to avoid bulks of tracing to be generated by l
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(BASE).EventOnRefueling">BASE:EventOnRefueling(EventFunction)</a></td>
|
||||
<td class="summary">
|
||||
<p>Subscribe to a S<em>EVENT</em>REFUELING event.</p>
|
||||
<p>Subscribe to a S_EVENT_REFUELING event.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -352,13 +439,13 @@ These tracing levels were defined to avoid bulks of tracing to be generated by l
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(BASE).EventOnShot">BASE:EventOnShot(EventFunction)</a></td>
|
||||
<td class="summary">
|
||||
<p>Subscribe to a S<em>EVENT</em>SHOT event.</p>
|
||||
<p>Subscribe to a S_EVENT_SHOT event.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap="nowrap"><a href="##(BASE).EventOnTakeOff">BASE:EventOnTakeOff(EventFunction)</a></td>
|
||||
<td class="summary">
|
||||
<p>Subscribe to a S<em>EVENT</em>TAKEOFF event.</p>
|
||||
<p>Subscribe to a S_EVENT_TAKEOFF event.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -868,7 +955,7 @@ The function to be called when the event occurs for the unit.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Subscribe to a S<em>EVENT</em>BIRTH event.</p>
|
||||
<p>Subscribe to a S_EVENT_BIRTH event.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
@@ -895,7 +982,7 @@ The function to be called when the event occurs for the unit.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Subscribe to a S<em>EVENT</em>CRASH event.</p>
|
||||
<p>Subscribe to a S_EVENT_CRASH event.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
@@ -922,7 +1009,7 @@ The function to be called when the event occurs for the unit.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Subscribe to a S<em>EVENT</em>DEAD event.</p>
|
||||
<p>Subscribe to a S_EVENT_DEAD event.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
@@ -949,7 +1036,7 @@ The function to be called when the event occurs for the unit.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Subscribe to a S<em>EVENT</em>EJECTION event.</p>
|
||||
<p>Subscribe to a S_EVENT_EJECTION event.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
@@ -1030,7 +1117,7 @@ The function to be called when the event occurs for the unit.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Subscribe to a S<em>EVENT</em>HIT event.</p>
|
||||
<p>Subscribe to a S_EVENT_HIT event.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
@@ -1084,7 +1171,7 @@ The function to be called when the event occurs for the unit.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Subscribe to a S<em>EVENT</em>LAND event.</p>
|
||||
<p>Subscribe to a S_EVENT_LAND event.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
@@ -1192,7 +1279,7 @@ The function to be called when the event occurs for the unit.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Subscribe to a S<em>EVENT</em>PLAYER<em>ENTER</em>UNIT event.</p>
|
||||
<p>Subscribe to a S<em>EVENT</em>PLAYER_ENTER_UNIT event.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
@@ -1219,7 +1306,7 @@ The function to be called when the event occurs for the unit.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Subscribe to a S<em>EVENT</em>PLAYER<em>LEAVE</em>UNIT event.</p>
|
||||
<p>Subscribe to a S<em>EVENT</em>PLAYER_LEAVE_UNIT event.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
@@ -1273,7 +1360,7 @@ The function to be called when the event occurs for the unit.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Subscribe to a S<em>EVENT</em>REFUELING event.</p>
|
||||
<p>Subscribe to a S_EVENT_REFUELING event.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
@@ -1381,7 +1468,7 @@ The function to be called when the event occurs for the unit.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Subscribe to a S<em>EVENT</em>SHOT event.</p>
|
||||
<p>Subscribe to a S_EVENT_SHOT event.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
@@ -1408,7 +1495,7 @@ The function to be called when the event occurs for the unit.</p>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<p>Subscribe to a S<em>EVENT</em>TAKEOFF event.</p>
|
||||
<p>Subscribe to a S_EVENT_TAKEOFF event.</p>
|
||||
|
||||
<h3>Parameter</h3>
|
||||
<ul>
|
||||
@@ -1975,10 +2062,10 @@ Switch the tracing on or off.</p>
|
||||
</ul>
|
||||
<h3>Usage:</h3>
|
||||
<pre class="example"><code>-- Switch the tracing On
|
||||
BASE:TraceOn( true )
|
||||
BASE:TraceOnOff( true )
|
||||
|
||||
-- Switch the tracing Off
|
||||
BASE:TraceOn( false )</code></pre>
|
||||
BASE:TraceOnOff( false )</code></pre>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@@ -2427,6 +2427,7 @@ The UNIT carrying the package.</p>
|
||||
<dl class="function">
|
||||
<dt>
|
||||
|
||||
<em></em>
|
||||
<a id="#(AI_CARGO_UNIT).CargoCarrier" >
|
||||
<strong>AI_CARGO_UNIT.CargoCarrier</strong>
|
||||
</a>
|
||||
|
||||
@@ -1702,9 +1702,6 @@ The group that was spawned. You can use this group for further actions.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<p> Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="function">
|
||||
|
||||
Reference in New Issue
Block a user