mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Updated CleanUp to clean more units from airbase
This commit is contained in:
parent
0894d4ee40
commit
e411ed50cf
1
Base.lua
1
Base.lua
@ -116,7 +116,6 @@ trace.f(self.ClassName, event )
|
||||
--env.info( 'onEvent EventObject.Event = ' .. tostring(EventObject.Event) )
|
||||
if event.id == EventObject.Event then
|
||||
if self == EventObject.Self then
|
||||
--env.info( 'onEvent Call EventFunction' )
|
||||
EventObject.EventFunction( self, event )
|
||||
end
|
||||
end
|
||||
|
||||
30
CleanUp.lua
30
CleanUp.lua
@ -96,22 +96,34 @@ end
|
||||
function CLEANUP:_Scheduler()
|
||||
|
||||
for GroupName, ListData in pairs( self.CleanUpList ) do
|
||||
env.info( "CleanUp: GroupName = " .. GroupName )
|
||||
env.info( "CleanUp: UnitName = " .. ListData )
|
||||
env.info( "CleanUp: GroupName = " .. GroupName .. " UnitName = " .. ListData )
|
||||
local CleanUpGroup = Group.getByName( GroupName )
|
||||
local CleanUpUnit = Unit.getByName( ListData )
|
||||
if CleanUpUnit and CleanUpGroup then
|
||||
env.info( "CleanUp: Check Database" )
|
||||
if _Database:GetStatusGroup( GroupName ) ~= "ReSpawn" then
|
||||
env.info( "CleanUp: Database OK" )
|
||||
local CleanUpUnitVelocity = CleanUpUnit:getVelocity()
|
||||
local CleanUpUnitVelocityTotal = math.abs(CleanUpUnitVelocity.x) + math.abs(CleanUpUnitVelocity.y) + math.abs(CleanUpUnitVelocity.z)
|
||||
if CleanUpUnitVelocityTotal < 1 then
|
||||
env.info( "CleanUp: Destroy: " .. GroupName )
|
||||
CleanUpGroup:destroy()
|
||||
if CleanUpGroup:isExist() and CleanUpUnit:isExist() then
|
||||
env.info( "CleanUp: Group Existing" )
|
||||
if _Database:GetStatusGroup( GroupName ) ~= "ReSpawn" then
|
||||
env.info( "CleanUp: Database OK" )
|
||||
local CleanUpUnitVelocity = CleanUpUnit:getVelocity()
|
||||
local CleanUpUnitVelocityTotal = math.abs(CleanUpUnitVelocity.x) + math.abs(CleanUpUnitVelocity.y) + math.abs(CleanUpUnitVelocity.z)
|
||||
if CleanUpUnitVelocityTotal < 1 then
|
||||
env.info( "CleanUp: Destroy: " .. GroupName )
|
||||
trigger.action.deactivateGroup(CleanUpGroup)
|
||||
ListData = nil
|
||||
end
|
||||
else
|
||||
ListData = nil
|
||||
end
|
||||
else
|
||||
env.info( "CleanUp: Not Existing anymore, cleaning: " .. GroupName )
|
||||
Event = {
|
||||
id = 8,
|
||||
time = Time,
|
||||
initiator = CleanUpUnit,
|
||||
}
|
||||
world.onEvent(Event)
|
||||
trigger.action.deactivateGroup(CleanUpGroup)
|
||||
ListData = nil
|
||||
end
|
||||
else
|
||||
|
||||
@ -182,7 +182,7 @@ end
|
||||
|
||||
--- When a Group got SPAWNed, it has a life within the DCSRTE. For planes and helicopters, when these Units go home and land on their home airbases and farps, they normally would taxi to the parking spot, shut-down their engines and wait forever until the Group is removed by the DCSRTE.
|
||||
-- This function is used to Re-Spawn automatically (so no extra call is needed anymore) the same Group after it landed. This will enable a SPAWNed group to be Re-SPAWNed after it lands, until it is destroyed...
|
||||
-- Note: When the Group is respawned, it will @{ReSpawn} at the original airbase where it took off. So ensure that the paths for Groups that ReSpawn, always return to the orignal airbase.
|
||||
-- Note: When the Group is respawned, it will @{ReSpawn} at the original airbase where it took off. So ensure that the paths for Groups that ReSpawn, always return to the original airbase.
|
||||
-- @treturn SPAWN
|
||||
-- @usage
|
||||
-- -- RU Su-34 - AI Ship Attack
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user