mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop' into FF/Develop
This commit is contained in:
@@ -205,18 +205,18 @@ function GROUP:GetPositionVec3() -- Overridden from POSITIONABLE:GetPositionVec3
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns if the Group is alive.
|
||||
--- Returns if the group is alive.
|
||||
-- The Group must:
|
||||
--
|
||||
-- * Exist at run-time.
|
||||
-- * Has at least one unit.
|
||||
--
|
||||
-- When the first @{Wrapper.Unit} of the Group is active, it will return true.
|
||||
-- If the first @{Wrapper.Unit} of the Group is inactive, it will return false.
|
||||
-- When the first @{Wrapper.Unit} of the group is active, it will return true.
|
||||
-- If the first @{Wrapper.Unit} of the group is inactive, it will return false.
|
||||
--
|
||||
-- @param #GROUP self
|
||||
-- @return #boolean true if the Group is alive and active.
|
||||
-- @return #boolean false if the Group is alive but inactive.
|
||||
-- @return #boolean true if the group is alive and active.
|
||||
-- @return #boolean false if the group is alive but inactive.
|
||||
-- @return #nil if the group does not exist anymore.
|
||||
function GROUP:IsAlive()
|
||||
self:F2( self.GroupName )
|
||||
@@ -237,6 +237,26 @@ function GROUP:IsAlive()
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns if the group is activated.
|
||||
-- @param #GROUP self
|
||||
-- @return #boolean true if group is activated.
|
||||
-- @return #nil The group is not existing or alive.
|
||||
function GROUP:IsActive()
|
||||
self:F2( self.GroupName )
|
||||
|
||||
local DCSGroup = self:GetDCSObject() -- DCS#Group
|
||||
|
||||
if DCSGroup then
|
||||
|
||||
local GroupIsActive = DCSGroup:getUnit(1):isActive()
|
||||
return GroupIsActive
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Destroys the DCS Group and all of its DCS Units.
|
||||
-- Note that this destroy method also can raise a destroy event at run-time.
|
||||
-- So all event listeners will catch the destroy event of this group for each unit in the group.
|
||||
@@ -261,13 +281,15 @@ function GROUP:Destroy( GenerateEvent )
|
||||
local DCSGroup = self:GetDCSObject()
|
||||
|
||||
if DCSGroup then
|
||||
if GenerateEvent and GenerateEvent == true then
|
||||
for Index, UnitData in pairs( DCSGroup:getUnits() ) do
|
||||
for Index, UnitData in pairs( DCSGroup:getUnits() ) do
|
||||
if GenerateEvent and GenerateEvent == true then
|
||||
if self:IsAir() then
|
||||
self:CreateEventCrash( timer.getTime(), UnitData )
|
||||
else
|
||||
self:CreateEventDead( timer.getTime(), UnitData )
|
||||
end
|
||||
else
|
||||
self:CreateEventRemoveUnit( timer.getTime(), UnitData )
|
||||
end
|
||||
end
|
||||
USERFLAG:New( self:GetName() ):Set( 100 )
|
||||
|
||||
@@ -69,6 +69,38 @@ function POSITIONABLE:New( PositionableName )
|
||||
return self
|
||||
end
|
||||
|
||||
--- Destroys the POSITIONABLE.
|
||||
-- @param #POSITIONABLE self
|
||||
-- @param #boolean GenerateEvent (Optional) true if you want to generate a crash or dead event for the unit.
|
||||
-- @return #nil The DCS Unit is not existing or alive.
|
||||
function POSITIONABLE:Destroy( GenerateEvent )
|
||||
self:F2( self.ObjectName )
|
||||
|
||||
local DCSObject = self:GetDCSObject()
|
||||
|
||||
if DCSObject then
|
||||
|
||||
local UnitGroup = self:GetGroup()
|
||||
local UnitGroupName = UnitGroup:GetName()
|
||||
self:F( { UnitGroupName = UnitGroupName } )
|
||||
|
||||
if GenerateEvent and GenerateEvent == true then
|
||||
if self:IsAir() then
|
||||
self:CreateEventCrash( timer.getTime(), DCSObject )
|
||||
else
|
||||
self:CreateEventDead( timer.getTime(), DCSObject )
|
||||
end
|
||||
else
|
||||
self:CreateEventRemoveUnit( timer.getTime(), DCSObject )
|
||||
end
|
||||
|
||||
USERFLAG:New( UnitGroupName ):Set( 100 )
|
||||
DCSObject:destroy()
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns the @{DCS#Position3} position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.
|
||||
-- @param Wrapper.Positionable#POSITIONABLE self
|
||||
-- @return DCS#Position The 3D position vectors of the POSITIONABLE.
|
||||
|
||||
@@ -159,35 +159,7 @@ function UNIT:GetDCSObject()
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Destroys the UNIT.
|
||||
-- @param #UNIT self
|
||||
-- @param #boolean GenerateEvent (Optional) true if you want to generate a crash or dead event for the unit.
|
||||
-- @return #nil The DCS Unit is not existing or alive.
|
||||
function UNIT:Destroy( GenerateEvent )
|
||||
self:F2( self.ObjectName )
|
||||
|
||||
local DCSObject = self:GetDCSObject()
|
||||
|
||||
if DCSObject then
|
||||
|
||||
local UnitGroup = self:GetGroup()
|
||||
local UnitGroupName = UnitGroup:GetName()
|
||||
self:F( { UnitGroupName = UnitGroupName } )
|
||||
|
||||
if GenerateEvent and GenerateEvent == true then
|
||||
if self:IsAir() then
|
||||
self:CreateEventCrash( timer.getTime(), DCSObject )
|
||||
else
|
||||
self:CreateEventDead( timer.getTime(), DCSObject )
|
||||
end
|
||||
end
|
||||
|
||||
USERFLAG:New( UnitGroupName ):Set( 100 )
|
||||
DCSObject:destroy()
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
--- Respawn the @{Wrapper.Unit} using a (tweaked) template of the parent Group.
|
||||
|
||||
Reference in New Issue
Block a user