diff --git a/Base.lua b/Base.lua index b18bcd0d8..bce903600 100644 --- a/Base.lua +++ b/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 diff --git a/CleanUp.lua b/CleanUp.lua index d0bc7ccb7..460630dd8 100644 --- a/CleanUp.lua +++ b/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 diff --git a/Spawn.lua b/Spawn.lua index 27a9595cc..61acdd908 100644 --- a/Spawn.lua +++ b/Spawn.lua @@ -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 diff --git a/Trace.lua b/Trace.lua index 83685f6dc..bf7419170 100644 --- a/Trace.lua +++ b/Trace.lua @@ -60,6 +60,7 @@ trace.names._GetTemplate = false trace.names.FollowPlayers = false trace.names.AddPlayerFromUnit = false trace.names.FromCarrier = false +trace.names.OnDeadOrCrash = true trace.cache = {} trace.tracefunction = function( functionname )