From 95f38fbf557c3d90af5e170fd75c18d47d214453 Mon Sep 17 00:00:00 2001 From: leka1986 <83298840+leka1986@users.noreply.github.com> Date: Sat, 16 May 2026 19:27:06 +0200 Subject: [PATCH] Update Shorad.lua Fix tgtgrp2 is nil. --- Moose Development/Moose/Functional/Shorad.lua | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Moose Development/Moose/Functional/Shorad.lua b/Moose Development/Moose/Functional/Shorad.lua index 99d104d92..793b25ff0 100644 --- a/Moose Development/Moose/Functional/Shorad.lua +++ b/Moose Development/Moose/Functional/Shorad.lua @@ -795,15 +795,20 @@ do local tgtgrp1 = self.Samset:FindNearestGroupFromPointVec2(tgtcoord) local tgtcoord1 = tgtgrp1:GetCoordinate() local tgtgrp2 = self.Groupset:FindNearestGroupFromPointVec2(tgtcoord) - local tgtcoord2 = tgtgrp2:GetCoordinate() - local dist1 = tgtcoord:Get2DDistance(tgtcoord1) - local dist2 = tgtcoord:Get2DDistance(tgtcoord2) - - if dist1 < dist2 then - targetunit = tgtgrp1 - targetcat = Object.Category.UNIT + if tgtgrp2 then + local tgtcoord2 = tgtgrp2:GetCoordinate() + local dist1 = tgtcoord:Get2DDistance(tgtcoord1) + local dist2 = tgtcoord:Get2DDistance(tgtcoord2) + + if dist1 < dist2 then + targetunit = tgtgrp1 + targetcat = Object.Category.UNIT + else + targetunit = tgtgrp2 + targetcat = Object.Category.UNIT + end else - targetunit = tgtgrp2 + targetunit = tgtgrp1 targetcat = Object.Category.UNIT end end