Many Fixes

This commit is contained in:
FlightControl_Master 2017-08-08 09:42:42 +02:00
parent 63866e4aa9
commit 2aecf45316
26 changed files with 455 additions and 138 deletions

View File

@ -448,8 +448,7 @@ function AI_A2A:onafterStatus()
end
local Fuel = self.Controllable:GetUnit(1):GetFuel()
local Fuel = self.Controllable:GetFuel()
self:F({Fuel=Fuel})
if Fuel < self.PatrolFuelThresholdPercentage then
if self.TankerName then
@ -510,27 +509,23 @@ end
--- @param Wrapper.Group#GROUP AIGroup
function AI_A2A.RTBRoute( AIGroup )
function AI_A2A.RTBRoute( AIGroup, Fsm )
AIGroup:F( { "AI_A2A.RTBRoute:", AIGroup:GetName() } )
if AIGroup:IsAlive() then
local _AI_A2A = AIGroup:GetState( AIGroup, "AI_A2A" ) -- #AI_A2A
_AI_A2A:__RTB( 0.5 )
local Task = AIGroup:TaskOrbitCircle( 4000, 400 )
AIGroup:SetTask( Task )
Fsm:__RTB( 0.5 )
end
end
--- @param Wrapper.Group#GROUP AIGroup
function AI_A2A.RTBHold( AIGroup )
function AI_A2A.RTBHold( AIGroup, Fsm )
AIGroup:F( { "AI_A2A.RTBHold:", AIGroup:GetName() } )
if AIGroup:IsAlive() then
local _AI_A2A = AIGroup:GetState( AIGroup, "AI_A2A" ) -- #AI_A2A
_AI_A2A:__RTB( 0.5 )
_AI_A2A:Return()
Fsm:__RTB( 0.5 )
Fsm:Return()
local Task = AIGroup:TaskOrbitCircle( 4000, 400 )
AIGroup:SetTask( Task )
end
@ -590,11 +585,11 @@ function AI_A2A:onafterRTB( AIGroup, From, Event, To )
AIGroup:WayPointInitialize( EngageRoute )
local Tasks = {}
Tasks[#Tasks+1] = AIGroup:TaskFunction( 1, 1, "AI_A2A.RTBRoute" )
Tasks[#Tasks+1] = AIGroup:TaskFunction( "AI_A2A.RTBRoute", self )
Tasks[#Tasks+1] = AIGroup:TaskOrbitCircle( 4000, 350 )
EngageRoute[#EngageRoute].task = AIGroup:TaskCombo( Tasks )
AIGroup:SetState( AIGroup, "AI_A2A", self )
--AIGroup:SetState( AIGroup, "AI_A2A", self )
--- NOW ROUTE THE GROUP!
AIGroup:SetTask( AIGroup:TaskRoute( EngageRoute ), 1 )
@ -628,11 +623,11 @@ function AI_A2A:onafterHold( AIGroup, From, Event, To, HoldTime )
local OrbitTask = AIGroup:TaskOrbitCircle( math.random( self.PatrolFloorAltitude, self.PatrolCeilingAltitude ), self.PatrolMinSpeed )
local TimedOrbitTask = AIGroup:TaskControlled( OrbitTask, AIGroup:TaskCondition( nil, nil, nil, nil, HoldTime , nil ) )
local RTBTask = AIGroup:TaskFunction( 1, 1, "AI_A2A.RTBHold" )
local RTBTask = AIGroup:TaskFunction( "AI_A2A.RTBHold", self )
local OrbitHoldTask = AIGroup:TaskOrbitCircle( 4000, self.PatrolMinSpeed )
AIGroup:SetState( AIGroup, "AI_A2A", self )
--AIGroup:SetState( AIGroup, "AI_A2A", self )
AIGroup:SetTask( AIGroup:TaskCombo( { TimedOrbitTask, RTBTask, OrbitHoldTask } ), 0 )
end
@ -640,13 +635,11 @@ function AI_A2A:onafterHold( AIGroup, From, Event, To, HoldTime )
end
--- @param Wrapper.Group#GROUP AIGroup
function AI_A2A.Resume( AIGroup )
function AI_A2A.Resume( AIGroup, Fsm )
AIGroup:F( { "AI_A2A.Resume:", AIGroup:GetName() } )
if AIGroup:IsAlive() then
local _AI_A2A = AIGroup:GetState( AIGroup, "AI_A2A" ) -- #AI_A2A
_AI_A2A:__RTB( 0.5 )
--_AI_A2A:Retur()
Fsm:__RTB( 0.5 )
end
end
@ -689,9 +682,9 @@ function AI_A2A:onafterRefuel( AIGroup, From, Event, To )
local Tasks = {}
Tasks[#Tasks+1] = AIGroup:TaskRefueling()
Tasks[#Tasks+1] = AIGroup:TaskFunction( 1, 1, self:GetClassName() .. ".Resume" )
Tasks[#Tasks+1] = AIGroup:TaskFunction( self:GetClassName() .. ".Resume", self )
RefuelRoute[#RefuelRoute].task = AIGroup:TaskCombo( Tasks )
AIGroup:SetState( AIGroup, "AI_A2A", self )
--AIGroup:SetState( AIGroup, "AI_A2A", self )
--- NOW ROUTE THE GROUP!
AIGroup:SetTask( AIGroup:TaskRoute( RefuelRoute ), 1 )

View File

@ -348,16 +348,12 @@ end
-- todo: need to fix this global function
--- @param Wrapper.Group#GROUP AIGroup
function AI_A2A_CAP.AttackRoute( AIGroup )
function AI_A2A_CAP.AttackRoute( AIGroup, Fsm )
AIGroup:F( { "AI_A2A_CAP.AttackRoute:", AIGroup:GetName() } )
if AIGroup:IsAlive() then
local _AI_A2A_CAP = AIGroup:GetState( AIGroup, "AI_A2A_CAP" ) -- AI.AI_Cap#AI_A2A_CAP
_AI_A2A_CAP:__Engage( 0.5 )
--local Task = AIGroup:TaskOrbitCircle( 4000, 400 )
--AIGroup:SetTask( Task )
Fsm:__Engage( 0.5 )
end
end
@ -441,13 +437,12 @@ function AI_A2A_CAP:onafterEngage( AIGroup, From, Event, To, AttackSetUnit )
AIGroup:OptionROEOpenFire()
AIGroup:OptionROTPassiveDefense()
AttackTasks[#AttackTasks+1] = AIGroup:TaskFunction( 1, 1, "AI_A2A_CAP.AttackRoute" )
--AttackTasks[#AttackTasks+1] = AIGroup:TaskOrbitCircle( AIGroup:GetHeight(), self.PatrolMinSpeed )
AttackTasks[#AttackTasks+1] = AIGroup:TaskFunction( "AI_A2A_CAP.AttackRoute", self )
EngageRoute[1].task = AIGroup:TaskCombo( AttackTasks )
--- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ...
AIGroup:SetState( AIGroup, "AI_A2A_CAP", self )
--AIGroup:SetState( AIGroup, "AI_A2A_CAP", self )
end
--- NOW ROUTE THE GROUP!

View File

@ -2921,7 +2921,7 @@ do -- AI_A2A_DISPATCHER
for Defender, DefenderTask in pairs( self:GetDefenderTasks() ) do
local Defender = Defender -- Wrapper.Group#GROUP
if DefenderTask.Target and DefenderTask.Target.Index == DetectedItem.Index then
local Fuel = Defender:GetUnit(1):GetFuel() * 100
local Fuel = Defender:GetFuel() * 100
local Damage = Defender:GetLife() / Defender:GetLife0() * 100
Report:Add( string.format( " - %s ( %s - %s ): ( #%d ) F: %3d, D:%3d - %s",
Defender:GetName(),
@ -2944,7 +2944,7 @@ do -- AI_A2A_DISPATCHER
local Defender = Defender -- Wrapper.Group#GROUP
if not DefenderTask.Target then
local DefenderHasTask = Defender:HasTask()
local Fuel = Defender:GetUnit(1):GetFuel() * 100
local Fuel = Defender:GetFuel() * 100
local Damage = Defender:GetLife() / Defender:GetLife0() * 100
Report:Add( string.format( " - %s ( %s - %s ): ( #%d ) F: %3d, D:%3d - %s",
Defender:GetName(),

View File

@ -311,13 +311,12 @@ end
-- todo: need to fix this global function
--- @param Wrapper.Group#GROUP AIControllable
function AI_A2A_GCI.InterceptRoute( AIGroup )
function AI_A2A_GCI.InterceptRoute( AIGroup, Fsm )
AIGroup:F( { "AI_A2A_GCI.InterceptRoute:", AIGroup:GetName() } )
if AIGroup:IsAlive() then
local _AI_A2A_GCI = AIGroup:GetState( AIGroup, "AI_A2A_GCI" ) -- AI.AI_Cap#AI_A2A_GCI
_AI_A2A_GCI:__Engage( 0.5 )
Fsm:__Engage( 0.5 )
--local Task = AIGroup:TaskOrbitCircle( 4000, 400 )
--AIGroup:SetTask( Task )
@ -417,12 +416,11 @@ function AI_A2A_GCI:onafterEngage( AIGroup, From, Event, To, AttackSetUnit )
AIGroup:OptionROEOpenFire()
AIGroup:OptionROTPassiveDefense()
AttackTasks[#AttackTasks+1] = AIGroup:TaskFunction( 1, 1, "AI_A2A_GCI.InterceptRoute" )
--AttackTasks[#AttackTasks+1] = AIGroup:TaskOrbitCircle( AIGroup:GetHeight(), self.EngageMinSpeed )
AttackTasks[#AttackTasks+1] = AIGroup:TaskFunction( "AI_A2A_GCI.InterceptRoute", self )
EngageRoute[#EngageRoute].task = AIGroup:TaskCombo( AttackTasks )
--- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ...
AIGroup:SetState( AIGroup, "AI_A2A_GCI", self )
--AIGroup:SetState( AIGroup, "AI_A2A_GCI", self )
end
--- NOW ROUTE THE GROUP!

View File

@ -317,13 +317,12 @@ end
--- @param Wrapper.Group#GROUP AIGroup
-- This statis method is called from the route path within the last task at the last waaypoint of the Controllable.
-- Note that this method is required, as triggers the next route when patrolling for the Controllable.
function AI_A2A_PATROL.PatrolRoute( AIGroup )
function AI_A2A_PATROL.PatrolRoute( AIGroup, Fsm )
AIGroup:F( { "AI_A2A_PATROL.PatrolRoute:", AIGroup:GetName() } )
if AIGroup:IsAlive() then
local _AI_A2A_Patrol = AIGroup:GetState( AIGroup, "AI_A2A_PATROL" ) -- #AI_A2A_PATROL
_AI_A2A_Patrol:Route()
Fsm:Route()
end
end
@ -372,12 +371,12 @@ function AI_A2A_PATROL:onafterRoute( AIGroup, From, Event, To )
PatrolRoute[#PatrolRoute+1] = ToPatrolRoutePoint
local Tasks = {}
Tasks[#Tasks+1] = AIGroup:TaskFunction( 1, 1, "AI_A2A_PATROL.PatrolRoute" )
Tasks[#Tasks+1] = AIGroup:TaskFunction( "AI_A2A_PATROL.PatrolRoute", self )
PatrolRoute[#PatrolRoute].task = AIGroup:TaskCombo( Tasks )
--- Do a trick, link the NewPatrolRoute function of the PATROLGROUP object to the AIControllable in a temporary variable ...
AIGroup:SetState( AIGroup, "AI_A2A_PATROL", self )
--AIGroup:SetState( AIGroup, "AI_A2A_PATROL", self )
AIGroup:OptionROEReturnFire()
AIGroup:OptionROTPassiveDefense()

View File

@ -105,6 +105,7 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
if Scheduler then
local MasterObject = tostring(Scheduler.MasterObject)
local Schedule = self.Schedule[Scheduler][CallID]
--self:T3( { Schedule = Schedule } )
@ -135,6 +136,9 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
local CurrentTime = timer.getTime()
local StartTime = Schedule.StartTime
self:F3( { Master = MasterObject, CurrentTime = CurrentTime, StartTime = StartTime, Start = Start, Repeat = Repeat, Randomize = Randomize, Stop = Stop } )
if Status and (( Result == nil ) or ( Result and Result ~= false ) ) then
if Repeat ~= 0 and ( ( Stop == 0 ) or ( Stop ~= 0 and CurrentTime <= StartTime + Stop ) ) then
local ScheduleTime =

View File

@ -875,7 +875,7 @@ function ESCORT:_AttackTarget( DetectedItemID )
end, Tasks
)
Tasks[#Tasks+1] = EscortGroup:TaskFunction( 1, 2, "_Resume", { "''" } )
Tasks[#Tasks+1] = EscortGroup:TaskFunction( "_Resume", { "''" } )
EscortGroup:SetTask(
EscortGroup:TaskCombo(

View File

@ -95,6 +95,22 @@
-- * @{#CONTROLLABLE.TaskCondition}: Return a condition section for a controlled task.
-- * @{#CONTROLLABLE.TaskControlled}: Return a Controlled Task taking a Task and a TaskCondition.
--
-- ### Call a function as a Task
--
-- A function can be called which is part of a Task. The method @{#CONTROLLABLE.TaskFunction}() prepares
-- a Task that can call a GLOBAL function from within the Controller execution.
-- This method can also be used to **embed a function call when a certain waypoint has been reached**.
-- See below the **Tasks at Waypoints** section.
--
-- Demonstration Mission: [GRP-502 - Route at waypoint to random point](https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/GRP - Group Commands/GRP-502 - Route at waypoint to random point)
--
-- ### Tasks at Waypoints
--
-- Special Task methods are available to set tasks at certain waypoints.
-- The method @{#CONTROLLABLE.SetTaskAtWaypoint}() helps preparing a Route, embedding a Task at the Waypoint of the Route.
--
-- This creates a Task element, with an action to call a function as part of a Wrapped Task.
--
-- ### Obtain the mission from controllable templates
--
-- Controllable templates contain complete mission descriptions. Sometimes you want to copy a complete mission from a controllable and assign it to another:
@ -257,6 +273,16 @@ function CONTROLLABLE:GetLife0()
return nil
end
--- Returns relative amount of fuel (from 0.0 to 1.0) the unit has in its internal tanks.
-- This method returns nil to ensure polymorphic behaviour! This method needs to be overridden by GROUP or UNIT.
-- @param #CONTROLLABLE self
-- @return #nil The CONTROLLABLE is not existing or alive.
function CONTROLLABLE:GetFuel()
self:F( self.ControllableName )
return nil
end
@ -453,7 +479,7 @@ function CONTROLLABLE:TaskWrappedAction( DCSCommand, Index )
DCSTaskWrappedAction = {
id = "WrappedAction",
enabled = true,
number = Index,
number = Index or 1,
auto = false,
params = {
action = DCSCommand,
@ -464,6 +490,23 @@ function CONTROLLABLE:TaskWrappedAction( DCSCommand, Index )
return DCSTaskWrappedAction
end
--- Set a Task at a Waypoint using a Route list.
-- @param #CONTROLLABLE self
-- @param Wrapper.Controllable#CONTROLLABLE.RouteList RouteList A list of Waypoints.
-- @param #number WaypointNumber The number of the Waypoint. The first Waypoint starts at 1!
-- @param Dcs.DCSTasking.Task#Task Task The Task structure to be executed!
-- @return Dcs.DCSTasking.Task#Task
function CONTROLLABLE:SetTaskAtWaypoint( RouteList, WaypointNumber, Task )
RouteList[ WaypointNumber ].task = self:TaskCombo( { Task } )
self:T3( { RouteList[ WaypointNumber ].task } )
return RouteList[ WaypointNumber ].task
end
--- Executes a command action
-- @param #CONTROLLABLE self
-- @param Dcs.DCSCommand#Command DCSCommand
@ -1480,6 +1523,84 @@ function CONTROLLABLE:TaskEmbarkToTransport( Point, Radius )
return DCSTask
end
--- This creates a Task element, with an action to call a function as part of a Wrapped Task.
-- This Task can then be embedded at a Waypoint by calling the method @{#CONTROLLABLE.SetTaskAtWaypoint}.
-- @param #CONTROLLABLE self
-- @param #string FunctionString The function name embedded as a string that will be called.
-- @param ... The variable arguments passed to the function when called! These arguments can be of any type!
-- @return #CONTROLLABLE
-- @usage
--
-- local ZoneList = {
-- ZONE:New( "ZONE1" ),
-- ZONE:New( "ZONE2" ),
-- ZONE:New( "ZONE3" ),
-- ZONE:New( "ZONE4" ),
-- ZONE:New( "ZONE5" )
-- }
--
-- GroundGroup = GROUP:FindByName( "Vehicle" )
--
-- --- @param Wrapper.Group#GROUP GroundGroup
-- function RouteToZone( Vehicle, ZoneRoute )
--
-- local Route = {}
--
-- Vehicle:E( { ZoneRoute = ZoneRoute } )
--
-- Vehicle:MessageToAll( "Moving to zone " .. ZoneRoute:GetName(), 10 )
--
-- -- Get the current coordinate of the Vehicle
-- local FromCoord = Vehicle:GetCoordinate()
--
-- -- Select a random Zone and get the Coordinate of the new Zone.
-- local RandomZone = ZoneList[ math.random( 1, #ZoneList ) ] -- Core.Zone#ZONE
-- local ToCoord = RandomZone:GetCoordinate()
--
-- -- Create a "ground route point", which is a "point" structure that can be given as a parameter to a Task
-- Route[#Route+1] = FromCoord:RoutePointGround( 72 )
-- Route[#Route+1] = ToCoord:RoutePointGround( 60, "Vee" )
--
-- local TaskRouteToZone = Vehicle:TaskFunction( "RouteToZone", RandomZone )
--
-- Vehicle:SetTaskAtWaypoint( Route, #Route, TaskRouteToZone ) -- Set for the given Route at Waypoint 2 the TaskRouteToZone.
--
-- Vehicle:Route( Route, math.random( 10, 20 ) ) -- Move after a random seconds to the Route. See the Route method for details.
--
-- end
--
-- RouteToZone( GroundGroup, ZoneList[1] )
--
function CONTROLLABLE:TaskFunction( FunctionString, ... )
self:F2( { FunctionString, arg } )
local DCSTask
local DCSScript = {}
DCSScript[#DCSScript+1] = "local MissionControllable = GROUP:Find( ... ) "
if arg and arg.n > 0 then
local ArgumentKey = tostring( arg )
self:SetState( self, ArgumentKey, arg )
DCSScript[#DCSScript+1] = "local Arguments = MissionControllable:GetState( MissionControllable, '" .. ArgumentKey .. "' ) "
DCSScript[#DCSScript+1] = "MissionControllable:ClearState( MissionControllable, '" .. ArgumentKey .. "' ) "
DCSScript[#DCSScript+1] = FunctionString .. "( MissionControllable, unpack( Arguments ) )"
else
DCSScript[#DCSScript+1] = FunctionString .. "( MissionControllable )"
end
DCSTask = self:TaskWrappedAction(
self:CommandDoScript(
table.concat( DCSScript )
)
)
self:T( DCSTask )
return DCSTask
end
--- (AIR + GROUND) Return a mission task from a mission template.
@ -1620,19 +1741,16 @@ end
--- Make the controllable to follow a given route.
-- @param #CONTROLLABLE self
-- @param #table GoPoints A table of Route Points.
-- @return #CONTROLLABLE self
function CONTROLLABLE:Route( GoPoints )
self:F2( GoPoints )
-- @param #table Route A table of Route Points.
-- @param #number DelaySeconds Wait for the specified seconds before executing the Route.
-- @return #CONTROLLABLE The CONTROLLABLE.
function CONTROLLABLE:Route( Route, DelaySeconds )
self:F2( Route )
local DCSControllable = self:GetDCSObject()
if DCSControllable then
local Points = routines.utils.deepCopy( GoPoints )
local MissionTask = { id = 'Mission', params = { route = { points = Points, }, }, }
local Controller = self:_GetController()
--Controller.setTask( Controller, MissionTask )
self.TaskScheduler:Schedule( Controller, Controller.setTask, { MissionTask }, 1 )
local RouteTask = self:TaskRoute( Route ) -- Create a RouteTask, that will route the CONTROLLABLE to the Route.
self:SetTask( RouteTask, DelaySeconds or 1 ) -- Execute the RouteTask after the specified seconds (default is 1).
return self
end
@ -2321,37 +2439,11 @@ function CONTROLLABLE:WayPointFunction( WayPoint, WayPointIndex, WayPointFunctio
self:F2( { WayPoint, WayPointIndex, WayPointFunction } )
table.insert( self.WayPoints[WayPoint].task.params.tasks, WayPointIndex )
self.WayPoints[WayPoint].task.params.tasks[WayPointIndex] = self:TaskFunction( WayPoint, WayPointIndex, WayPointFunction, arg )
self.WayPoints[WayPoint].task.params.tasks[WayPointIndex] = self:TaskFunction( WayPointFunction, arg )
return self
end
function CONTROLLABLE:TaskFunction( WayPoint, WayPointIndex, FunctionString, FunctionArguments )
self:F2( { WayPoint, WayPointIndex, FunctionString, FunctionArguments } )
local DCSTask
local DCSScript = {}
DCSScript[#DCSScript+1] = "local MissionControllable = GROUP:Find( ... ) "
if FunctionArguments and #FunctionArguments > 0 then
DCSScript[#DCSScript+1] = FunctionString .. "( MissionControllable, " .. table.concat( FunctionArguments, "," ) .. ")"
else
DCSScript[#DCSScript+1] = FunctionString .. "( MissionControllable )"
end
DCSTask = self:TaskWrappedAction(
self:CommandDoScript(
table.concat( DCSScript )
), WayPointIndex
)
self:T( DCSTask )
return DCSTask
end
--- Executes the WayPoint plan.
-- The function gets a WayPoint parameter, that you can use to restart the mission at a specific WayPoint.
-- Note that when the WayPoint parameter is used, the new start mission waypoint of the controllable will be 1!

View File

@ -565,6 +565,32 @@ function GROUP:GetHeading()
end
--- Returns relative amount of fuel (from 0.0 to 1.0) the group has in its internal tanks. If there are additional fuel tanks the value may be greater than 1.0.
-- @param #GROUP self
-- @return #number The relative amount of fuel (from 0.0 to 1.0).
-- @return #nil The GROUP is not existing or alive.
function GROUP:GetFuel()
self:F( self.ControllableName )
local DCSControllable = self:GetDCSObject()
if DCSControllable then
local GroupSize = self:GetSize()
local TotalFuel = 0
for UnitID, UnitData in pairs( self:GetUnits() ) do
local Unit = UnitData -- Wrapper.Unit#UNIT
local UnitFuel = Unit:GetFuel()
self:F( { Fuel = UnitFuel } )
TotalFuel = TotalFuel + UnitFuel
end
local GroupFuel = TotalFuel / GroupSize
return GroupFuel
end
return 0
end
do -- Is Zone methods
--- Returns true if all units of the group are within a @{Zone}.

View File

@ -14,7 +14,7 @@
-- @extends Wrapper.Identifiable#IDENTIFIABLE
--- @type POSITIONABLE
-- @extends POSITIONABLE.__
-- @extends Wrapper.Identifiable#IDENTIFIABLE
--- # POSITIONABLE class, extends @{Identifiable#IDENTIFIABLE}

View File

@ -486,12 +486,12 @@ function UNIT:GetRadar()
return nil, 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.
--- 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 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 )
self:F( self.UnitName )
local DCSUnit = self:GetDCSObject()

View File

@ -341,13 +341,13 @@
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A).RTBHold">AI_A2A.RTBHold(AIGroup)</a></td>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A).RTBHold">AI_A2A.RTBHold(AIGroup, Fsm)</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A).RTBRoute">AI_A2A.RTBRoute(AIGroup)</a></td>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A).RTBRoute">AI_A2A.RTBRoute(AIGroup, Fsm)</a></td>
<td class="summary">
</td>
@ -359,7 +359,7 @@
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A).Resume">AI_A2A.Resume(AIGroup)</a></td>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A).Resume">AI_A2A.Resume(AIGroup, Fsm)</a></td>
<td class="summary">
</td>
@ -1476,19 +1476,24 @@ Return false to cancel Transition.</p>
<dt>
<a id="#(AI_A2A).RTBHold" >
<strong>AI_A2A.RTBHold(AIGroup)</strong>
<strong>AI_A2A.RTBHold(AIGroup, Fsm)</strong>
</a>
</dt>
<dd>
<h3>Parameter</h3>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Wrapper.Group.html##(GROUP)">Wrapper.Group#GROUP</a> AIGroup </em></code>: </p>
</li>
<li>
<p><code><em> Fsm </em></code>: </p>
</li>
</ul>
</dd>
@ -1497,19 +1502,24 @@ Return false to cancel Transition.</p>
<dt>
<a id="#(AI_A2A).RTBRoute" >
<strong>AI_A2A.RTBRoute(AIGroup)</strong>
<strong>AI_A2A.RTBRoute(AIGroup, Fsm)</strong>
</a>
</dt>
<dd>
<h3>Parameter</h3>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Wrapper.Group.html##(GROUP)">Wrapper.Group#GROUP</a> AIGroup </em></code>: </p>
</li>
<li>
<p><code><em> Fsm </em></code>: </p>
</li>
</ul>
</dd>
@ -1531,19 +1541,24 @@ Return false to cancel Transition.</p>
<dt>
<a id="#(AI_A2A).Resume" >
<strong>AI_A2A.Resume(AIGroup)</strong>
<strong>AI_A2A.Resume(AIGroup, Fsm)</strong>
</a>
</dt>
<dd>
<h3>Parameter</h3>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Wrapper.Group.html##(GROUP)">Wrapper.Group#GROUP</a> AIGroup </em></code>: </p>
</li>
<li>
<p><code><em> Fsm </em></code>: </p>
</li>
</ul>
</dd>

View File

@ -171,7 +171,7 @@ and automatically engage any airborne enemies that are within a certain range or
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A_CAP).AttackRoute">AI_A2A_CAP.AttackRoute(AIGroup)</a></td>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A_CAP).AttackRoute">AI_A2A_CAP.AttackRoute(AIGroup, Fsm)</a></td>
<td class="summary">
</td>
@ -553,19 +553,24 @@ Use the method <a href="AI_Cap.html##(AI_A2A_CAP).SetEngageZone">AI<em>Cap#AI</e
<dt>
<a id="#(AI_A2A_CAP).AttackRoute" >
<strong>AI_A2A_CAP.AttackRoute(AIGroup)</strong>
<strong>AI_A2A_CAP.AttackRoute(AIGroup, Fsm)</strong>
</a>
</dt>
<dd>
<h3>Parameter</h3>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Wrapper.Group.html##(GROUP)">Wrapper.Group#GROUP</a> AIGroup </em></code>: </p>
</li>
<li>
<p><code><em> Fsm </em></code>: </p>
</li>
</ul>
</dd>

View File

@ -204,7 +204,7 @@
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A_GCI).InterceptRoute">AI_A2A_GCI.InterceptRoute(AIControllable, AIGroup)</a></td>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A_GCI).InterceptRoute">AI_A2A_GCI.InterceptRoute(AIControllable, AIGroup, Fsm)</a></td>
<td class="summary">
</td>
@ -617,7 +617,7 @@ Use the method <a href="AI_Cap.html##(AI_A2A_GCI).SetEngageZone">AI<em>Cap#AI</e
<dt>
<a id="#(AI_A2A_GCI).InterceptRoute" >
<strong>AI_A2A_GCI.InterceptRoute(AIControllable, AIGroup)</strong>
<strong>AI_A2A_GCI.InterceptRoute(AIControllable, AIGroup, Fsm)</strong>
</a>
</dt>
<dd>
@ -635,6 +635,11 @@ Use the method <a href="AI_Cap.html##(AI_A2A_GCI).SetEngageZone">AI<em>Cap#AI</e
<p><code><em> AIGroup </em></code>: </p>
</li>
<li>
<p><code><em> Fsm </em></code>: </p>
</li>
</ul>
</dd>

View File

@ -242,7 +242,7 @@
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A_PATROL).PatrolRoute">AI_A2A_PATROL.PatrolRoute(AIGroup)</a></td>
<td class="name" nowrap="nowrap"><a href="##(AI_A2A_PATROL).PatrolRoute">AI_A2A_PATROL.PatrolRoute(AIGroup, Fsm)</a></td>
<td class="summary">
</td>
@ -852,14 +852,14 @@ Return false to cancel Transition.</p>
<dt>
<a id="#(AI_A2A_PATROL).PatrolRoute" >
<strong>AI_A2A_PATROL.PatrolRoute(AIGroup)</strong>
<strong>AI_A2A_PATROL.PatrolRoute(AIGroup, Fsm)</strong>
</a>
</dt>
<dd>
<h3>Parameter</h3>
<h3>Parameters</h3>
<ul>
<li>
@ -867,6 +867,11 @@ Return false to cancel Transition.</p>
This statis method is called from the route path within the last task at the last waaypoint of the Controllable.
Note that this method is required, as triggers the next route when patrolling for the Controllable.</p>
</li>
<li>
<p><code><em> Fsm </em></code>: </p>
</li>
</ul>
</dd>

View File

@ -3417,7 +3417,6 @@ The range till cargo will board.</p>
<dl class="function">
<dt>
<em></em>
<a id="#(CARGO_UNIT).CargoCarrier" >
<strong>CARGO_UNIT.CargoCarrier</strong>
</a>
@ -3543,7 +3542,6 @@ The range till cargo will board.</p>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(CARGO_UNIT).RunCount" >
<strong>CARGO_UNIT.RunCount</strong>
</a>

View File

@ -235,6 +235,12 @@
<td class="name" nowrap="nowrap"><a href="##(CONTROLLABLE).GetDetectedTargets">CONTROLLABLE:GetDetectedTargets(DetectVisual, DetectOptical, DetectRadar, DetectIRST, DetectRWR, DetectDLINK)</a></td>
<td class="summary">
<p>Return the detected targets of the controllable.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CONTROLLABLE).GetFuel">CONTROLLABLE:GetFuel()</a></td>
<td class="summary">
<p>Returns relative amount of fuel (from 0.0 to 1.0) the unit has in its internal tanks.</p>
</td>
</tr>
<tr>
@ -424,7 +430,7 @@
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CONTROLLABLE).Route">CONTROLLABLE:Route(GoPoints)</a></td>
<td class="name" nowrap="nowrap"><a href="##(CONTROLLABLE).Route">CONTROLLABLE:Route(Route, DelaySeconds)</a></td>
<td class="summary">
<p>Make the controllable to follow a given route.</p>
</td>
@ -451,6 +457,12 @@
<td class="name" nowrap="nowrap"><a href="##(CONTROLLABLE).SetTask">CONTROLLABLE:SetTask(DCSTask, WaitTime)</a></td>
<td class="summary">
<p>Clearing the Task Queue and Setting the Task on the queue from the controllable.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CONTROLLABLE).SetTaskAtWaypoint">CONTROLLABLE:SetTaskAtWaypoint(RouteList, WaypointNumber, Task)</a></td>
<td class="summary">
<p>Set a Task at a Waypoint using a Route list.</p>
</td>
</tr>
<tr>
@ -538,9 +550,9 @@
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(CONTROLLABLE).TaskFunction">CONTROLLABLE:TaskFunction(WayPoint, WayPointIndex, FunctionString, FunctionArguments)</a></td>
<td class="name" nowrap="nowrap"><a href="##(CONTROLLABLE).TaskFunction">CONTROLLABLE:TaskFunction(FunctionString, ...)</a></td>
<td class="summary">
<p>This creates a Task element, with an action to call a function as part of a Wrapped Task.</p>
</td>
</tr>
<tr>
@ -769,6 +781,22 @@ This is different from the EnRoute tasks, where the targets of the task need to
<li><a href="##(CONTROLLABLE).TaskControlled">CONTROLLABLE.TaskControlled</a>: Return a Controlled Task taking a Task and a TaskCondition.</li>
</ul>
<h3>Call a function as a Task</h3>
<p>A function can be called which is part of a Task. The method <a href="##(CONTROLLABLE).TaskFunction">CONTROLLABLE.TaskFunction</a>() prepares
a Task that can call a GLOBAL function from within the Controller execution.
This method can also be used to <strong>embed a function call when a certain waypoint has been reached</strong>.
See below the <strong>Tasks at Waypoints</strong> section.</p>
<p>Demonstration Mission: <a href="https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/release-2-2-pre/GRP - Group Commands/GRP-502 - Route at waypoint to random point">GRP-502 - Route at waypoint to random point</a></p>
<h3>Tasks at Waypoints</h3>
<p>Special Task methods are available to set tasks at certain waypoints.
The method <a href="##(CONTROLLABLE).SetTaskAtWaypoint">CONTROLLABLE.SetTaskAtWaypoint</a>() helps preparing a Route, embedding a Task at the Waypoint of the Route.</p>
<p>This creates a Task element, with an action to call a function as part of a Wrapped Task.</p>
<h3>Obtain the mission from controllable templates</h3>
<p>Controllable templates contain complete mission descriptions. Sometimes you want to copy a complete mission from a controllable and assign it to another:</p>
@ -1478,6 +1506,27 @@ DetectedTargets</p>
<dl class="function">
<dt>
<a id="#(CONTROLLABLE).GetFuel" >
<strong>CONTROLLABLE:GetFuel()</strong>
</a>
</dt>
<dd>
<p>Returns relative amount of fuel (from 0.0 to 1.0) the unit has in its internal tanks.</p>
<p>This method returns nil to ensure polymorphic behaviour! This method needs to be overridden by GROUP or UNIT.</p>
<h3>Return value</h3>
<p><em>#nil:</em>
The CONTROLLABLE is not existing or alive. </p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CONTROLLABLE).GetLife" >
<strong>CONTROLLABLE:GetLife()</strong>
</a>
@ -2133,26 +2182,32 @@ self</p>
<dt>
<a id="#(CONTROLLABLE).Route" >
<strong>CONTROLLABLE:Route(GoPoints)</strong>
<strong>CONTROLLABLE:Route(Route, DelaySeconds)</strong>
</a>
</dt>
<dd>
<p>Make the controllable to follow a given route.</p>
<h3>Parameter</h3>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#table GoPoints </em></code>:
<p><code><em>#table Route </em></code>:
A table of Route Points.</p>
</li>
<li>
<p><code><em>#number DelaySeconds </em></code>:
Wait for the specified seconds before executing the Route.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(CONTROLLABLE)">#CONTROLLABLE</a>:</em>
self</p>
The CONTROLLABLE.</p>
</dd>
</dl>
@ -2277,6 +2332,45 @@ self</p>
<p><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a>:</em>
self</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(CONTROLLABLE).SetTaskAtWaypoint" >
<strong>CONTROLLABLE:SetTaskAtWaypoint(RouteList, WaypointNumber, Task)</strong>
</a>
</dt>
<dd>
<p>Set a Task at a Waypoint using a Route list.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE.RouteList)">Wrapper.Controllable#CONTROLLABLE.RouteList</a> RouteList </em></code>:
A list of Waypoints.</p>
</li>
<li>
<p><code><em>#number WaypointNumber </em></code>:
The number of the Waypoint. The first Waypoint starts at 1!</p>
</li>
<li>
<p><code><em><a href="Dcs.DCSTasking.Task.html##(Task)">Dcs.DCSTasking.Task#Task</a> Task </em></code>:
The Task structure to be executed!</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="Dcs.DCSTasking.Task.html##(Task)">Dcs.DCSTasking.Task#Task</a>:</em></p>
</dd>
</dl>
<dl class="function">
@ -2971,36 +3065,79 @@ The DCS task structure.</p>
<dt>
<a id="#(CONTROLLABLE).TaskFunction" >
<strong>CONTROLLABLE:TaskFunction(WayPoint, WayPointIndex, FunctionString, FunctionArguments)</strong>
<strong>CONTROLLABLE:TaskFunction(FunctionString, ...)</strong>
</a>
</dt>
<dd>
<p>This creates a Task element, with an action to call a function as part of a Wrapped Task.</p>
<p>This Task can then be embedded at a Waypoint by calling the method <a href="##(CONTROLLABLE).SetTaskAtWaypoint">CONTROLLABLE.SetTaskAtWaypoint</a>.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em> WayPoint </em></code>: </p>
<p><code><em>#string FunctionString </em></code>:
The function name embedded as a string that will be called.</p>
</li>
<li>
<p><code><em> WayPointIndex </em></code>: </p>
</li>
<li>
<p><code><em> FunctionString </em></code>: </p>
</li>
<li>
<p><code><em> FunctionArguments </em></code>: </p>
<p><code><em> ... </em></code>:
The variable arguments passed to the function when called! These arguments can be of any type!</p>
</li>
</ul>
<h3>Return value</h3>
<p><em><a href="##(CONTROLLABLE)">#CONTROLLABLE</a>:</em></p>
<h3>Usage:</h3>
<pre class="example"><code>
local ZoneList = {
ZONE:New( "ZONE1" ),
ZONE:New( "ZONE2" ),
ZONE:New( "ZONE3" ),
ZONE:New( "ZONE4" ),
ZONE:New( "ZONE5" )
}
GroundGroup = GROUP:FindByName( "Vehicle" )
--- @param Wrapper.Group#GROUP GroundGroup
function RouteToZone( Vehicle, ZoneRoute )
local Route = {}
Vehicle:E( { ZoneRoute = ZoneRoute } )
Vehicle:MessageToAll( "Moving to zone " .. ZoneRoute:GetName(), 10 )
-- Get the current coordinate of the Vehicle
local FromCoord = Vehicle:GetCoordinate()
-- Select a random Zone and get the Coordinate of the new Zone.
local RandomZone = ZoneList[ math.random( 1, #ZoneList ) ] -- Core.Zone#ZONE
local ToCoord = RandomZone:GetCoordinate()
-- Create a "ground route point", which is a "point" structure that can be given as a parameter to a Task
Route[#Route+1] = FromCoord:RoutePointGround( 72 )
Route[#Route+1] = ToCoord:RoutePointGround( 60, "Vee" )
local TaskRouteToZone = Vehicle:TaskFunction( "RouteToZone", RandomZone )
Vehicle:SetTaskAtWaypoint( Route, #Route, TaskRouteToZone ) -- Set for the given Route at Waypoint 2 the TaskRouteToZone.
Vehicle:Route( Route, math.random( 10, 20 ) ) -- Move after a random seconds to the Route. See the Route method for details.
end
RouteToZone( GroundGroup, ZoneList[1] )
</code></pre>
</dd>
</dl>
<dl class="function">

View File

@ -923,6 +923,7 @@ function below will use the range 1-7 just in case</p>
<dl class="function">
<dt>
<em></em>
<a id="#(DESIGNATE).LaserCodes" >
<strong>DESIGNATE.LaserCodes</strong>
</a>

View File

@ -1598,7 +1598,7 @@ A string defining the start state.</p>
<dl class="function">
<dt>
<em></em>
<em>#string</em>
<a id="#(FSM)._StartState" >
<strong>FSM._StartState</strong>
</a>
@ -1897,7 +1897,6 @@ A string defining the start state.</p>
<dl class="function">
<dt>
<em></em>
<a id="#(FSM).current" >
<strong>FSM.current</strong>
</a>

View File

@ -256,6 +256,12 @@
<td class="name" nowrap="nowrap"><a href="##(GROUP).GetDCSUnits">GROUP:GetDCSUnits()</a></td>
<td class="summary">
<p>Returns the DCS Units of the DCS Group.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(GROUP).GetFuel">GROUP:GetFuel()</a></td>
<td class="summary">
<p>Returns relative amount of fuel (from 0.0 to 1.0) the group has in its internal tanks.</p>
</td>
</tr>
<tr>
@ -1026,6 +1032,37 @@ The DCS Units.</p>
<dl class="function">
<dt>
<a id="#(GROUP).GetFuel" >
<strong>GROUP:GetFuel()</strong>
</a>
</dt>
<dd>
<p>Returns relative amount of fuel (from 0.0 to 1.0) the group has in its internal tanks.</p>
<p>If there are additional fuel tanks the value may be greater than 1.0.</p>
<h3>Return values</h3>
<ol>
<li>
<p><em>#number:</em>
The relative amount of fuel (from 0.0 to 1.0).</p>
</li>
<li>
<p><em>#nil:</em>
The GROUP is not existing or alive. </p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(GROUP).GetHeading" >
<strong>GROUP:GetHeading()</strong>
</a>

View File

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

View File

@ -1838,6 +1838,7 @@ self</p>
<dl class="function">
<dt>
<em><a href="Core.Spot.html##(SPOT)">Core.Spot#SPOT</a></em>
<a id="#(POSITIONABLE).Spot" >
<strong>POSITIONABLE.Spot</strong>
</a>

View File

@ -2194,6 +2194,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>
</dl>
<dl class="function">
@ -2746,6 +2749,9 @@ when nothing was spawned.</p>
<p> By default, no InitLimit</p>
</dd>
</dl>
<dl class="function">
@ -2781,7 +2787,7 @@ when nothing was spawned.</p>
<dl class="function">
<dt>
<em></em>
<em>#number</em>
<a id="#(SPAWN).SpawnMaxGroups" >
<strong>SPAWN.SpawnMaxGroups</strong>
</a>
@ -2798,7 +2804,7 @@ when nothing was spawned.</p>
<dl class="function">
<dt>
<em></em>
<em>#number</em>
<a id="#(SPAWN).SpawnMaxUnitsAlive" >
<strong>SPAWN.SpawnMaxUnitsAlive</strong>
</a>

View File

@ -765,6 +765,7 @@ true if it is lasing</p>
<dl class="function">
<dt>
<em></em>
<a id="#(SPOT).ScheduleID" >
<strong>SPOT.ScheduleID</strong>
</a>
@ -778,6 +779,7 @@ true if it is lasing</p>
<dl class="function">
<dt>
<em></em>
<a id="#(SPOT).SpotIR" >
<strong>SPOT.SpotIR</strong>
</a>
@ -791,6 +793,7 @@ true if it is lasing</p>
<dl class="function">
<dt>
<em></em>
<a id="#(SPOT).SpotLaser" >
<strong>SPOT.SpotLaser</strong>
</a>
@ -804,6 +807,7 @@ true if it is lasing</p>
<dl class="function">
<dt>
<em></em>
<a id="#(SPOT).Target" >
<strong>SPOT.Target</strong>
</a>

View File

@ -552,7 +552,7 @@ based on the tasking capabilities defined in <a href="Task.html##(TASK)">Task#TA
<dl class="function">
<dt>
<em></em>
<em><a href="Core.Cargo.html##(CARGO_GROUP)">Core.Cargo#CARGO_GROUP</a></em>
<a id="#(FSM_PROCESS).Cargo" >
<strong>FSM_PROCESS.Cargo</strong>
</a>
@ -566,6 +566,7 @@ based on the tasking capabilities defined in <a href="Task.html##(TASK)">Task#TA
<dl class="function">
<dt>
<em></em>
<a id="#(FSM_PROCESS).DeployZone" >
<strong>FSM_PROCESS.DeployZone</strong>
</a>
@ -630,7 +631,7 @@ based on the tasking capabilities defined in <a href="Task.html##(TASK)">Task#TA
<dl class="function">
<dt>
<em></em>
<em>#number</em>
<a id="#(TASK_CARGO).CargoLimit" >
<strong>TASK_CARGO.CargoLimit</strong>
</a>

View File

@ -181,7 +181,7 @@
<tr>
<td class="name" nowrap="nowrap"><a href="##(UNIT).GetFuel">UNIT:GetFuel()</a></td>
<td class="summary">
<p>Returns relative amount of fuel (from 0.0 to 1.0) the unit has in its internal tanks.</p>
<p>Returns relative amount of fuel (from 0.0 to 1.0) the UNIT has in its internal tanks.</p>
</td>
</tr>
<tr>
@ -641,7 +641,7 @@ Category name = Helicopter, Airplane, Ground Unit, Ship</p>
</dt>
<dd>
<p>Returns relative amount of fuel (from 0.0 to 1.0) the unit has in its internal tanks.</p>
<p>Returns relative amount of fuel (from 0.0 to 1.0) the UNIT has in its internal tanks.</p>
<p>If there are additional fuel tanks the value may be greater than 1.0.</p>