Update Shorad.lua

Fix tgtgrp2 is nil.
This commit is contained in:
leka1986
2026-05-16 19:27:06 +02:00
committed by GitHub
parent 696630fe4d
commit 95f38fbf55
@@ -795,6 +795,7 @@ 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)
if tgtgrp2 then
local tgtcoord2 = tgtgrp2:GetCoordinate() local tgtcoord2 = tgtgrp2:GetCoordinate()
local dist1 = tgtcoord:Get2DDistance(tgtcoord1) local dist1 = tgtcoord:Get2DDistance(tgtcoord1)
local dist2 = tgtcoord:Get2DDistance(tgtcoord2) local dist2 = tgtcoord:Get2DDistance(tgtcoord2)
@@ -806,6 +807,10 @@ do
targetunit = tgtgrp2 targetunit = tgtgrp2
targetcat = Object.Category.UNIT targetcat = Object.Category.UNIT
end end
else
targetunit = tgtgrp1
targetcat = Object.Category.UNIT
end
end end
if targetunit and targetunit:IsAlive() then if targetunit and targetunit:IsAlive() then
local targetunitname = targetunit:GetName() local targetunitname = targetunit:GetName()