mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
commit
0753e48bee
@ -456,6 +456,7 @@ function GROUP:GetVec2()
|
||||
end
|
||||
|
||||
--- Returns the current Vec3 vector of the first DCS Unit in the GROUP.
|
||||
-- @param #GROUP self
|
||||
-- @return Dcs.DCSTypes#Vec3 Current Vec3 of the first DCS Unit of the GROUP.
|
||||
function GROUP:GetVec3()
|
||||
self:F2( self.GroupName )
|
||||
@ -465,7 +466,65 @@ function GROUP:GetVec3()
|
||||
return GroupVec3
|
||||
end
|
||||
|
||||
--- Returns a POINT_VEC2 object indicating the point in 2D of the first UNIT of the GROUP within the mission.
|
||||
-- @param #GROUP self
|
||||
-- @return Core.Point#POINT_VEC2 The 2D point vector of the first DCS Unit of the GROUP.
|
||||
-- @return #nil The first UNIT is not existing or alive.
|
||||
function GROUP:GetPointVec2()
|
||||
self:F2(self.GroupName)
|
||||
|
||||
local FirstUnit = self:GetUnit(1)
|
||||
|
||||
if FirstUnit then
|
||||
local FirstUnitPointVec2 = FirstUnit:GetPointVec2()
|
||||
self:T3(FirstUnitPointVec2)
|
||||
return FirstUnitPointVec2
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns a random @{DCSTypes#Vec3} vector (point in 3D of the UNIT within the mission) within a range around the first UNIT of the GROUP.
|
||||
-- @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
|
||||
-- @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
|
||||
local FirstUnitRandomPointVec3 = FirstUnit:GetRandomVec3(Radius)
|
||||
self:T3(FirstUnitRandomPointVec3)
|
||||
return FirstUnitRandomPointVec3
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns the mean heading of every UNIT in the GROUP in degrees
|
||||
-- @param #GROUP self
|
||||
-- @return #number mean heading of the GROUP
|
||||
-- @return #nil The first UNIT is not existing or alive.
|
||||
function GROUP:GetHeading()
|
||||
self:F2(self.GroupName)
|
||||
|
||||
local GroupSize = self:GetSize()
|
||||
local HeadingAccumulator = 0
|
||||
|
||||
if GroupSize then
|
||||
for i = 1, GroupSize do
|
||||
HeadingAccumulator = HeadingAccumulator + self:GetUnit(i):GetHeading()
|
||||
end
|
||||
return math.floor(HeadingAccumulator / GroupSize)
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
end
|
||||
|
||||
do -- Is Zone methods
|
||||
|
||||
|
||||
@ -135,8 +135,11 @@ end
|
||||
|
||||
--- Returns a random @{DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
|
||||
-- @param Wrapper.Positionable#POSITIONABLE self
|
||||
-- @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 )
|
||||
|
||||
@ -144,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
|
||||
@ -219,6 +228,7 @@ end
|
||||
--- Returns the POSITIONABLE heading in degrees.
|
||||
-- @param Wrapper.Positionable#POSITIONABLE self
|
||||
-- @return #number The POSTIONABLE heading
|
||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||
function POSITIONABLE:GetHeading()
|
||||
local DCSPositionable = self:GetDCSObject()
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170327_1033' )
|
||||
env.info( 'Moose Generation Timestamp: 20170327_1219' )
|
||||
local base = _G
|
||||
|
||||
Include = {}
|
||||
@ -13543,8 +13543,11 @@ end
|
||||
|
||||
--- Returns a random @{DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
|
||||
-- @param Wrapper.Positionable#POSITIONABLE self
|
||||
-- @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 )
|
||||
|
||||
@ -13552,14 +13555,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
|
||||
@ -13627,6 +13636,7 @@ end
|
||||
--- Returns the POSITIONABLE heading in degrees.
|
||||
-- @param Wrapper.Positionable#POSITIONABLE self
|
||||
-- @return #number The POSTIONABLE heading
|
||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||
function POSITIONABLE:GetHeading()
|
||||
local DCSPositionable = self:GetDCSObject()
|
||||
|
||||
@ -16530,6 +16540,7 @@ function GROUP:GetVec2()
|
||||
end
|
||||
|
||||
--- Returns the current Vec3 vector of the first DCS Unit in the GROUP.
|
||||
-- @param #GROUP self
|
||||
-- @return Dcs.DCSTypes#Vec3 Current Vec3 of the first DCS Unit of the GROUP.
|
||||
function GROUP:GetVec3()
|
||||
self:F2( self.GroupName )
|
||||
@ -16539,7 +16550,65 @@ function GROUP:GetVec3()
|
||||
return GroupVec3
|
||||
end
|
||||
|
||||
--- Returns a POINT_VEC2 object indicating the point in 2D of the first UNIT of the GROUP within the mission.
|
||||
-- @param #GROUP self
|
||||
-- @return Core.Point#POINT_VEC2 The 2D point vector of the first DCS Unit of the GROUP.
|
||||
-- @return #nil The first UNIT is not existing or alive.
|
||||
function GROUP:GetPointVec2()
|
||||
self:F2(self.GroupName)
|
||||
|
||||
local FirstUnit = self:GetUnit(1)
|
||||
|
||||
if FirstUnit then
|
||||
local FirstUnitPointVec2 = FirstUnit:GetPointVec2()
|
||||
self:T3(FirstUnitPointVec2)
|
||||
return FirstUnitPointVec2
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns a random @{DCSTypes#Vec3} vector (point in 3D of the UNIT within the mission) within a range around the first UNIT of the GROUP.
|
||||
-- @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
|
||||
-- @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
|
||||
local FirstUnitRandomPointVec3 = FirstUnit:GetRandomVec3(Radius)
|
||||
self:T3(FirstUnitRandomPointVec3)
|
||||
return FirstUnitRandomPointVec3
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns the mean heading of every UNIT in the GROUP in degrees
|
||||
-- @param #GROUP self
|
||||
-- @return #number mean heading of the GROUP
|
||||
-- @return #nil The first UNIT is not existing or alive.
|
||||
function GROUP:GetHeading()
|
||||
self:F2(self.GroupName)
|
||||
|
||||
local GroupSize = self:GetSize()
|
||||
local HeadingAccumulator = 0
|
||||
|
||||
if GroupSize then
|
||||
for i = 1, GroupSize do
|
||||
HeadingAccumulator = HeadingAccumulator + self:GetUnit(i):GetHeading()
|
||||
end
|
||||
return math.floor(HeadingAccumulator / GroupSize)
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
end
|
||||
|
||||
do -- Is Zone methods
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170327_1033' )
|
||||
env.info( 'Moose Generation Timestamp: 20170327_1219' )
|
||||
local base = _G
|
||||
|
||||
Include = {}
|
||||
@ -13543,8 +13543,11 @@ end
|
||||
|
||||
--- Returns a random @{DCSTypes#Vec3} vector within a range, indicating the point in 3D of the POSITIONABLE within the mission.
|
||||
-- @param Wrapper.Positionable#POSITIONABLE self
|
||||
-- @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 )
|
||||
|
||||
@ -13552,14 +13555,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
|
||||
@ -13627,6 +13636,7 @@ end
|
||||
--- Returns the POSITIONABLE heading in degrees.
|
||||
-- @param Wrapper.Positionable#POSITIONABLE self
|
||||
-- @return #number The POSTIONABLE heading
|
||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||
function POSITIONABLE:GetHeading()
|
||||
local DCSPositionable = self:GetDCSObject()
|
||||
|
||||
@ -16530,6 +16540,7 @@ function GROUP:GetVec2()
|
||||
end
|
||||
|
||||
--- Returns the current Vec3 vector of the first DCS Unit in the GROUP.
|
||||
-- @param #GROUP self
|
||||
-- @return Dcs.DCSTypes#Vec3 Current Vec3 of the first DCS Unit of the GROUP.
|
||||
function GROUP:GetVec3()
|
||||
self:F2( self.GroupName )
|
||||
@ -16539,7 +16550,65 @@ function GROUP:GetVec3()
|
||||
return GroupVec3
|
||||
end
|
||||
|
||||
--- Returns a POINT_VEC2 object indicating the point in 2D of the first UNIT of the GROUP within the mission.
|
||||
-- @param #GROUP self
|
||||
-- @return Core.Point#POINT_VEC2 The 2D point vector of the first DCS Unit of the GROUP.
|
||||
-- @return #nil The first UNIT is not existing or alive.
|
||||
function GROUP:GetPointVec2()
|
||||
self:F2(self.GroupName)
|
||||
|
||||
local FirstUnit = self:GetUnit(1)
|
||||
|
||||
if FirstUnit then
|
||||
local FirstUnitPointVec2 = FirstUnit:GetPointVec2()
|
||||
self:T3(FirstUnitPointVec2)
|
||||
return FirstUnitPointVec2
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns a random @{DCSTypes#Vec3} vector (point in 3D of the UNIT within the mission) within a range around the first UNIT of the GROUP.
|
||||
-- @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
|
||||
-- @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
|
||||
local FirstUnitRandomPointVec3 = FirstUnit:GetRandomVec3(Radius)
|
||||
self:T3(FirstUnitRandomPointVec3)
|
||||
return FirstUnitRandomPointVec3
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns the mean heading of every UNIT in the GROUP in degrees
|
||||
-- @param #GROUP self
|
||||
-- @return #number mean heading of the GROUP
|
||||
-- @return #nil The first UNIT is not existing or alive.
|
||||
function GROUP:GetHeading()
|
||||
self:F2(self.GroupName)
|
||||
|
||||
local GroupSize = self:GetSize()
|
||||
local HeadingAccumulator = 0
|
||||
|
||||
if GroupSize then
|
||||
for i = 1, GroupSize do
|
||||
HeadingAccumulator = HeadingAccumulator + self:GetUnit(i):GetHeading()
|
||||
end
|
||||
return math.floor(HeadingAccumulator / GroupSize)
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
end
|
||||
|
||||
do -- Is Zone methods
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user