This commit is contained in:
FlightControl 2017-03-17 13:59:19 +01:00
parent 7231492eaa
commit 3f0c983194
14 changed files with 81 additions and 70405 deletions

View File

@ -256,12 +256,14 @@ do -- ACT_ROUTE_POINT
-- @return #boolean -- @return #boolean
function ACT_ROUTE_POINT:onfuncHasArrived( ProcessUnit ) function ACT_ROUTE_POINT:onfuncHasArrived( ProcessUnit )
local Distance = self.PointVec2:Get2DDistance( ProcessUnit:GetPointVec2() ) if ProcessUnit:IsAlive() then
local Distance = self.PointVec2:Get2DDistance( ProcessUnit:GetPointVec2() )
if Distance <= self.Range then if Distance <= self.Range then
local RouteText = "You have arrived." local RouteText = "You have arrived."
self:Message( RouteText ) self:Message( RouteText )
return true return true
end
end end
return false return false

View File

@ -425,11 +425,11 @@ function EVENT:Init( EventID, EventClass )
-- Each event has a subtable of EventClasses, ordered by EventPriority. -- Each event has a subtable of EventClasses, ordered by EventPriority.
local EventPriority = EventClass:GetEventPriority() local EventPriority = EventClass:GetEventPriority()
if not self.Events[EventID][EventPriority] then if not self.Events[EventID][EventPriority] then
self.Events[EventID][EventPriority] = setmetatable( {}, { __mode = "kv" } ) self.Events[EventID][EventPriority] = setmetatable( {}, { __mode = "k" } )
end end
if not self.Events[EventID][EventPriority][EventClass] then if not self.Events[EventID][EventPriority][EventClass] then
self.Events[EventID][EventPriority][EventClass] = {} self.Events[EventID][EventPriority][EventClass] = setmetatable( {}, { __mode = "v" } )
end end
return self.Events[EventID][EventPriority][EventClass] return self.Events[EventID][EventPriority][EventClass]
end end

View File

@ -1379,10 +1379,10 @@ do -- DETECTION_UNITS
if DetectedItemUnit then if DetectedItemUnit then
self:T(DetectedItemUnit) self:T(DetectedItemUnit)
local UnitCategoryName = DetectedItemUnit:GetCategoryName() local UnitCategoryName = DetectedItemUnit:GetCategoryName() or ""
local UnitCategoryType = DetectedItemUnit:GetTypeName() local UnitCategoryType = DetectedItemUnit:GetTypeName() or ""
if DetectedItem.Type then if DetectedItem.Type and UnitCategoryName and UnitCategoryType then
UnitCategoryText = UnitCategoryName .. " (" .. UnitCategoryType .. ") at " UnitCategoryText = UnitCategoryName .. " (" .. UnitCategoryType .. ") at "
else else
UnitCategoryText = "Unknown target at " UnitCategoryText = "Unknown target at "

View File

@ -50,28 +50,26 @@ do -- TASK_A2G_DISPATCHER
-- @field Set#SET_GROUP SetGroup The groups to which the FAC will report to. -- @field Set#SET_GROUP SetGroup The groups to which the FAC will report to.
-- @field Functional.Detection#DETECTION_BASE Detection The DETECTION_BASE object that is used to report the detected objects. -- @field Functional.Detection#DETECTION_BASE Detection The DETECTION_BASE object that is used to report the detected objects.
-- @field Tasking.Mission#MISSION Mission -- @field Tasking.Mission#MISSION Mission
-- @field Wrapper.Group#GROUP CommandCenter
-- @extends Tasking.DetectionManager#DETECTION_MANAGER -- @extends Tasking.DetectionManager#DETECTION_MANAGER
TASK_A2G_DISPATCHER = { TASK_A2G_DISPATCHER = {
ClassName = "TASK_A2G_DISPATCHER", ClassName = "TASK_A2G_DISPATCHER",
Mission = nil, Mission = nil,
CommandCenter = nil,
Detection = nil, Detection = nil,
} }
--- TASK_A2G_DISPATCHER constructor. --- TASK_A2G_DISPATCHER constructor.
-- @param #TASK_A2G_DISPATCHER self -- @param #TASK_A2G_DISPATCHER self
-- @param Set#SET_GROUP SetGroup -- @param Tasking.Mission#MISSION The mission for which the task dispatching is done.
-- @param Functional.Detection#DETECTION_BASE Detection -- @param Set#SET_GROUP SetGroup The set of groups that can join the tasks within the mission.
-- @param Functional.Detection#DETECTION_BASE Detection The detection results that are used to dynamically assign new tasks to human players.
-- @return #TASK_A2G_DISPATCHER self -- @return #TASK_A2G_DISPATCHER self
function TASK_A2G_DISPATCHER:New( Mission, CommandCenter, SetGroup, Detection ) function TASK_A2G_DISPATCHER:New( Mission, SetGroup, Detection )
-- Inherits from DETECTION_MANAGER -- Inherits from DETECTION_MANAGER
local self = BASE:Inherit( self, DETECTION_MANAGER:New( SetGroup, Detection ) ) -- #TASK_A2G_DISPATCHER local self = BASE:Inherit( self, DETECTION_MANAGER:New( SetGroup, Detection ) ) -- #TASK_A2G_DISPATCHER
self.Detection = Detection self.Detection = Detection
self.CommandCenter = CommandCenter
self.Mission = Mission self.Mission = Mission
self:Schedule( 30 ) self:Schedule( 30 )
@ -245,7 +243,7 @@ do -- TASK_A2G_DISPATCHER
local BAITask = Mission:GetTask( string.format( "BAI.%03d", ItemID ) ) local BAITask = Mission:GetTask( string.format( "BAI.%03d", ItemID ) )
BAITask = self:EvaluateRemoveTask( Mission, BAITask, DetectedItem ) BAITask = self:EvaluateRemoveTask( Mission, BAITask, DetectedItem )
if not BAITask then if not BAITask then
local TargetSetUnit = self:EvaluateBAI( DetectedItem, self.CommandCenter:GetCoalition() ) -- Returns a SetUnit if there are targets to be SEADed... local TargetSetUnit = self:EvaluateBAI( DetectedItem, self.Mission:GetCommandCenter():GetPositionable():GetCoalition() ) -- Returns a SetUnit if there are targets to be SEADed...
if TargetSetUnit then if TargetSetUnit then
local Task = TASK_BAI:New( Mission, self.SetGroup, string.format( "BAI.%03d", ItemID ), TargetSetUnit ) local Task = TASK_BAI:New( Mission, self.SetGroup, string.format( "BAI.%03d", ItemID ), TargetSetUnit )
Task:SetTargetZone( DetectedZone ) Task:SetTargetZone( DetectedZone )
@ -272,12 +270,12 @@ do -- TASK_A2G_DISPATCHER
for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do for TaskGroupID, TaskGroup in pairs( self.SetGroup:GetSet() ) do
if not TaskGroup:GetState( TaskGroup, "Assigned" ) then if not TaskGroup:GetState( TaskGroup, "Assigned" ) then
self.CommandCenter:MessageToGroup( Mission:GetCommandCenter():MessageToGroup(
string.format( "HQ Reporting - Planned tasks for mission '%s':\n%s\n", string.format( "HQ Reporting - Planned tasks for mission '%s':\n%s\n",
self.Mission:GetName(), self.Mission:GetName(),
string.format( "%s\n%s\n%s\n%s", ReportSEAD:Text(), ReportCAS:Text(), ReportBAI:Text(), ReportChanges:Text() string.format( "%s\n%s\n%s\n%s", ReportSEAD:Text(), ReportCAS:Text(), ReportBAI:Text(), ReportChanges:Text()
) )
), self:GetReportDisplayTime(), TaskGroup ), TaskGroup
) )
end end
end end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
--- ---
-- Name: TAD-120 - A2G Task Dispatching DETECTION_UNITS -- Name: TAD-120 - A2G Task Dispatching DETECTION_UNITS
-- Author: FlightControl -- Author: FlightControl
-- Date Created: 13 Mar 2017 -- Date Created: 13 Mar 2017
@ -31,7 +31,7 @@ local FACAreas = DETECTION_UNITS:New( FACSet )
local AttackGroups = SET_GROUP:New():FilterCoalitions( "red" ):FilterPrefixes( "Attack" ):FilterStart() local AttackGroups = SET_GROUP:New():FilterCoalitions( "red" ):FilterPrefixes( "Attack" ):FilterStart()
local TaskDispatcher = TASK_A2G_DISPATCHER:New( Mission, HQ, AttackGroups, FACAreas ) local TaskDispatcher = TASK_A2G_DISPATCHER:New( Mission, AttackGroups, FACAreas )
-- Now this is REALLY neat. I set the goal of the mission to be the destruction of Target #004. -- Now this is REALLY neat. I set the goal of the mission to be the destruction of Target #004.
-- This is just an example, but many more examples can follow... -- This is just an example, but many more examples can follow...

View File

@ -2425,7 +2425,6 @@ The UNIT carrying the package.</p>
<dl class="function"> <dl class="function">
<dt> <dt>
<em></em>
<a id="#(AI_CARGO_UNIT).CargoCarrier" > <a id="#(AI_CARGO_UNIT).CargoCarrier" >
<strong>AI_CARGO_UNIT.CargoCarrier</strong> <strong>AI_CARGO_UNIT.CargoCarrier</strong>
</a> </a>

View File

@ -2117,7 +2117,6 @@ self</p>
<dl class="function"> <dl class="function">
<dt> <dt>
<em>#number</em>
<a id="#(DETECTION_BASE).DetectedItemCount" > <a id="#(DETECTION_BASE).DetectedItemCount" >
<strong>DETECTION_BASE.DetectedItemCount</strong> <strong>DETECTION_BASE.DetectedItemCount</strong>
</a> </a>

View File

@ -190,7 +190,6 @@ on defined intervals (currently every minute).</p>
<dl class="function"> <dl class="function">
<dt> <dt>
<em>#number</em>
<a id="#(MOVEMENT).AliveUnits" > <a id="#(MOVEMENT).AliveUnits" >
<strong>MOVEMENT.AliveUnits</strong> <strong>MOVEMENT.AliveUnits</strong>
</a> </a>
@ -199,9 +198,6 @@ on defined intervals (currently every minute).</p>
<p> Contains the counter how many units are currently alive</p>
</dd> </dd>
</dl> </dl>
<dl class="function"> <dl class="function">

View File

@ -883,12 +883,6 @@ and any spaces before and after the resulting name are removed.</p>
<td class="name" nowrap="nowrap"><a href="##(SPAWN)._TranslateRotate">SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle)</a></td> <td class="name" nowrap="nowrap"><a href="##(SPAWN)._TranslateRotate">SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle)</a></td>
<td class="summary"> <td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SPAWN).uncontrolled">SPAWN.uncontrolled</a></td>
<td class="summary">
</td> </td>
</tr> </tr>
</table> </table>
@ -1876,6 +1870,9 @@ 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> </dd>
</dl> </dl>
<dl class="function"> <dl class="function">
@ -2329,6 +2326,9 @@ when nothing was spawned.</p>
<p> Overwrite unit names by default with group name.</p>
</dd> </dd>
</dl> </dl>
<dl class="function"> <dl class="function">
@ -2343,6 +2343,9 @@ when nothing was spawned.</p>
<p> By default, no InitLimit</p>
</dd> </dd>
</dl> </dl>
<dl class="function"> <dl class="function">
@ -2378,7 +2381,7 @@ when nothing was spawned.</p>
<dl class="function"> <dl class="function">
<dt> <dt>
<em></em> <em>#number</em>
<a id="#(SPAWN).SpawnMaxGroups" > <a id="#(SPAWN).SpawnMaxGroups" >
<strong>SPAWN.SpawnMaxGroups</strong> <strong>SPAWN.SpawnMaxGroups</strong>
</a> </a>
@ -2395,7 +2398,7 @@ when nothing was spawned.</p>
<dl class="function"> <dl class="function">
<dt> <dt>
<em></em> <em>#number</em>
<a id="#(SPAWN).SpawnMaxUnitsAlive" > <a id="#(SPAWN).SpawnMaxUnitsAlive" >
<strong>SPAWN.SpawnMaxUnitsAlive</strong> <strong>SPAWN.SpawnMaxUnitsAlive</strong>
</a> </a>
@ -2713,7 +2716,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
<dl class="function"> <dl class="function">
<dt> <dt>
<em></em> <em>#boolean</em>
<a id="#(SPAWN).SpawnUnControlled" > <a id="#(SPAWN).SpawnUnControlled" >
<strong>SPAWN.SpawnUnControlled</strong> <strong>SPAWN.SpawnUnControlled</strong>
</a> </a>
@ -2737,7 +2740,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
<p> When the first Spawn executes, all the Groups need to be made visible before start.</p> <p> Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.</p>
</dd> </dd>
</dl> </dl>
@ -3376,20 +3379,6 @@ True = Continue Scheduler</p>
</li> </li>
</ul> </ul>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(SPAWN).uncontrolled" >
<strong>SPAWN.uncontrolled</strong>
</a>
</dt>
<dd>
</dd> </dd>
</dl> </dl>

View File

@ -138,12 +138,6 @@ Find a summary below describing for which situation a task type is created:</p>
<td class="name" nowrap="nowrap"><a href="##(TASK_A2G_DISPATCHER).ClassName">TASK_A2G_DISPATCHER.ClassName</a></td> <td class="name" nowrap="nowrap"><a href="##(TASK_A2G_DISPATCHER).ClassName">TASK_A2G_DISPATCHER.ClassName</a></td>
<td class="summary"> <td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(TASK_A2G_DISPATCHER).CommandCenter">TASK_A2G_DISPATCHER.CommandCenter</a></td>
<td class="summary">
</td> </td>
</tr> </tr>
<tr> <tr>
@ -183,7 +177,7 @@ Find a summary below describing for which situation a task type is created:</p>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap="nowrap"><a href="##(TASK_A2G_DISPATCHER).New">TASK_A2G_DISPATCHER:New(SetGroup, Detection, Mission, CommandCenter)</a></td> <td class="name" nowrap="nowrap"><a href="##(TASK_A2G_DISPATCHER).New">TASK_A2G_DISPATCHER:New(The, SetGroup, Detection, Mission)</a></td>
<td class="summary"> <td class="summary">
<p>TASK<em>A2G</em>DISPATCHER constructor.</p> <p>TASK<em>A2G</em>DISPATCHER constructor.</p>
</td> </td>
@ -236,20 +230,6 @@ Find a summary below describing for which situation a task type is created:</p>
</dd>
</dl>
<dl class="function">
<dt>
<em><a href="Wrapper.Group.html##(GROUP)">Wrapper.Group#GROUP</a></em>
<a id="#(TASK_A2G_DISPATCHER).CommandCenter" >
<strong>TASK_A2G_DISPATCHER.CommandCenter</strong>
</a>
</dt>
<dd>
</dd> </dd>
</dl> </dl>
<dl class="function"> <dl class="function">
@ -416,7 +396,7 @@ If there are no targets to be set.</p>
<dt> <dt>
<a id="#(TASK_A2G_DISPATCHER).New" > <a id="#(TASK_A2G_DISPATCHER).New" >
<strong>TASK_A2G_DISPATCHER:New(SetGroup, Detection, Mission, CommandCenter)</strong> <strong>TASK_A2G_DISPATCHER:New(The, SetGroup, Detection, Mission)</strong>
</a> </a>
</dt> </dt>
<dd> <dd>
@ -427,23 +407,26 @@ If there are no targets to be set.</p>
<ul> <ul>
<li> <li>
<p><code><em><a href="Set.html##(SET_GROUP)">Set#SET_GROUP</a> SetGroup </em></code>: </p> <p><code><em><a href="Tasking.Mission.html##(MISSION)">Tasking.Mission#MISSION</a> The </em></code>:
mission for which the task dispatching is done.</p>
</li> </li>
<li> <li>
<p><code><em><a href="Functional.Detection.html##(DETECTION_BASE)">Functional.Detection#DETECTION_BASE</a> Detection </em></code>: </p> <p><code><em><a href="Set.html##(SET_GROUP)">Set#SET_GROUP</a> SetGroup </em></code>:
The set of groups that can join the tasks within the mission.</p>
</li>
<li>
<p><code><em><a href="Functional.Detection.html##(DETECTION_BASE)">Functional.Detection#DETECTION_BASE</a> Detection </em></code>:
The detection results that are used to dynamically assign new tasks to human players.</p>
</li> </li>
<li> <li>
<p><code><em> Mission </em></code>: </p> <p><code><em> Mission </em></code>: </p>
</li>
<li>
<p><code><em> CommandCenter </em></code>: </p>
</li> </li>
</ul> </ul>
<h3>Return value</h3> <h3>Return value</h3>