mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Fixed in CLEANUP
- Scan initial units within the subscribed airbases. - Scan if at a birth the unit is within an airbase. - Scan upon checking if the units are within the airbases.
This commit is contained in:
parent
0bb62ce43f
commit
1ae062dc6e
@ -113,6 +113,20 @@ function CLEANUP_AIRBASE:New( AirbaseNames )
|
|||||||
self:HandleEvent( EVENTS.Dead, self.__.OnEventCrash )
|
self:HandleEvent( EVENTS.Dead, self.__.OnEventCrash )
|
||||||
self:HandleEvent( EVENTS.Crash, self.__.OnEventCrash )
|
self:HandleEvent( EVENTS.Crash, self.__.OnEventCrash )
|
||||||
|
|
||||||
|
for UnitName, Unit in pairs( _DATABASE.UNITS ) do
|
||||||
|
local Unit = Unit -- Wrapper.Unit#UNIT
|
||||||
|
if Unit:IsAlive() ~= nil then
|
||||||
|
if self:IsInAirbase( Unit:GetVec2() ) then
|
||||||
|
self:F( { UnitName = UnitName } )
|
||||||
|
self.CleanUpList[UnitName] = {}
|
||||||
|
self.CleanUpList[UnitName].CleanUpUnit = Unit
|
||||||
|
self.CleanUpList[UnitName].CleanUpGroup = Unit:GetGroup()
|
||||||
|
self.CleanUpList[UnitName].CleanUpGroupName = Unit:GetGroup():GetName()
|
||||||
|
self.CleanUpList[UnitName].CleanUpUnitName = Unit:GetName()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -213,11 +227,15 @@ end
|
|||||||
function CLEANUP_AIRBASE.__:OnEventBirth( EventData )
|
function CLEANUP_AIRBASE.__:OnEventBirth( EventData )
|
||||||
self:F( { EventData } )
|
self:F( { EventData } )
|
||||||
|
|
||||||
|
if EventData.IniUnit:IsAlive() ~= nil then
|
||||||
|
if self:IsInAirbase( EventData.IniUnit:GetVec2() ) then
|
||||||
self.CleanUpList[EventData.IniDCSUnitName] = {}
|
self.CleanUpList[EventData.IniDCSUnitName] = {}
|
||||||
self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnit = EventData.IniUnit
|
self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnit = EventData.IniUnit
|
||||||
self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroup = EventData.IniGroup
|
self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroup = EventData.IniGroup
|
||||||
self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroupName = EventData.IniDCSGroupName
|
self.CleanUpList[EventData.IniDCSUnitName].CleanUpGroupName = EventData.IniDCSGroupName
|
||||||
self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnitName = EventData.IniDCSUnitName
|
self.CleanUpList[EventData.IniDCSUnitName].CleanUpUnitName = EventData.IniDCSUnitName
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -350,6 +368,8 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
|
|||||||
|
|
||||||
if CleanUpUnit:IsAlive() ~= nil then
|
if CleanUpUnit:IsAlive() ~= nil then
|
||||||
|
|
||||||
|
if self:IsInAirbase( CleanUpUnit:GetVec2() ) then
|
||||||
|
|
||||||
if _DATABASE:GetStatusGroup( CleanUpGroupName ) ~= "ReSpawn" then
|
if _DATABASE:GetStatusGroup( CleanUpGroupName ) ~= "ReSpawn" then
|
||||||
|
|
||||||
local CleanUpCoordinate = CleanUpUnit:GetCoordinate()
|
local CleanUpCoordinate = CleanUpUnit:GetCoordinate()
|
||||||
@ -373,7 +393,7 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Clean Units which are waiting for a very long time in the CleanUpZone.
|
-- Clean Units which are waiting for a very long time in the CleanUpZone.
|
||||||
if CleanUpUnit then
|
if CleanUpUnit and not CleanUpUnit:GetPlayerName() then
|
||||||
local CleanUpUnitVelocity = CleanUpUnit:GetVelocityKMH()
|
local CleanUpUnitVelocity = CleanUpUnit:GetVelocityKMH()
|
||||||
if CleanUpUnitVelocity < 1 then
|
if CleanUpUnitVelocity < 1 then
|
||||||
if CleanUpListData.CleanUpMoved then
|
if CleanUpListData.CleanUpMoved then
|
||||||
@ -387,7 +407,10 @@ function CLEANUP_AIRBASE.__:CleanUpSchedule()
|
|||||||
CleanUpListData.CleanUpMoved = true
|
CleanUpListData.CleanUpMoved = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
-- not anymore in an airbase zone, remove from cleanup list.
|
||||||
|
self.CleanUpList[CleanUpUnitName] = nil
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- Do nothing ...
|
-- Do nothing ...
|
||||||
self.CleanUpList[CleanUpUnitName] = nil
|
self.CleanUpList[CleanUpUnitName] = nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user