mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop' into FF/Develop
This commit is contained in:
@@ -2003,6 +2003,24 @@ do -- Route methods
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Make the controllable to push follow a given route.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param #table Route A table of Route Points.
|
||||
-- @param #number DelaySeconds (Optional) Wait for the specified seconds before executing the Route. Default is one second.
|
||||
-- @return #CONTROLLABLE The CONTROLLABLE.
|
||||
function CONTROLLABLE:RoutePush( Route, DelaySeconds )
|
||||
self:F2( Route )
|
||||
|
||||
local DCSControllable = self:GetDCSObject()
|
||||
if DCSControllable then
|
||||
local RouteTask = self:TaskRoute( Route ) -- Create a RouteTask, that will route the CONTROLLABLE to the Route.
|
||||
self:PushTask( RouteTask, DelaySeconds or 1 ) -- Execute the RouteTask after the specified seconds (default is 1).
|
||||
return self
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
--- Stops the movement of the vehicle on the route.
|
||||
-- @param #CONTROLLABLE self
|
||||
@@ -2111,7 +2129,7 @@ do -- Route methods
|
||||
FromCoordinate = FromCoordinate or self:GetCoordinate()
|
||||
|
||||
-- Get path and path length on road including the end points (From and To).
|
||||
local PathOnRoad, LengthOnRoad=FromCoordinate:GetPathOnRoad(ToCoordinate, true)
|
||||
local PathOnRoad, LengthOnRoad, GotPath =FromCoordinate:GetPathOnRoad(ToCoordinate, true)
|
||||
|
||||
-- Get the length only(!) on the road.
|
||||
local _,LengthRoad=FromCoordinate:GetPathOnRoad(ToCoordinate, false)
|
||||
@@ -2123,7 +2141,7 @@ do -- Route methods
|
||||
-- Calculate the direct distance between the initial and final points.
|
||||
local LengthDirect=FromCoordinate:Get2DDistance(ToCoordinate)
|
||||
|
||||
if PathOnRoad then
|
||||
if GotPath then
|
||||
|
||||
-- Off road part of the rout: Total=OffRoad+OnRoad.
|
||||
LengthOffRoad=LengthOnRoad-LengthRoad
|
||||
@@ -2146,7 +2164,7 @@ do -- Route methods
|
||||
local canroad=false
|
||||
|
||||
-- Check if a valid path on road could be found.
|
||||
if PathOnRoad then
|
||||
if GotPath and LengthDirect > 2000 then -- if the length of the movement is less than 1 km, drive directly.
|
||||
-- Check whether the road is very long compared to direct path.
|
||||
if LongRoad and Shortcut then
|
||||
|
||||
|
||||
Reference in New Issue
Block a user