mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-23 02:08:17 +00:00
OPS
- Added nil check on vec3 for _UndateEngageTarget in ARMYGROUP and NAVYGROUP
This commit is contained in:
@@ -1476,6 +1476,8 @@ function ARMYGROUP:_UpdateEngageTarget()
|
|||||||
-- Get current position vector.
|
-- Get current position vector.
|
||||||
local vec3=self.engage.Target:GetVec3()
|
local vec3=self.engage.Target:GetVec3()
|
||||||
|
|
||||||
|
if vec3 then
|
||||||
|
|
||||||
-- Distance to last known position of target.
|
-- Distance to last known position of target.
|
||||||
local dist=UTILS.VecDist3D(vec3, self.engage.Coordinate:GetVec3())
|
local dist=UTILS.VecDist3D(vec3, self.engage.Coordinate:GetVec3())
|
||||||
|
|
||||||
@@ -1505,7 +1507,14 @@ function ARMYGROUP:_UpdateEngageTarget()
|
|||||||
|
|
||||||
else
|
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()
|
self:Disengage()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1440,6 +1440,8 @@ function NAVYGROUP:_UpdateEngageTarget()
|
|||||||
-- Get current position vector.
|
-- Get current position vector.
|
||||||
local vec3=self.engage.Target:GetVec3()
|
local vec3=self.engage.Target:GetVec3()
|
||||||
|
|
||||||
|
if vec3 then
|
||||||
|
|
||||||
-- Distance to last known position of target.
|
-- Distance to last known position of target.
|
||||||
local dist=UTILS.VecDist3D(vec3, self.engage.Coordinate:GetVec3())
|
local dist=UTILS.VecDist3D(vec3, self.engage.Coordinate:GetVec3())
|
||||||
|
|
||||||
@@ -1469,7 +1471,14 @@ function NAVYGROUP:_UpdateEngageTarget()
|
|||||||
|
|
||||||
else
|
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()
|
self:Disengage()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user