--- Returns if a location is within the zone.
-- @param #ZONE_RADIUS self
-- @param DCS#Vec2 Vec2 The location to test.
-- @return #boolean true if the location is within the zone.
function ZONE_RADIUS:IsVec2InZone( Vec2 )
self:F2( Vec2 )
local ZoneVec2 = self:GetVec2()
if ZoneVec2 then
if (( Vec2.x - ZoneVec2.x )^2 + ( Vec2.y - ZoneVec2.y ) ^2 ) ^ 0.5 <= self:GetRadius() then
return true
end
end
return false
end
When called from GROUP:IsAnyInZone(Zone). Error log is pasted below:
2020-04-01 15:59:02.265 INFO SCRIPTING: 10820( 10454)/T: ZONE_GROUP01505.{[1]={[y]=-73458.1796875,[x]=-102796.015625,},}
2020-04-01 15:59:02.265 INFO SCRIPTING: Error in timer function: [string "E:\Apex\helo_ops-pg\Moose.lua"]:10457: attempt to compare number with nil
2020-04-01 15:59:02.265 INFO SCRIPTING: stack traceback:
[string "E:\Apex\helo_ops-pg\Moose.lua"]:5781: in function <[string "E:\Apex\helo_ops-pg\Moose.lua"]:5778>
[string "E:\Apex\helo_ops-pg\Moose.lua"]:10457: in function 'IsVec2InZone'
[string "E:\Apex\helo_ops-pg\Moose.lua"]:10472: in function 'IsVec3InZone'
[string "E:\Apex\helo_ops-pg\Moose.lua"]:36203: in function 'IsAnyInZone'
[string "E:\Apex\helo_ops-pg\HeloSupport.lua"]:811: in function <[string "E:\Apex\helo_ops-pg\HeloSupport.lua"]:773>
(tail call): ?
[C]: in function 'xpcall'
Line 10454 in log refers to local ZoneVec2 = self:GetVec2() I have tested to retrieve radius with self:GetRadius() and it returns nil. Zone is created with ZONE_GROUP:New(HeloSupport.PickARandomName(),Group,ZoneRadius)
ZoneRadius holds value 300.
Seems like GetRadius returns nil in function:
When called from GROUP:IsAnyInZone(Zone). Error log is pasted below:
Line 10454 in log refers to
local ZoneVec2 = self:GetVec2()
I have tested to retrieve radius withself:GetRadius()
and it returns nil. Zone is created withZONE_GROUP:New(HeloSupport.PickARandomName(),Group,ZoneRadius)
ZoneRadius holds value 300.