GROUP - making GetCoordinate() a bit more resilient

POINT - slight changes to ToStringBRAANATO
This commit is contained in:
Applevangelist
2022-04-29 18:48:27 +02:00
parent 1aaa51c4be
commit def5d33055
2 changed files with 19 additions and 10 deletions
+2 -2
View File
@@ -2799,9 +2799,9 @@ do -- COORDINATE
end end
if Bogey and Spades then if Bogey and Spades then
BRAANATO = BRAANATO..", Bogey, Spades." BRAANATO = BRAANATO..", Bogey, Spades."
elseif Bogey and (not Spades) then elseif Bogey then
BRAANATO = BRAANATO..", Bogey." BRAANATO = BRAANATO..", Bogey."
elseif (not Bogey) and Spades then elseif Spades then
BRAANATO = BRAANATO..", Spades." BRAANATO = BRAANATO..", Spades."
else else
BRAANATO = BRAANATO.."." BRAANATO = BRAANATO.."."
+16 -7
View File
@@ -1028,15 +1028,24 @@ end
-- @return Core.Point#COORDINATE The COORDINATE of the GROUP. -- @return Core.Point#COORDINATE The COORDINATE of the GROUP.
function GROUP:GetCoordinate() function GROUP:GetCoordinate()
local FirstUnit = self:GetUnit(1)
if FirstUnit then local Units = self:GetUnits()
local FirstUnitCoordinate = FirstUnit:GetCoordinate()
local Heading = self:GetHeading() for _,_unit in pairs(Units) do
FirstUnitCoordinate.Heading = Heading local FirstUnit = _unit -- Wrapper.Unit#UNIT
return FirstUnitCoordinate
if FirstUnit then
local FirstUnitCoordinate = FirstUnit:GetCoordinate()
if FirstUnitCoordinate then
local Heading = self:GetHeading()
FirstUnitCoordinate.Heading = Heading
return FirstUnitCoordinate
end
end
end end
BASE:E( { "Cannot GetCoordinate", Group = self, Alive = self:IsAlive() } ) BASE:E( { "Cannot GetCoordinate", Group = self, Alive = self:IsAlive() } )
return nil return nil