mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Updates
This commit is contained in:
@@ -351,9 +351,6 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
|||||||
|
|
||||||
self.Detection:__Start( 30 )
|
self.Detection:__Start( 30 )
|
||||||
|
|
||||||
self:HandleEvent( EVENTS.Dead, OnEventDeadOrCrash )
|
|
||||||
self:HandleEvent( EVENTS.Crash, OnEventDeadOrCrash )
|
|
||||||
|
|
||||||
self.MainMenu = MENU_GROUP:New( self.PlayerGroup, self.EscortName )
|
self.MainMenu = MENU_GROUP:New( self.PlayerGroup, self.EscortName )
|
||||||
self.FlightMenu = MENU_GROUP:New( self.PlayerGroup, "Flight", self.MainMenu )
|
self.FlightMenu = MENU_GROUP:New( self.PlayerGroup, "Flight", self.MainMenu )
|
||||||
|
|
||||||
@@ -373,6 +370,27 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param #AI_ESCORT self
|
||||||
|
-- @param Core.Set#SET_GROUP EscortGroupSet
|
||||||
|
function AI_ESCORT:onafterStop( EscortGroupSet )
|
||||||
|
|
||||||
|
self:F()
|
||||||
|
|
||||||
|
EscortGroupSet:ForEachGroup(
|
||||||
|
--- @param Core.Group#GROUP EscortGroup
|
||||||
|
function( EscortGroup )
|
||||||
|
EscortGroup:WayPointInitialize()
|
||||||
|
|
||||||
|
EscortGroup:OptionROTVertical()
|
||||||
|
EscortGroup:OptionROEOpenFire()
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
self.Detection:Stop()
|
||||||
|
|
||||||
|
self.MainMenu:Remove()
|
||||||
|
|
||||||
|
end
|
||||||
--- Set a Detection method for the EscortUnit to be reported upon.
|
--- Set a Detection method for the EscortUnit to be reported upon.
|
||||||
-- Detection methods are based on the derived classes from DETECTION_BASE.
|
-- Detection methods are based on the derived classes from DETECTION_BASE.
|
||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
@@ -707,6 +725,7 @@ function AI_ESCORT:SetEscortMenuJoinUp( EscortGroup )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Defines --- Defines a menu slot to let the escort to join formation.
|
--- Defines --- Defines a menu slot to let the escort to join formation.
|
||||||
-- @param #AI_ESCORT self
|
-- @param #AI_ESCORT self
|
||||||
-- @return #AI_ESCORT
|
-- @return #AI_ESCORT
|
||||||
|
|||||||
@@ -1,21 +1,8 @@
|
|||||||
--- **AI** -- (R2.4) - Models the assignment of AI escorts to player flights.
|
--- **AI** -- (R2.5) - Models the automatic assignment of AI escorts to player flights.
|
||||||
--
|
--
|
||||||
-- ## Features:
|
-- ## Features:
|
||||||
-- --
|
-- --
|
||||||
-- * Provides the facilities to trigger escorts when players join flight units.
|
-- * Provides the facilities to trigger escorts when players join flight slots.
|
||||||
-- * Provide different means how escorts can be triggered:
|
|
||||||
-- * Directly when a player joins a plane.
|
|
||||||
-- * Through the menu.
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- ## Test Missions:
|
|
||||||
--
|
|
||||||
-- Test missions can be located on the main GITHUB site.
|
|
||||||
--
|
|
||||||
-- [FlightControl-Master/MOOSE_MISSIONS]
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -28,14 +15,10 @@
|
|||||||
|
|
||||||
|
|
||||||
--- @type AI_ESCORT_DISPATCHER
|
--- @type AI_ESCORT_DISPATCHER
|
||||||
-- @field Core.Set#SET_GROUP CarrierSet The set of @{Wrapper.Group#GROUP} objects of carriers that will transport the cargo.
|
|
||||||
-- @field Core.Set#SET_GROUP EscortGroupSet The set of group AI escorting the EscortUnit.
|
|
||||||
-- @field #string EscortName Name of the escort.
|
|
||||||
-- @field #string EscortBriefing A text showing the AI_ESCORT briefing to the player. Note that if no EscortBriefing is provided, the default briefing will be shown.
|
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
|
|
||||||
--- A dynamic cargo handling capability for AI groups.
|
--- Models the automatic assignment of AI escorts to player flights.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -50,12 +33,34 @@ AI_ESCORT_DISPATCHER.AI_Escorts = {}
|
|||||||
|
|
||||||
--- Creates a new AI_ESCORT_DISPATCHER object.
|
--- Creates a new AI_ESCORT_DISPATCHER object.
|
||||||
-- @param #AI_ESCORT_DISPATCHER self
|
-- @param #AI_ESCORT_DISPATCHER self
|
||||||
-- @param Core.Set#SET_GROUP CarrierSet The set of @{Wrapper.Group#GROUP} objects of carriers that will transport the cargo.
|
-- @param Core.Set#SET_GROUP CarrierSet The set of @{Wrapper.Group#GROUP} objects of carriers for which escorts are spawned in.
|
||||||
-- @param Core.Spawn#SPAWN EscortSpawn The spawn object that will spawn in the Escorts.
|
-- @param Core.Spawn#SPAWN EscortSpawn The spawn object that will spawn in the Escorts.
|
||||||
-- @param Wrapper.Airbase#AIRBASE EscortAirbase The airbase where the escorts are spawned.
|
-- @param Wrapper.Airbase#AIRBASE EscortAirbase The airbase where the escorts are spawned.
|
||||||
-- @param #string EscortName Name of the escort.
|
-- @param #string EscortName Name of the escort, which will also be the name of the escort menu.
|
||||||
-- @param #string EscortBriefing A text showing the AI_ESCORT briefing to the player. Note that if no EscortBriefing is provided, the default briefing will be shown.
|
-- @param #string EscortBriefing A text showing the briefing to the player. Note that if no EscortBriefing is provided, the default briefing will be shown.
|
||||||
-- @return #AI_ESCORT_DISPATCHER
|
-- @return #AI_ESCORT_DISPATCHER
|
||||||
|
-- @usage
|
||||||
|
--
|
||||||
|
-- -- Create a new escort when a player joins an SU-25T plane.
|
||||||
|
-- Create a carrier set, which contains the player slots that can be joined by the players, for which escorts will be defined.
|
||||||
|
-- local Red_SU25T_CarrierSet = SET_GROUP:New():FilterPrefixes( "Red A2G Player Su-25T" ):FilterStart()
|
||||||
|
--
|
||||||
|
-- -- Create a spawn object that will spawn in the escorts, once the player has joined the player slot.
|
||||||
|
-- local Red_SU25T_EscortSpawn = SPAWN:NewWithAlias( "Red A2G Su-25 Escort", "Red AI A2G SU-25 Escort" ):InitLimit( 10, 10 )
|
||||||
|
--
|
||||||
|
-- -- Create an airbase object, where the escorts will be spawned.
|
||||||
|
-- local Red_SU25T_Airbase = AIRBASE:FindByName( AIRBASE.Caucasus.Maykop_Khanskaya )
|
||||||
|
--
|
||||||
|
-- -- Park the airplanes at the airbase, visible before start.
|
||||||
|
-- Red_SU25T_EscortSpawn:ParkAtAirbase( Red_SU25T_Airbase, AIRBASE.TerminalType.OpenMedOrBig )
|
||||||
|
--
|
||||||
|
-- -- New create the escort dispatcher, using the carrier set, the escort spawn object at the escort airbase.
|
||||||
|
-- -- Provide a name of the escort, which will be also the name appearing on the radio menu for the group.
|
||||||
|
-- -- And a briefing to appear when the player joins the player slot.
|
||||||
|
-- Red_SU25T_EscortDispatcher = AI_ESCORT_DISPATCHER:New( Red_SU25T_CarrierSet, Red_SU25T_EscortSpawn, Red_SU25T_Airbase, "Escort Su-25", "You Su-25T is escorted by one Su-25. Use the radio menu to control the escorts." )
|
||||||
|
--
|
||||||
|
-- -- The dispatcher needs to be started using the :Start() method.
|
||||||
|
-- Red_SU25T_EscortDispatcher:Start()
|
||||||
function AI_ESCORT_DISPATCHER:New( CarrierSet, EscortSpawn, EscortAirbase, EscortName, EscortBriefing )
|
function AI_ESCORT_DISPATCHER:New( CarrierSet, EscortSpawn, EscortAirbase, EscortName, EscortBriefing )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, FSM:New() ) -- #AI_ESCORT_DISPATCHER
|
local self = BASE:Inherit( self, FSM:New() ) -- #AI_ESCORT_DISPATCHER
|
||||||
@@ -85,10 +90,34 @@ function AI_ESCORT_DISPATCHER:onafterStart( From, Event, To )
|
|||||||
|
|
||||||
self:HandleEvent( EVENTS.Birth )
|
self:HandleEvent( EVENTS.Birth )
|
||||||
|
|
||||||
self:HandleEvent( EVENTS.PlayerLeaveUnit )
|
self:HandleEvent( EVENTS.PlayerLeaveUnit, self.OnEventExit )
|
||||||
|
self:HandleEvent( EVENTS.Crash, self.OnEventExit )
|
||||||
|
self:HandleEvent( EVENTS.Dead, self.OnEventExit )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param #AI_ESCORT_DISPATCHER self
|
||||||
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
|
function AI_ESCORT_DISPATCHER:OnEventExit( EventData )
|
||||||
|
|
||||||
|
local PlayerGroupName = EventData.IniGroupName
|
||||||
|
local PlayerGroup = EventData.IniGroup
|
||||||
|
local PlayerUnit = EventData.IniUnit
|
||||||
|
|
||||||
|
self:I({EscortAirbase= self.EscortAirbase } )
|
||||||
|
self:I({PlayerGroupName = PlayerGroupName } )
|
||||||
|
self:I({PlayerGroup = PlayerGroup})
|
||||||
|
self:I({FirstGroup = self.CarrierSet:GetFirst()})
|
||||||
|
self:I({FindGroup = self.CarrierSet:FindGroup( PlayerGroupName )})
|
||||||
|
|
||||||
|
if self.CarrierSet:FindGroup( PlayerGroupName ) then
|
||||||
|
if self.AI_Escorts[PlayerGroupName] then
|
||||||
|
self.AI_Escorts[PlayerGroupName]:Stop()
|
||||||
|
self.AI_Escorts[PlayerGroupName] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- @param #AI_ESCORT_DISPATCHER self
|
--- @param #AI_ESCORT_DISPATCHER self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
|
|||||||
@@ -1,21 +1,9 @@
|
|||||||
--- **AI** -- (R2.4) - Models the assignment of AI escorts to player flights upon request using the radio menu.
|
--- **AI** -- (R2.5) - Models the assignment of AI escorts to player flights upon request using the radio menu.
|
||||||
--
|
--
|
||||||
-- ## Features:
|
-- ## Features:
|
||||||
-- --
|
--
|
||||||
-- * Provides the facilities to trigger escorts when players join flight units.
|
-- * Provides the facilities to trigger escorts when players join flight units.
|
||||||
-- * Provide different means how escorts can be triggered:
|
-- * Provide a menu for which escorts can be requested.
|
||||||
-- * Directly when a player joins a plane.
|
|
||||||
-- * Through the menu.
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
|
||||||
-- ## Test Missions:
|
|
||||||
--
|
|
||||||
-- Test missions can be located on the main GITHUB site.
|
|
||||||
--
|
|
||||||
-- [FlightControl-Master/MOOSE_MISSIONS]
|
|
||||||
--
|
|
||||||
-- ===
|
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -28,14 +16,10 @@
|
|||||||
|
|
||||||
|
|
||||||
--- @type AI_ESCORT_DISPATCHER_REQUEST
|
--- @type AI_ESCORT_DISPATCHER_REQUEST
|
||||||
-- @field Core.Set#SET_GROUP CarrierSet The set of @{Wrapper.Group#GROUP} objects of carriers that will transport the cargo.
|
|
||||||
-- @field Core.Set#SET_GROUP EscortGroupSet The set of group AI escorting the EscortUnit.
|
|
||||||
-- @field #string EscortName Name of the escort.
|
|
||||||
-- @field #string EscortBriefing A text showing the AI_ESCORT briefing to the player. Note that if no EscortBriefing is provided, the default briefing will be shown.
|
|
||||||
-- @extends Core.Fsm#FSM
|
-- @extends Core.Fsm#FSM
|
||||||
|
|
||||||
|
|
||||||
--- A dynamic cargo handling capability for AI groups.
|
--- Models the assignment of AI escorts to player flights upon request using the radio menu.
|
||||||
--
|
--
|
||||||
-- ===
|
-- ===
|
||||||
--
|
--
|
||||||
@@ -50,11 +34,11 @@ AI_ESCORT_DISPATCHER_REQUEST.AI_Escorts = {}
|
|||||||
|
|
||||||
--- Creates a new AI_ESCORT_DISPATCHER_REQUEST object.
|
--- Creates a new AI_ESCORT_DISPATCHER_REQUEST object.
|
||||||
-- @param #AI_ESCORT_DISPATCHER_REQUEST self
|
-- @param #AI_ESCORT_DISPATCHER_REQUEST self
|
||||||
-- @param Core.Set#SET_GROUP CarrierSet The set of @{Wrapper.Group#GROUP} objects of carriers that will transport the cargo.
|
-- @param Core.Set#SET_GROUP CarrierSet The set of @{Wrapper.Group#GROUP} objects of carriers for which escorts are requested.
|
||||||
-- @param Core.Spawn#SPAWN EscortSpawn The spawn object that will spawn in the Escorts.
|
-- @param Core.Spawn#SPAWN EscortSpawn The spawn object that will spawn in the Escorts.
|
||||||
-- @param Wrapper.Airbase#AIRBASE EscortAirbase The airbase where the escorts are spawned.
|
-- @param Wrapper.Airbase#AIRBASE EscortAirbase The airbase where the escorts are spawned.
|
||||||
-- @param #string EscortName Name of the escort.
|
-- @param #string EscortName Name of the escort, which will also be the name of the escort menu.
|
||||||
-- @param #string EscortBriefing A text showing the AI_ESCORT briefing to the player. Note that if no EscortBriefing is provided, the default briefing will be shown.
|
-- @param #string EscortBriefing A text showing the briefing to the player. Note that if no EscortBriefing is provided, the default briefing will be shown.
|
||||||
-- @return #AI_ESCORT_DISPATCHER_REQUEST
|
-- @return #AI_ESCORT_DISPATCHER_REQUEST
|
||||||
function AI_ESCORT_DISPATCHER_REQUEST:New( CarrierSet, EscortSpawn, EscortAirbase, EscortName, EscortBriefing )
|
function AI_ESCORT_DISPATCHER_REQUEST:New( CarrierSet, EscortSpawn, EscortAirbase, EscortName, EscortBriefing )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user