mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
f6fdff927b
@ -2425,6 +2425,26 @@ do -- SET_UNIT
|
|||||||
return CountU
|
return CountU
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Gets the alive set.
|
||||||
|
-- @param #SET_UNIT self
|
||||||
|
-- @return #table Table of SET objects
|
||||||
|
-- @return #SET_UNIT AliveSet
|
||||||
|
function SET_UNIT:GetAliveSet()
|
||||||
|
|
||||||
|
local AliveSet = SET_UNIT:New()
|
||||||
|
|
||||||
|
-- Clean the Set before returning with only the alive Groups.
|
||||||
|
for GroupName, GroupObject in pairs(self.Set) do
|
||||||
|
local GroupObject=GroupObject --Wrapper.Client#CLIENT
|
||||||
|
|
||||||
|
if GroupObject and GroupObject:IsAlive() then
|
||||||
|
AliveSet:Add(GroupName, GroupObject)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return AliveSet.Set or {}, AliveSet
|
||||||
|
end
|
||||||
|
|
||||||
--- [Internal] Private function for use of continous zone filter
|
--- [Internal] Private function for use of continous zone filter
|
||||||
-- @param #SET_UNIT self
|
-- @param #SET_UNIT self
|
||||||
-- @return #SET_UNIT self
|
-- @return #SET_UNIT self
|
||||||
@ -2820,7 +2840,13 @@ do -- SET_UNIT
|
|||||||
-- @return Core.Point#COORDINATE The center coordinate of all the units in the set, including heading in degrees and speed in mps in case of moving units.
|
-- @return Core.Point#COORDINATE The center coordinate of all the units in the set, including heading in degrees and speed in mps in case of moving units.
|
||||||
function SET_UNIT:GetCoordinate()
|
function SET_UNIT:GetCoordinate()
|
||||||
|
|
||||||
local Coordinate = self:GetRandom():GetCoordinate()
|
local Coordinate = nil
|
||||||
|
local unit = self:GetRandom()
|
||||||
|
if self:Count() == 1 and unit then
|
||||||
|
return unit:GetCoordinate()
|
||||||
|
end
|
||||||
|
if unit then
|
||||||
|
local Coordinate = unit:GetCoordinate()
|
||||||
--self:F({Coordinate:GetVec3()})
|
--self:F({Coordinate:GetVec3()})
|
||||||
|
|
||||||
|
|
||||||
@ -2834,7 +2860,7 @@ do -- SET_UNIT
|
|||||||
local AvgHeading = nil
|
local AvgHeading = nil
|
||||||
local MovingCount = 0
|
local MovingCount = 0
|
||||||
|
|
||||||
for UnitName, UnitData in pairs( self:GetSet() ) do
|
for UnitName, UnitData in pairs( self:GetAliveSet() ) do
|
||||||
|
|
||||||
local Unit = UnitData -- Wrapper.Unit#UNIT
|
local Unit = UnitData -- Wrapper.Unit#UNIT
|
||||||
local Coordinate = Unit:GetCoordinate()
|
local Coordinate = Unit:GetCoordinate()
|
||||||
@ -2864,6 +2890,7 @@ do -- SET_UNIT
|
|||||||
Coordinate:SetVelocity( MaxVelocity )
|
Coordinate:SetVelocity( MaxVelocity )
|
||||||
|
|
||||||
self:F( { Coordinate = Coordinate } )
|
self:F( { Coordinate = Coordinate } )
|
||||||
|
end
|
||||||
return Coordinate
|
return Coordinate
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -4317,6 +4344,8 @@ do -- SET_CLIENT
|
|||||||
self:UnHandleEvent(EVENTS.Birth)
|
self:UnHandleEvent(EVENTS.Birth)
|
||||||
self:UnHandleEvent(EVENTS.Dead)
|
self:UnHandleEvent(EVENTS.Dead)
|
||||||
self:UnHandleEvent(EVENTS.Crash)
|
self:UnHandleEvent(EVENTS.Crash)
|
||||||
|
--self:UnHandleEvent(EVENTS.PlayerEnterUnit)
|
||||||
|
--self:UnHandleEvent(EVENTS.PlayerLeaveUnit)
|
||||||
|
|
||||||
if self.Filter.Zones and self.ZoneTimer and self.ZoneTimer:IsRunning() then
|
if self.Filter.Zones and self.ZoneTimer and self.ZoneTimer:IsRunning() then
|
||||||
self.ZoneTimer:Stop()
|
self.ZoneTimer:Stop()
|
||||||
@ -4335,6 +4364,9 @@ do -- SET_CLIENT
|
|||||||
self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
|
self:HandleEvent( EVENTS.Birth, self._EventOnBirth )
|
||||||
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.Dead, self._EventOnDeadOrCrash )
|
||||||
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
|
self:HandleEvent( EVENTS.Crash, self._EventOnDeadOrCrash )
|
||||||
|
--self:HandleEvent( EVENTS.PlayerEnterUnit, self._EventPlayerEnterUnit)
|
||||||
|
--self:HandleEvent( EVENTS.PlayerLeaveUnit, self._EventPlayerLeaveUnit)
|
||||||
|
--self:SetEventPriority(1)
|
||||||
if self.Filter.Zones then
|
if self.Filter.Zones then
|
||||||
self.ZoneTimer = TIMER:New(self._ContinousZoneFilter,self)
|
self.ZoneTimer = TIMER:New(self._ContinousZoneFilter,self)
|
||||||
local timing = self.ZoneTimerInterval or 30
|
local timing = self.ZoneTimerInterval or 30
|
||||||
@ -4346,6 +4378,43 @@ do -- SET_CLIENT
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Handle CA slots addition
|
||||||
|
-- @param #SET_CLIENT self
|
||||||
|
-- @param Core.Event#EVENTDATA Event
|
||||||
|
-- @return #SET_CLIENT self
|
||||||
|
function SET_CLIENT:_EventPlayerEnterUnit(Event)
|
||||||
|
self:I( "_EventPlayerEnterUnit" )
|
||||||
|
if Event.IniDCSUnit then
|
||||||
|
if Event.IniObjectCategory == 1 and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||||
|
-- CA Slot entered
|
||||||
|
local ObjectName, Object = self:AddInDatabase( Event )
|
||||||
|
self:I( ObjectName, UTILS.PrintTableToLog(Object) )
|
||||||
|
if Object and self:IsIncludeObject( Object ) then
|
||||||
|
self:Add( ObjectName, Object )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Handle CA slots removal
|
||||||
|
-- @param #SET_CLIENT self
|
||||||
|
-- @param Core.Event#EVENTDATA Event
|
||||||
|
-- @return #SET_CLIENT self
|
||||||
|
function SET_CLIENT:_EventPlayerLeaveUnit(Event)
|
||||||
|
self:I( "_EventPlayerLeaveUnit" )
|
||||||
|
if Event.IniDCSUnit then
|
||||||
|
if Event.IniObjectCategory == 1 and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||||
|
-- CA Slot left
|
||||||
|
local ObjectName, Object = self:FindInDatabase( Event )
|
||||||
|
if ObjectName then
|
||||||
|
self:Remove( ObjectName )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||||
-- @param #SET_CLIENT self
|
-- @param #SET_CLIENT self
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user