mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Updates of tasking
This commit is contained in:
@@ -360,16 +360,21 @@ function CONTROLLABLE:SetTask( DCSTask, WaitTime )
|
||||
|
||||
if DCSControllable then
|
||||
|
||||
local Controller = self:_GetController()
|
||||
|
||||
-- When a controllable SPAWNs, it takes about a second to get the controllable in the simulator. Setting tasks to unspawned controllables provides unexpected results.
|
||||
-- Therefore we schedule the functions to set the mission and options for the Controllable.
|
||||
-- Controller.setTask( Controller, DCSTask )
|
||||
|
||||
if not WaitTime or WaitTime == 0 then
|
||||
local function SetTask( Controller, DCSTask )
|
||||
local Controller = self:_GetController()
|
||||
Controller:resetTask()
|
||||
Controller:setTask( DCSTask )
|
||||
end
|
||||
|
||||
if not WaitTime or WaitTime == 0 then
|
||||
SetTask( DCSTask )
|
||||
else
|
||||
self.TaskScheduler:Schedule( Controller, Controller.setTask, { DCSTask }, WaitTime )
|
||||
self.TaskScheduler:Schedule( self, SetTask, { DCSTask }, WaitTime )
|
||||
end
|
||||
|
||||
return self
|
||||
@@ -492,16 +497,15 @@ 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 #table Waypoint The Waypoint!
|
||||
-- @param Dcs.DCSTasking.Task#Task Task The Task structure to be executed!
|
||||
-- @return Dcs.DCSTasking.Task#Task
|
||||
function CONTROLLABLE:SetTaskAtWaypoint( RouteList, WaypointNumber, Task )
|
||||
function CONTROLLABLE:SetTaskWaypoint( Waypoint, Task )
|
||||
|
||||
RouteList[ WaypointNumber ].task = self:TaskCombo( { Task } )
|
||||
Waypoint.task = self:TaskCombo( { Task } )
|
||||
|
||||
self:T3( { RouteList[ WaypointNumber ].task } )
|
||||
return RouteList[ WaypointNumber ].task
|
||||
self:T3( { Waypoint.task } )
|
||||
return Waypoint.task
|
||||
end
|
||||
|
||||
|
||||
@@ -1558,8 +1562,8 @@ end
|
||||
-- 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" )
|
||||
-- Route[#Route+1] = FromCoord:WaypointGround( 72 )
|
||||
-- Route[#Route+1] = ToCoord:WaypointGround( 60, "Vee" )
|
||||
--
|
||||
-- local TaskRouteToZone = Vehicle:TaskFunction( "RouteToZone", RandomZone )
|
||||
--
|
||||
@@ -1758,6 +1762,24 @@ function CONTROLLABLE:Route( Route, DelaySeconds )
|
||||
end
|
||||
|
||||
|
||||
--- Make the GROUND controllable to drive towards a specific point.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param Core.Point#COORDINATE ToCoordinate A Coordinate to drive to.
|
||||
-- @param #number Speed (optional) Speed in km/h. The default speed is 999 km/h.
|
||||
-- @param #string Formation (optional) The route point Formation, which is a text string that specifies exactly the Text in the Type of the route point, like "Vee", "Echelon Right".
|
||||
-- @param #number DelaySeconds Wait for the specified seconds before executing the Route.
|
||||
-- @return #CONTROLLABLE The CONTROLLABLE.
|
||||
function CONTROLLABLE:RouteGroundTo( ToCoordinate, Speed, Formation, DelaySeconds )
|
||||
|
||||
local FromCoordinate = self:GetCoordinate()
|
||||
|
||||
local FromWP = FromCoordinate:WaypointGround()
|
||||
local ToWP = ToCoordinate:WaypointGround( Speed, Formation )
|
||||
|
||||
self:Route( { FromWP, ToWP }, DelaySeconds )
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- (AIR + GROUND) Route the controllable to a given zone.
|
||||
-- The controllable final destination point can be randomized.
|
||||
|
||||
@@ -507,7 +507,6 @@ end
|
||||
--- Returns a COORDINATE object indicating the point of the first UNIT of the GROUP within the mission.
|
||||
-- @param Wrapper.Group#GROUP self
|
||||
-- @return Core.Point#COORDINATE The COORDINATE of the GROUP.
|
||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||
function GROUP:GetCoordinate()
|
||||
self:F2( self.PositionableName )
|
||||
|
||||
@@ -1117,7 +1116,7 @@ do -- Route methods
|
||||
|
||||
local PointTo = {}
|
||||
local AirbasePointVec2 = RTBAirbase:GetPointVec2()
|
||||
local AirbaseAirPoint = AirbasePointVec2:RoutePointAir(
|
||||
local AirbaseAirPoint = AirbasePointVec2:WaypointAir(
|
||||
POINT_VEC3.RoutePointAltType.BARO,
|
||||
"Land",
|
||||
"Landing",
|
||||
|
||||
@@ -156,7 +156,6 @@ end
|
||||
--- Returns a COORDINATE object indicating the point in 3D of the POSITIONABLE within the mission.
|
||||
-- @param Wrapper.Positionable#POSITIONABLE self
|
||||
-- @return Core.Point#COORDINATE The COORDINATE of the POSITIONABLE.
|
||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||
function POSITIONABLE:GetCoordinate()
|
||||
self:F2( self.PositionableName )
|
||||
|
||||
@@ -165,7 +164,7 @@ function POSITIONABLE:GetCoordinate()
|
||||
if DCSPositionable then
|
||||
local PositionableVec3 = self:GetPositionVec3()
|
||||
|
||||
local PositionableCoordinate = POINT_VEC3:NewFromVec3( PositionableVec3 )
|
||||
local PositionableCoordinate = COORDINATE:NewFromVec3( PositionableVec3 )
|
||||
PositionableCoordinate:SetHeading( self:GetHeading() )
|
||||
|
||||
self:T2( PositionableCoordinate )
|
||||
|
||||
Reference in New Issue
Block a user