diff --git a/Moose Development/Moose/AI/AI_Escort.lua b/Moose Development/Moose/AI/AI_Escort.lua index dc9e699b4..254af3768 100644 --- a/Moose Development/Moose/AI/AI_Escort.lua +++ b/Moose Development/Moose/AI/AI_Escort.lua @@ -349,6 +349,15 @@ function AI_ESCORT:onafterStart( EscortGroupSet ) self.Detection = DETECTION_AREAS:New( EscortGroupSet, 5000 ) + -- This only makes the escort report detections made by the escort, not through DLINK. + -- These must be enquired using other facilities. + -- In this way, the escort will report the target areas that are relevant for the mission. + self.Detection:InitDetectVisual( true ) + self.Detection:InitDetectIRST( true ) + self.Detection:InitDetectOptical( true ) + self.Detection:InitDetectRadar( true ) + self.Detection:InitDetectRWR( true ) + self.Detection:__Start( 30 ) self.MainMenu = MENU_GROUP:New( self.PlayerGroup, self.EscortName ) @@ -364,6 +373,17 @@ function AI_ESCORT:onafterStart( EscortGroupSet ) self:_InitEscortRoute( EscortGroup ) self:SetFlightModeFormation( EscortGroup ) + + --- @param #AI_ESCORT self + -- @param Core.Event#EVENTDATA EventData + function EscortGroup:OnEventDeadOrCrash( EventData ) + self:F( { "EventDead", EventData } ) + self.EscortMenu:Remove() + end + + EscortGroup:HandleEvent( EVENTS.Dead, EscortGroup.OnEventDeadOrCrash ) + EscortGroup:HandleEvent( EVENTS.Crash, EscortGroup.OnEventDeadOrCrash ) + end )