mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Add a check for the Radius parameter in POSITIONABLE:GetRandomVec3(Radius)
This commit is contained in:
parent
1e60111ce5
commit
080cadb8e0
@ -474,10 +474,12 @@ end
|
||||
-- @param #GROUP self
|
||||
-- @param #number Radius
|
||||
-- @return Dcs.DCSTypes#Vec3 The random 3D point vector around the first UNIT of the GROUP.
|
||||
-- @return #nil The GROUP is invalid or empty
|
||||
-- @return #nil The GROUP is invalid or empty
|
||||
-- @usage
|
||||
-- -- If Radius is ignored, returns the Dcs.DCSTypes#Vec3 of first UNIT of the GROUP
|
||||
function GROUP:GetRandomVec3(Radius)
|
||||
self:F2(self.GroupName)
|
||||
|
||||
|
||||
local FirstUnit = self:GetUnit(1)
|
||||
|
||||
if FirstUnit then
|
||||
|
||||
@ -138,6 +138,8 @@ end
|
||||
-- @param #number Radius
|
||||
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
|
||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||
-- @usage
|
||||
-- -- If Radius is ignored, returns the Dcs.DCSTypes#Vec3 of first UNIT of the GROUP
|
||||
function POSITIONABLE:GetRandomVec3( Radius )
|
||||
self:F2( self.PositionableName )
|
||||
|
||||
@ -145,14 +147,20 @@ function POSITIONABLE:GetRandomVec3( Radius )
|
||||
|
||||
if DCSPositionable then
|
||||
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
||||
local PositionableRandomVec3 = {}
|
||||
local angle = math.random() * math.pi*2;
|
||||
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
||||
PositionableRandomVec3.y = PositionablePointVec3.y
|
||||
PositionableRandomVec3.z = PositionablePointVec3.z + math.sin( angle ) * math.random() * Radius;
|
||||
|
||||
self:T3( PositionableRandomVec3 )
|
||||
return PositionableRandomVec3
|
||||
if Radius then
|
||||
local PositionableRandomVec3 = {}
|
||||
local angle = math.random() * math.pi*2;
|
||||
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
||||
PositionableRandomVec3.y = PositionablePointVec3.y
|
||||
PositionableRandomVec3.z = PositionablePointVec3.z + math.sin( angle ) * math.random() * Radius;
|
||||
|
||||
self:T3( PositionableRandomVec3 )
|
||||
return PositionableRandomVec3
|
||||
else
|
||||
self:E("Radius is nil, returning the PointVec3 of the POSITIONABLE", PositionablePointVec3)
|
||||
return PositionablePointVec3
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170327_1145' )
|
||||
env.info( 'Moose Generation Timestamp: 20170327_1159' )
|
||||
local base = _G
|
||||
|
||||
Include = {}
|
||||
@ -13544,6 +13544,8 @@ end
|
||||
-- @param #number Radius
|
||||
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
|
||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||
-- @usage
|
||||
-- -- If Radius is ignored, returns the Dcs.DCSTypes#Vec3 of first UNIT of the GROUP
|
||||
function POSITIONABLE:GetRandomVec3( Radius )
|
||||
self:F2( self.PositionableName )
|
||||
|
||||
@ -13551,14 +13553,20 @@ function POSITIONABLE:GetRandomVec3( Radius )
|
||||
|
||||
if DCSPositionable then
|
||||
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
||||
local PositionableRandomVec3 = {}
|
||||
local angle = math.random() * math.pi*2;
|
||||
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
||||
PositionableRandomVec3.y = PositionablePointVec3.y
|
||||
PositionableRandomVec3.z = PositionablePointVec3.z + math.sin( angle ) * math.random() * Radius;
|
||||
|
||||
self:T3( PositionableRandomVec3 )
|
||||
return PositionableRandomVec3
|
||||
if Radius then
|
||||
local PositionableRandomVec3 = {}
|
||||
local angle = math.random() * math.pi*2;
|
||||
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
||||
PositionableRandomVec3.y = PositionablePointVec3.y
|
||||
PositionableRandomVec3.z = PositionablePointVec3.z + math.sin( angle ) * math.random() * Radius;
|
||||
|
||||
self:T3( PositionableRandomVec3 )
|
||||
return PositionableRandomVec3
|
||||
else
|
||||
self:E("Radius is nil, returning the Vec3 of the POSITIONABLE", PositionablePointVec3)
|
||||
return PositionablePointVec3
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
@ -16548,10 +16556,12 @@ end
|
||||
-- @param #GROUP self
|
||||
-- @param #number Radius
|
||||
-- @return Dcs.DCSTypes#Vec3 The random 3D point vector around the first UNIT of the GROUP.
|
||||
-- @return #nil The GROUP is invalid or empty
|
||||
-- @return #nil The GROUP is invalid or empty
|
||||
-- @usage
|
||||
-- -- If Radius is ignored, returns the Dcs.DCSTypes#Vec3 of first UNIT of the GROUP
|
||||
function GROUP:GetRandomVec3(Radius)
|
||||
self:F2(self.GroupName)
|
||||
|
||||
|
||||
local FirstUnit = self:GetUnit(1)
|
||||
|
||||
if FirstUnit then
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170327_1145' )
|
||||
env.info( 'Moose Generation Timestamp: 20170327_1159' )
|
||||
local base = _G
|
||||
|
||||
Include = {}
|
||||
@ -13544,6 +13544,8 @@ end
|
||||
-- @param #number Radius
|
||||
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
|
||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||
-- @usage
|
||||
-- -- If Radius is ignored, returns the Dcs.DCSTypes#Vec3 of first UNIT of the GROUP
|
||||
function POSITIONABLE:GetRandomVec3( Radius )
|
||||
self:F2( self.PositionableName )
|
||||
|
||||
@ -13551,14 +13553,20 @@ function POSITIONABLE:GetRandomVec3( Radius )
|
||||
|
||||
if DCSPositionable then
|
||||
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
||||
local PositionableRandomVec3 = {}
|
||||
local angle = math.random() * math.pi*2;
|
||||
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
||||
PositionableRandomVec3.y = PositionablePointVec3.y
|
||||
PositionableRandomVec3.z = PositionablePointVec3.z + math.sin( angle ) * math.random() * Radius;
|
||||
|
||||
self:T3( PositionableRandomVec3 )
|
||||
return PositionableRandomVec3
|
||||
if Radius then
|
||||
local PositionableRandomVec3 = {}
|
||||
local angle = math.random() * math.pi*2;
|
||||
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
||||
PositionableRandomVec3.y = PositionablePointVec3.y
|
||||
PositionableRandomVec3.z = PositionablePointVec3.z + math.sin( angle ) * math.random() * Radius;
|
||||
|
||||
self:T3( PositionableRandomVec3 )
|
||||
return PositionableRandomVec3
|
||||
else
|
||||
self:E("Radius is nil, returning the Vec3 of the POSITIONABLE", PositionablePointVec3)
|
||||
return PositionablePointVec3
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
@ -16548,10 +16556,12 @@ end
|
||||
-- @param #GROUP self
|
||||
-- @param #number Radius
|
||||
-- @return Dcs.DCSTypes#Vec3 The random 3D point vector around the first UNIT of the GROUP.
|
||||
-- @return #nil The GROUP is invalid or empty
|
||||
-- @return #nil The GROUP is invalid or empty
|
||||
-- @usage
|
||||
-- -- If Radius is ignored, returns the Dcs.DCSTypes#Vec3 of first UNIT of the GROUP
|
||||
function GROUP:GetRandomVec3(Radius)
|
||||
self:F2(self.GroupName)
|
||||
|
||||
|
||||
local FirstUnit = self:GetUnit(1)
|
||||
|
||||
if FirstUnit then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user