GROUP - making GetCoordinate() a bit more resilient

POINT - slight changes to ToStringBRAANATO
This commit is contained in:
Applevangelist 2022-04-29 18:48:41 +02:00
parent 5112c9598b
commit 6e8edd95ec
2 changed files with 18 additions and 11 deletions

View File

@ -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.."."

View File

@ -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