WAREHOUSE

This commit is contained in:
funkyfranky 2018-08-08 16:21:50 +02:00
parent a71c7dc181
commit b46c238dda
2 changed files with 403 additions and 361 deletions

View File

@ -1213,19 +1213,27 @@ do -- COORDINATE
local vec2={ x = x, y = y } local vec2={ x = x, y = y }
return COORDINATE:NewFromVec2(vec2) return COORDINATE:NewFromVec2(vec2)
end end
--- Returns a table of coordinates to a destination using only roads. --- Returns a table of coordinates to a destination using only roads or railroads.
-- The first point is the closest point on road of the given coordinate. -- The first point is the closest point on road of the given coordinate.
-- By default, the last point is the closest point on road of the ToCoord. Hence, the coordinate itself and the final ToCoord are not necessarily included in the path. -- By default, the last point is the closest point on road of the ToCoord. Hence, the coordinate itself and the final ToCoord are not necessarily included in the path.
-- @param #COORDINATE self -- @param #COORDINATE self
-- @param #COORDINATE ToCoord Coordinate of destination. -- @param #COORDINATE ToCoord Coordinate of destination.
-- @param #boolean IncludeEndpoints (Optional) Include the coordinate itself and the ToCoordinate in the path. -- @param #boolean IncludeEndpoints (Optional) Include the coordinate itself and the ToCoordinate in the path.
-- @param #boolean Railroad (Optional) If true, path on railroad is returned. Default false.
-- @return #table Table of coordinates on road. If no path on road can be found, nil is returned or just the endpoints. -- @return #table Table of coordinates on road. If no path on road can be found, nil is returned or just the endpoints.
-- @return #number The length of the total path. -- @return #number The length of the total path.
function COORDINATE:GetPathOnRoad(ToCoord, IncludeEndpoints) function COORDINATE:GetPathOnRoad(ToCoord, IncludeEndpoints, Railroad)
-- Set road type.
local RoadType="roads"
if Railroad==true then
RoadType="railroads"
end
-- DCS API function returning a table of vec2. -- DCS API function returning a table of vec2.
local path = land.findPathOnRoads("roads", self.x, self.z, ToCoord.x, ToCoord.z) local path = land.findPathOnRoads(RoadType, self.x, self.z, ToCoord.x, ToCoord.z)
-- Array holding the path coordinates. -- Array holding the path coordinates.
local Path={} local Path={}

File diff suppressed because it is too large Load Diff