mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Ops
- Performance
This commit is contained in:
@@ -3060,6 +3060,21 @@ function WAREHOUSE:GetCoordinate()
|
|||||||
return self.warehouse:GetCoordinate()
|
return self.warehouse:GetCoordinate()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get 3D vector of warehouse static.
|
||||||
|
-- @param #WAREHOUSE self
|
||||||
|
-- @return DCS#Vec3 The 3D vector of the warehouse.
|
||||||
|
function WAREHOUSE:GetVec3()
|
||||||
|
return self.warehouse:GetVec3()
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get 2D vector of warehouse static.
|
||||||
|
-- @param #WAREHOUSE self
|
||||||
|
-- @return DCS#Vec2 The 2D vector of the warehouse.
|
||||||
|
function WAREHOUSE:GetVec2()
|
||||||
|
return self.warehouse:GetVec2()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Get coalition side of warehouse static.
|
--- Get coalition side of warehouse static.
|
||||||
-- @param #WAREHOUSE self
|
-- @param #WAREHOUSE self
|
||||||
-- @return #number Coalition side, i.e. number of @{DCS#coalition.side}.
|
-- @return #number Coalition side, i.e. number of @{DCS#coalition.side}.
|
||||||
|
|||||||
@@ -1288,9 +1288,11 @@ end
|
|||||||
-- @param #boolean includePayload If true, include the payload in the calulation if the asset has one attached.
|
-- @param #boolean includePayload If true, include the payload in the calulation if the asset has one attached.
|
||||||
function AIRWING:_OptimizeAssetSelection(assets, Mission, includePayload)
|
function AIRWING:_OptimizeAssetSelection(assets, Mission, includePayload)
|
||||||
|
|
||||||
local TargetCoordinate=Mission:GetTargetCoordinate()
|
local TargetVec2=Mission:GetTargetVec2()
|
||||||
|
|
||||||
local dStock=self:GetCoordinate():Get2DDistance(TargetCoordinate)
|
--local dStock=self:GetCoordinate():Get2DDistance(TargetCoordinate)
|
||||||
|
|
||||||
|
local dStock=UTILS.VecDist2D(TargetVec2, self:GetVec2())
|
||||||
|
|
||||||
-- Calculate distance to mission target.
|
-- Calculate distance to mission target.
|
||||||
local distmin=math.huge
|
local distmin=math.huge
|
||||||
@@ -1300,7 +1302,8 @@ function AIRWING:_OptimizeAssetSelection(assets, Mission, includePayload)
|
|||||||
|
|
||||||
if asset.spawned then
|
if asset.spawned then
|
||||||
local group=GROUP:FindByName(asset.spawngroupname)
|
local group=GROUP:FindByName(asset.spawngroupname)
|
||||||
asset.dist=group:GetCoordinate():Get2DDistance(TargetCoordinate)
|
--asset.dist=group:GetCoordinate():Get2DDistance(TargetCoordinate)
|
||||||
|
asset.dist=UTILS.VecDist2D(group:GetVec2(), TargetVec2)
|
||||||
else
|
else
|
||||||
asset.dist=dStock
|
asset.dist=dStock
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user