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
@ -475,6 +475,8 @@ end
|
|||||||
-- @param #number Radius
|
-- @param #number Radius
|
||||||
-- @return Dcs.DCSTypes#Vec3 The random 3D point vector around the first UNIT of the GROUP.
|
-- @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)
|
function GROUP:GetRandomVec3(Radius)
|
||||||
self:F2(self.GroupName)
|
self:F2(self.GroupName)
|
||||||
|
|
||||||
|
|||||||
@ -138,6 +138,8 @@ end
|
|||||||
-- @param #number Radius
|
-- @param #number Radius
|
||||||
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
|
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
|
||||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
-- @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 )
|
function POSITIONABLE:GetRandomVec3( Radius )
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
@ -145,6 +147,8 @@ function POSITIONABLE:GetRandomVec3( Radius )
|
|||||||
|
|
||||||
if DCSPositionable then
|
if DCSPositionable then
|
||||||
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
||||||
|
|
||||||
|
if Radius then
|
||||||
local PositionableRandomVec3 = {}
|
local PositionableRandomVec3 = {}
|
||||||
local angle = math.random() * math.pi*2;
|
local angle = math.random() * math.pi*2;
|
||||||
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
||||||
@ -153,6 +157,10 @@ function POSITIONABLE:GetRandomVec3( Radius )
|
|||||||
|
|
||||||
self:T3( PositionableRandomVec3 )
|
self:T3( PositionableRandomVec3 )
|
||||||
return PositionableRandomVec3
|
return PositionableRandomVec3
|
||||||
|
else
|
||||||
|
self:E("Radius is nil, returning the PointVec3 of the POSITIONABLE", PositionablePointVec3)
|
||||||
|
return PositionablePointVec3
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20170327_1145' )
|
env.info( 'Moose Generation Timestamp: 20170327_1159' )
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
Include = {}
|
Include = {}
|
||||||
@ -13544,6 +13544,8 @@ end
|
|||||||
-- @param #number Radius
|
-- @param #number Radius
|
||||||
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
|
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
|
||||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
-- @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 )
|
function POSITIONABLE:GetRandomVec3( Radius )
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
@ -13551,6 +13553,8 @@ function POSITIONABLE:GetRandomVec3( Radius )
|
|||||||
|
|
||||||
if DCSPositionable then
|
if DCSPositionable then
|
||||||
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
||||||
|
|
||||||
|
if Radius then
|
||||||
local PositionableRandomVec3 = {}
|
local PositionableRandomVec3 = {}
|
||||||
local angle = math.random() * math.pi*2;
|
local angle = math.random() * math.pi*2;
|
||||||
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
||||||
@ -13559,6 +13563,10 @@ function POSITIONABLE:GetRandomVec3( Radius )
|
|||||||
|
|
||||||
self:T3( PositionableRandomVec3 )
|
self:T3( PositionableRandomVec3 )
|
||||||
return PositionableRandomVec3
|
return PositionableRandomVec3
|
||||||
|
else
|
||||||
|
self:E("Radius is nil, returning the Vec3 of the POSITIONABLE", PositionablePointVec3)
|
||||||
|
return PositionablePointVec3
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -16549,6 +16557,8 @@ end
|
|||||||
-- @param #number Radius
|
-- @param #number Radius
|
||||||
-- @return Dcs.DCSTypes#Vec3 The random 3D point vector around the first UNIT of the GROUP.
|
-- @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)
|
function GROUP:GetRandomVec3(Radius)
|
||||||
self:F2(self.GroupName)
|
self:F2(self.GroupName)
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20170327_1145' )
|
env.info( 'Moose Generation Timestamp: 20170327_1159' )
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
Include = {}
|
Include = {}
|
||||||
@ -13544,6 +13544,8 @@ end
|
|||||||
-- @param #number Radius
|
-- @param #number Radius
|
||||||
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
|
-- @return Dcs.DCSTypes#Vec3 The 3D point vector of the POSITIONABLE.
|
||||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
-- @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 )
|
function POSITIONABLE:GetRandomVec3( Radius )
|
||||||
self:F2( self.PositionableName )
|
self:F2( self.PositionableName )
|
||||||
|
|
||||||
@ -13551,6 +13553,8 @@ function POSITIONABLE:GetRandomVec3( Radius )
|
|||||||
|
|
||||||
if DCSPositionable then
|
if DCSPositionable then
|
||||||
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
local PositionablePointVec3 = DCSPositionable:getPosition().p
|
||||||
|
|
||||||
|
if Radius then
|
||||||
local PositionableRandomVec3 = {}
|
local PositionableRandomVec3 = {}
|
||||||
local angle = math.random() * math.pi*2;
|
local angle = math.random() * math.pi*2;
|
||||||
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
PositionableRandomVec3.x = PositionablePointVec3.x + math.cos( angle ) * math.random() * Radius;
|
||||||
@ -13559,6 +13563,10 @@ function POSITIONABLE:GetRandomVec3( Radius )
|
|||||||
|
|
||||||
self:T3( PositionableRandomVec3 )
|
self:T3( PositionableRandomVec3 )
|
||||||
return PositionableRandomVec3
|
return PositionableRandomVec3
|
||||||
|
else
|
||||||
|
self:E("Radius is nil, returning the Vec3 of the POSITIONABLE", PositionablePointVec3)
|
||||||
|
return PositionablePointVec3
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -16549,6 +16557,8 @@ end
|
|||||||
-- @param #number Radius
|
-- @param #number Radius
|
||||||
-- @return Dcs.DCSTypes#Vec3 The random 3D point vector around the first UNIT of the GROUP.
|
-- @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)
|
function GROUP:GetRandomVec3(Radius)
|
||||||
self:F2(self.GroupName)
|
self:F2(self.GroupName)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user