From 6e8edd95ec3bb802740c5868d1d94df64ee2b940 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 29 Apr 2022 18:48:41 +0200 Subject: [PATCH] GROUP - making GetCoordinate() a bit more resilient POINT - slight changes to ToStringBRAANATO --- Moose Development/Moose/Core/Point.lua | 4 ++-- Moose Development/Moose/Wrapper/Group.lua | 25 +++++++++++++++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index 81733b099..bfd7a9150 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -2799,9 +2799,9 @@ do -- COORDINATE end if Bogey and Spades then BRAANATO = BRAANATO..", Bogey, Spades." - elseif Bogey and (not Spades) then + elseif Bogey then BRAANATO = BRAANATO..", Bogey." - elseif (not Bogey) and Spades then + elseif Spades then BRAANATO = BRAANATO..", Spades." else BRAANATO = BRAANATO.."." diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 8127ffba9..850f256b6 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -1019,18 +1019,25 @@ end -- @return Core.Point#COORDINATE The COORDINATE of the GROUP. function GROUP:GetCoordinate() - local FirstUnit = self:GetUnit(1) + local Units = self:GetUnits() - if FirstUnit then - local FirstUnitCoordinate = FirstUnit:GetCoordinate() - local Heading = self:GetHeading() - FirstUnitCoordinate.Heading = Heading - return FirstUnitCoordinate + for _,_unit in pairs(Units) do + local FirstUnit = _unit -- Wrapper.Unit#UNIT + + if FirstUnit then + + local FirstUnitCoordinate = FirstUnit:GetCoordinate() + + if FirstUnitCoordinate then + local Heading = self:GetHeading() + FirstUnitCoordinate.Heading = Heading + return FirstUnitCoordinate + end + + end end - BASE:E( { "Cannot GetCoordinate", Group = self, Alive = self:IsAlive() } ) - - return nil + end