- Added nil check on vec3 for _UndateEngageTarget in ARMYGROUP and NAVYGROUP
This commit is contained in:
Frank 2022-03-25 10:27:32 +01:00
parent 0411120551
commit f92e8a285a
2 changed files with 62 additions and 44 deletions

View File

@ -1476,6 +1476,8 @@ function ARMYGROUP:_UpdateEngageTarget()
-- Get current position vector.
local vec3=self.engage.Target:GetVec3()
if vec3 then
-- Distance to last known position of target.
local dist=UTILS.VecDist3D(vec3, self.engage.Coordinate:GetVec3())
@ -1505,7 +1507,14 @@ function ARMYGROUP:_UpdateEngageTarget()
else
-- Target not alive any more == Disengage.
-- Could not get position of target (not alive any more?) ==> Disengage.
self:Disengage()
end
else
-- Target not alive any more ==> Disengage.
self:Disengage()
end

View File

@ -1440,6 +1440,8 @@ function NAVYGROUP:_UpdateEngageTarget()
-- Get current position vector.
local vec3=self.engage.Target:GetVec3()
if vec3 then
-- Distance to last known position of target.
local dist=UTILS.VecDist3D(vec3, self.engage.Coordinate:GetVec3())
@ -1469,7 +1471,14 @@ function NAVYGROUP:_UpdateEngageTarget()
else
-- Target not alive any more == Disengage.
-- Could not get position of target (not alive any more?) ==> Disengage.
self:Disengage()
end
else
-- Target not alive any more ==> Disengage.
self:Disengage()
end