mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-20 17:07:54 +00:00
Update Shorad.lua
Fix tgtgrp2 is nil.
This commit is contained in:
@@ -795,15 +795,20 @@ do
|
|||||||
local tgtgrp1 = self.Samset:FindNearestGroupFromPointVec2(tgtcoord)
|
local tgtgrp1 = self.Samset:FindNearestGroupFromPointVec2(tgtcoord)
|
||||||
local tgtcoord1 = tgtgrp1:GetCoordinate()
|
local tgtcoord1 = tgtgrp1:GetCoordinate()
|
||||||
local tgtgrp2 = self.Groupset:FindNearestGroupFromPointVec2(tgtcoord)
|
local tgtgrp2 = self.Groupset:FindNearestGroupFromPointVec2(tgtcoord)
|
||||||
local tgtcoord2 = tgtgrp2:GetCoordinate()
|
if tgtgrp2 then
|
||||||
local dist1 = tgtcoord:Get2DDistance(tgtcoord1)
|
local tgtcoord2 = tgtgrp2:GetCoordinate()
|
||||||
local dist2 = tgtcoord:Get2DDistance(tgtcoord2)
|
local dist1 = tgtcoord:Get2DDistance(tgtcoord1)
|
||||||
|
local dist2 = tgtcoord:Get2DDistance(tgtcoord2)
|
||||||
if dist1 < dist2 then
|
|
||||||
targetunit = tgtgrp1
|
if dist1 < dist2 then
|
||||||
targetcat = Object.Category.UNIT
|
targetunit = tgtgrp1
|
||||||
|
targetcat = Object.Category.UNIT
|
||||||
|
else
|
||||||
|
targetunit = tgtgrp2
|
||||||
|
targetcat = Object.Category.UNIT
|
||||||
|
end
|
||||||
else
|
else
|
||||||
targetunit = tgtgrp2
|
targetunit = tgtgrp1
|
||||||
targetcat = Object.Category.UNIT
|
targetcat = Object.Category.UNIT
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user