mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-10 08:29:52 +00:00
Merge branch 'FF/Develop' into FF/Fox2
This commit is contained in:
@@ -349,11 +349,17 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
|||||||
|
|
||||||
self.Detection = DETECTION_AREAS:New( EscortGroupSet, 5000 )
|
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.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 )
|
||||||
|
|
||||||
@@ -367,12 +373,45 @@ function AI_ESCORT:onafterStart( EscortGroupSet )
|
|||||||
self:_InitEscortRoute( EscortGroup )
|
self:_InitEscortRoute( EscortGroup )
|
||||||
|
|
||||||
self:SetFlightModeFormation( 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
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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 +746,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 )
|
||||||
|
|
||||||
@@ -85,10 +69,35 @@ function AI_ESCORT_DISPATCHER_REQUEST: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_REQUEST self
|
||||||
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
|
function AI_ESCORT_DISPATCHER_REQUEST:OnEventExit( EventData )
|
||||||
|
|
||||||
|
local PlayerGroupName = EventData.IniGroupName
|
||||||
|
local PlayerGroup = EventData.IniGroup
|
||||||
|
local PlayerUnit = EventData.IniUnit
|
||||||
|
|
||||||
|
self.CarrierSet:Flush(self)
|
||||||
|
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_REQUEST self
|
--- @param #AI_ESCORT_DISPATCHER_REQUEST self
|
||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
|
|||||||
@@ -206,12 +206,13 @@ AI_ESCORT_REQUEST = {
|
|||||||
-- Escort:__Start( 5 )
|
-- Escort:__Start( 5 )
|
||||||
function AI_ESCORT_REQUEST:New( EscortUnit, EscortSpawn, EscortAirbase, EscortName, EscortBriefing )
|
function AI_ESCORT_REQUEST:New( EscortUnit, EscortSpawn, EscortAirbase, EscortName, EscortBriefing )
|
||||||
|
|
||||||
self.EscortGroupSet = SET_GROUP:New():FilterDeads():FilterCrashes()
|
local EscortGroupSet = SET_GROUP:New():FilterDeads():FilterCrashes()
|
||||||
|
local self = BASE:Inherit( self, AI_ESCORT:New( EscortUnit, EscortGroupSet, EscortName, EscortBriefing ) ) -- #AI_ESCORT_REQUEST
|
||||||
|
|
||||||
|
self.EscortGroupSet = EscortGroupSet
|
||||||
self.EscortSpawn = EscortSpawn
|
self.EscortSpawn = EscortSpawn
|
||||||
self.EscortAirbase = EscortAirbase
|
self.EscortAirbase = EscortAirbase
|
||||||
|
|
||||||
local self = BASE:Inherit( self, AI_ESCORT:New( EscortUnit, self.EscortGroupSet, EscortName, EscortBriefing ) ) -- #AI_ESCORT_REQUEST
|
|
||||||
|
|
||||||
self.LeaderGroup = self.PlayerUnit:GetGroup()
|
self.LeaderGroup = self.PlayerUnit:GetGroup()
|
||||||
|
|
||||||
self.Detection = DETECTION_AREAS:New( self.EscortGroupSet, 5000 )
|
self.Detection = DETECTION_AREAS:New( self.EscortGroupSet, 5000 )
|
||||||
@@ -284,6 +285,28 @@ function AI_ESCORT_REQUEST:onafterStart( EscortGroupSet )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param #AI_ESCORT_REQUEST self
|
||||||
|
-- @param Core.Set#SET_GROUP EscortGroupSet
|
||||||
|
function AI_ESCORT_REQUEST: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 the spawn mode to be mission execution.
|
--- Set the spawn mode to be mission execution.
|
||||||
-- @param #AI_ESCORT_REQUEST self
|
-- @param #AI_ESCORT_REQUEST self
|
||||||
function AI_ESCORT_REQUEST:SetEscortSpawnMission()
|
function AI_ESCORT_REQUEST:SetEscortSpawnMission()
|
||||||
|
|||||||
@@ -4171,7 +4171,7 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request)
|
|||||||
|
|
||||||
-- Create an alias name with the UIDs for the sending warehouse, asset and request.
|
-- Create an alias name with the UIDs for the sending warehouse, asset and request.
|
||||||
local _alias=self:_alias(_assetitem.unittype, self.uid, _assetitem.uid, Request.uid)
|
local _alias=self:_alias(_assetitem.unittype, self.uid, _assetitem.uid, Request.uid)
|
||||||
|
|
||||||
-- Asset is transport.
|
-- Asset is transport.
|
||||||
_assetitem.spawned=false
|
_assetitem.spawned=false
|
||||||
_assetitem.spawngroupname=nil
|
_assetitem.spawngroupname=nil
|
||||||
@@ -4217,18 +4217,18 @@ function WAREHOUSE:onafterRequest(From, Event, To, Request)
|
|||||||
self:_ErrorMessage("ERROR: Unknown transport type!")
|
self:_ErrorMessage("ERROR: Unknown transport type!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add asset by id to all assets table.
|
-- Add asset by id to all assets table.
|
||||||
Request.assets[_assetitem.uid]=_assetitem
|
Request.assets[_assetitem.uid]=_assetitem
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add request to pending queue.
|
-- Add request to pending queue.
|
||||||
table.insert(self.pending, Request)
|
table.insert(self.pending, Request)
|
||||||
|
|
||||||
-- Delete request from queue.
|
-- Delete request from queue.
|
||||||
self:_DeleteQueueItem(Request, self.queue)
|
self:_DeleteQueueItem(Request, self.queue)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "RequestSpawned" event. Initiates the transport of the assets to the requesting warehouse.
|
--- On after "RequestSpawned" event. Initiates the transport of the assets to the requesting warehouse.
|
||||||
@@ -4244,7 +4244,7 @@ function WAREHOUSE:onafterRequestSpawned(From, Event, To, Request, CargoGroupSet
|
|||||||
-- General type and category.
|
-- General type and category.
|
||||||
local _cargotype=Request.cargoattribute --#WAREHOUSE.Attribute
|
local _cargotype=Request.cargoattribute --#WAREHOUSE.Attribute
|
||||||
local _cargocategory=Request.cargocategory --DCS#Group.Category
|
local _cargocategory=Request.cargocategory --DCS#Group.Category
|
||||||
|
|
||||||
-- Add groups to pending item.
|
-- Add groups to pending item.
|
||||||
--Request.cargogroupset=CargoGroupSet
|
--Request.cargogroupset=CargoGroupSet
|
||||||
|
|
||||||
@@ -4312,10 +4312,10 @@ function WAREHOUSE:onafterRequestSpawned(From, Event, To, Request, CargoGroupSet
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Transport group set.
|
-- Transport group set.
|
||||||
Request.transportgroupset=TransportGroupSet
|
Request.transportgroupset=TransportGroupSet
|
||||||
|
|
||||||
-- No cargo transport necessary.
|
-- No cargo transport necessary.
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -4418,8 +4418,8 @@ function WAREHOUSE:onafterRequestSpawned(From, Event, To, Request, CargoGroupSet
|
|||||||
end
|
end
|
||||||
CargoTransport:SetPickupRadius(pickupouter, pickupinner)
|
CargoTransport:SetPickupRadius(pickupouter, pickupinner)
|
||||||
CargoTransport:SetDeployRadius(deployouter, deployinner)
|
CargoTransport:SetDeployRadius(deployouter, deployinner)
|
||||||
|
|
||||||
|
|
||||||
-- Adjust carrier units. This has to come AFTER the dispatchers have been defined because they set the cargobay free weight!
|
-- Adjust carrier units. This has to come AFTER the dispatchers have been defined because they set the cargobay free weight!
|
||||||
Request.carriercargo={}
|
Request.carriercargo={}
|
||||||
for _,carriergroup in pairs(TransportGroupSet:GetSetObjects()) do
|
for _,carriergroup in pairs(TransportGroupSet:GetSetObjects()) do
|
||||||
@@ -4438,7 +4438,7 @@ function WAREHOUSE:onafterRequestSpawned(From, Event, To, Request, CargoGroupSet
|
|||||||
self:T2(self.wid..string.format("Cargo bay weight limit of carrier unit %s: %.1f kg.", carrierunit:GetName(), carrierunit:GetCargoBayFreeWeight()))
|
self:T2(self.wid..string.format("Cargo bay weight limit of carrier unit %s: %.1f kg.", carrierunit:GetName(), carrierunit:GetCargoBayFreeWeight()))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- Dispatcher Event Functions --
|
-- Dispatcher Event Functions --
|
||||||
--------------------------------
|
--------------------------------
|
||||||
@@ -4542,7 +4542,7 @@ function WAREHOUSE:onafterRequestSpawned(From, Event, To, Request, CargoGroupSet
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Start dispatcher.
|
-- Start dispatcher.
|
||||||
CargoTransport:__Start(5)
|
CargoTransport:__Start(5)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -4958,26 +4958,26 @@ function WAREHOUSE:onafterAssetSpawned(From, Event, To, group, asset, request)
|
|||||||
local text=string.format("Asset %s from request id=%d was spawned!", asset.templatename, request.uid)
|
local text=string.format("Asset %s from request id=%d was spawned!", asset.templatename, request.uid)
|
||||||
self:T(self.wid..text)
|
self:T(self.wid..text)
|
||||||
self:_DebugMessage(text)
|
self:_DebugMessage(text)
|
||||||
|
|
||||||
-- Check if all assets groups are spawned and trigger events.
|
-- Check if all assets groups are spawned and trigger events.
|
||||||
|
|
||||||
asset.spawned=true
|
asset.spawned=true
|
||||||
|
|
||||||
local allspawned=true
|
local allspawned=true
|
||||||
for _,_asset in pairs(request.assets) do
|
for _,_asset in pairs(request.assets) do
|
||||||
local assetitem=_asset --#WAREHOUSE.Assetitem
|
local assetitem=_asset --#WAREHOUSE.Assetitem
|
||||||
|
|
||||||
self:I(string.format("FF Asset %s spawned %s as %s", assetitem.templatename, tostring(assetitem.spawned), tostring(assetitem.spawngroupname)))
|
self:I(string.format("FF Asset %s spawned %s as %s", assetitem.templatename, tostring(assetitem.spawned), tostring(assetitem.spawngroupname)))
|
||||||
|
|
||||||
if not assetitem.spawned then
|
if not assetitem.spawned then
|
||||||
allspawned=false
|
allspawned=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if allspawned then
|
if allspawned then
|
||||||
self:RequestSpawned(request, request.cargogroupset, request.transportgroupset)
|
self:RequestSpawned(request, request.cargogroupset, request.transportgroupset)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "AssetDead" event triggered when an asset group died.
|
--- On after "AssetDead" event triggered when an asset group died.
|
||||||
@@ -5276,7 +5276,7 @@ function WAREHOUSE:_SpawnAssetRequest(Request)
|
|||||||
|
|
||||||
-- Get stock item.
|
-- Get stock item.
|
||||||
local asset=cargoassets[i] --#WAREHOUSE.Assetitem
|
local asset=cargoassets[i] --#WAREHOUSE.Assetitem
|
||||||
|
|
||||||
-- Set asset status to not spawned until we capture its birth event.
|
-- Set asset status to not spawned until we capture its birth event.
|
||||||
asset.spawned=false
|
asset.spawned=false
|
||||||
asset.spawngroupname=nil
|
asset.spawngroupname=nil
|
||||||
@@ -5321,13 +5321,13 @@ function WAREHOUSE:_SpawnAssetRequest(Request)
|
|||||||
else
|
else
|
||||||
self:E(self.wid.."ERROR: Unknown asset category!")
|
self:E(self.wid.."ERROR: Unknown asset category!")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--Request add asset by id.
|
--Request add asset by id.
|
||||||
Request.assets[asset.uid]=asset
|
Request.assets[asset.uid]=asset
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -5784,11 +5784,9 @@ end
|
|||||||
-- @param Wrapper.Group#GROUP group The group that arrived.
|
-- @param Wrapper.Group#GROUP group The group that arrived.
|
||||||
function WAREHOUSE:_Arrived(group)
|
function WAREHOUSE:_Arrived(group)
|
||||||
self:_DebugMessage(string.format("Group %s arrived!", tostring(group:GetName())))
|
self:_DebugMessage(string.format("Group %s arrived!", tostring(group:GetName())))
|
||||||
--self:E(string.format("Group %s arrived!", tostring(group:GetName())))
|
|
||||||
|
|
||||||
if group then
|
if group then
|
||||||
--Trigger "Arrived event.
|
--Trigger "Arrived event.
|
||||||
--group:SmokeBlue()
|
|
||||||
self:__Arrived(1, group)
|
self:__Arrived(1, group)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -5800,14 +5798,10 @@ end
|
|||||||
-- @param #number n Waypoint passed.
|
-- @param #number n Waypoint passed.
|
||||||
-- @param #number N Final waypoint.
|
-- @param #number N Final waypoint.
|
||||||
function WAREHOUSE:_PassingWaypoint(group,n,N)
|
function WAREHOUSE:_PassingWaypoint(group,n,N)
|
||||||
self:T(string.format("Group %s passing waypoint %d of %d!", tostring(group:GetName()), n, N))
|
self:T(self.wid..string.format("Group %s passing waypoint %d of %d!", tostring(group:GetName()), n, N))
|
||||||
|
|
||||||
if group then
|
|
||||||
--group:SmokeGreen()
|
|
||||||
end
|
|
||||||
|
|
||||||
|
-- Final waypoint reached.
|
||||||
if n==N then
|
if n==N then
|
||||||
--group:SmokeBlue()
|
|
||||||
self:__Arrived(1, group)
|
self:__Arrived(1, group)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -5826,7 +5820,7 @@ function WAREHOUSE:GetAssetByID(id)
|
|||||||
return _WAREHOUSEDB.Assets[id]
|
return _WAREHOUSEDB.Assets[id]
|
||||||
else
|
else
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get a warehouse request from its unique id.
|
--- Get a warehouse request from its unique id.
|
||||||
@@ -5836,7 +5830,7 @@ end
|
|||||||
function WAREHOUSE:GetRequestByID(id)
|
function WAREHOUSE:GetRequestByID(id)
|
||||||
|
|
||||||
if id then
|
if id then
|
||||||
|
|
||||||
for _,_request in pairs(self.queue) do
|
for _,_request in pairs(self.queue) do
|
||||||
local request=_request --#WAREHOUSE.Queueitem
|
local request=_request --#WAREHOUSE.Queueitem
|
||||||
if request.uid==id then
|
if request.uid==id then
|
||||||
@@ -5850,9 +5844,9 @@ function WAREHOUSE:GetRequestByID(id)
|
|||||||
return request, false
|
return request, false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil,nil
|
return nil,nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -5864,27 +5858,27 @@ function WAREHOUSE:_OnEventBirth(EventData)
|
|||||||
|
|
||||||
if EventData and EventData.IniGroup then
|
if EventData and EventData.IniGroup then
|
||||||
local group=EventData.IniGroup
|
local group=EventData.IniGroup
|
||||||
|
|
||||||
-- Note: Remember, group:IsAlive might(?) not return true here.
|
-- Note: Remember, group:IsAlive might(?) not return true here.
|
||||||
local wid,aid,rid=self:_GetIDsFromGroup(group)
|
local wid,aid,rid=self:_GetIDsFromGroup(group)
|
||||||
|
|
||||||
if wid==self.uid then
|
if wid==self.uid then
|
||||||
self:T(self.wid..string.format("Warehouse %s captured event birth of its asset unit %s.", self.alias, EventData.IniUnitName))
|
self:T(self.wid..string.format("Warehouse %s captured event birth of its asset unit %s.", self.alias, EventData.IniUnitName))
|
||||||
|
|
||||||
-- Get asset and request from id.
|
-- Get asset and request from id.
|
||||||
local asset=self:GetAssetByID(aid)
|
local asset=self:GetAssetByID(aid)
|
||||||
local request=self:GetRequestByID(rid)
|
local request=self:GetRequestByID(rid)
|
||||||
|
|
||||||
-- Birth is triggered for each unit. We need to make sure not to call this too often!
|
-- Birth is triggered for each unit. We need to make sure not to call this too often!
|
||||||
if not asset.spawned then
|
if not asset.spawned then
|
||||||
|
|
||||||
-- Remove asset from stock.
|
-- Remove asset from stock.
|
||||||
self:_DeleteStockItem(asset)
|
self:_DeleteStockItem(asset)
|
||||||
|
|
||||||
-- Set spawned switch.
|
-- Set spawned switch.
|
||||||
asset.spawned=true
|
asset.spawned=true
|
||||||
asset.spawngroupname=group:GetName()
|
asset.spawngroupname=group:GetName()
|
||||||
|
|
||||||
-- Add group.
|
-- Add group.
|
||||||
if asset.iscargo==true then
|
if asset.iscargo==true then
|
||||||
request.cargogroupset=request.cargogroupset or SET_GROUP:New()
|
request.cargogroupset=request.cargogroupset or SET_GROUP:New()
|
||||||
@@ -5893,20 +5887,20 @@ function WAREHOUSE:_OnEventBirth(EventData)
|
|||||||
request.transportgroupset=request.transportgroupset or SET_GROUP:New()
|
request.transportgroupset=request.transportgroupset or SET_GROUP:New()
|
||||||
request.transportgroupset:AddGroup(group)
|
request.transportgroupset:AddGroup(group)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set warehouse state.
|
-- Set warehouse state.
|
||||||
group:SetState(group, "WAREHOUSE", self)
|
group:SetState(group, "WAREHOUSE", self)
|
||||||
|
|
||||||
-- Asset spawned FSM function.
|
-- Asset spawned FSM function.
|
||||||
self:__AssetSpawned(1, group, asset, request)
|
self:__AssetSpawned(1, group, asset, request)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
--self:T3({wid=wid, uid=self.uid, match=(wid==self.uid), tw=type(wid), tu=type(self.uid)})
|
--self:T3({wid=wid, uid=self.uid, match=(wid==self.uid), tw=type(wid), tu=type(self.uid)})
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1683,7 +1683,7 @@ AIRBOSS.MenuF10Root=nil
|
|||||||
|
|
||||||
--- Airboss class version.
|
--- Airboss class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AIRBOSS.version="1.0.6"
|
AIRBOSS.version="1.0.7"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -2068,7 +2068,7 @@ function AIRBOSS:New(carriername, alias)
|
|||||||
self:AddTransition("*", "Status", "*") -- Update status of players and queues.
|
self:AddTransition("*", "Status", "*") -- Update status of players and queues.
|
||||||
self:AddTransition("*", "RecoveryCase", "*") -- Switch to another case recovery.
|
self:AddTransition("*", "RecoveryCase", "*") -- Switch to another case recovery.
|
||||||
self:AddTransition("*", "PassingWaypoint", "*") -- Carrier is passing a waypoint.
|
self:AddTransition("*", "PassingWaypoint", "*") -- Carrier is passing a waypoint.
|
||||||
self:AddTransition("*", "LSOgrade", "*") -- LSO grade.
|
self:AddTransition("*", "LSOGrade", "*") -- LSO grade.
|
||||||
self:AddTransition("*", "Save", "*") -- Save player scores to file.
|
self:AddTransition("*", "Save", "*") -- Save player scores to file.
|
||||||
self:AddTransition("*", "Stop", "Stopped") -- Stop AIRBOSS FMS.
|
self:AddTransition("*", "Stop", "Stopped") -- Stop AIRBOSS FMS.
|
||||||
|
|
||||||
@@ -2265,6 +2265,29 @@ function AIRBOSS:New(carriername, alias)
|
|||||||
-- @param #AIRBOSS.LSOgrade grade LSO grade.
|
-- @param #AIRBOSS.LSOgrade grade LSO grade.
|
||||||
|
|
||||||
|
|
||||||
|
--- Triggers the FSM event "LSOGrade". Called when the LSO grades a player
|
||||||
|
-- @function [parent=#AIRBOSS] LSOGrade
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #AIRBOSS.PlayerData playerData Player Data.
|
||||||
|
-- @param #AIRBOSS.LSOgrade grade LSO grade.
|
||||||
|
|
||||||
|
--- Triggers the FSM event "LSOGrade". Delayed called when the LSO grades a player.
|
||||||
|
-- @function [parent=#AIRBOSS] __LSOGrade
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #number delay Delay in seconds.
|
||||||
|
-- @param #AIRBOSS.PlayerData playerData Player Data.
|
||||||
|
-- @param #AIRBOSS.LSOgrade grade LSO grade.
|
||||||
|
|
||||||
|
--- On after "LSOGrade" user function. Called when the carrier passes a waypoint of its route.
|
||||||
|
-- @function [parent=#AIRBOSS] OnAfterLSOGrade
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #string From From state.
|
||||||
|
-- @param #string Event Event.
|
||||||
|
-- @param #string To To state.
|
||||||
|
-- @param #AIRBOSS.PlayerData playerData Player Data.
|
||||||
|
-- @param #AIRBOSS.LSOgrade grade LSO grade.
|
||||||
|
|
||||||
|
|
||||||
--- Triggers the FSM event "Stop" that stops the airboss. Event handlers are stopped.
|
--- Triggers the FSM event "Stop" that stops the airboss. Event handlers are stopped.
|
||||||
-- @function [parent=#AIRBOSS] Stop
|
-- @function [parent=#AIRBOSS] Stop
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
@@ -3687,7 +3710,7 @@ function AIRBOSS:_CheckRecoveryTimes()
|
|||||||
|
|
||||||
-- Closed.
|
-- Closed.
|
||||||
recovery.OPEN=false
|
recovery.OPEN=false
|
||||||
|
|
||||||
-- Window just closed.
|
-- Window just closed.
|
||||||
recovery.OVER=true
|
recovery.OVER=true
|
||||||
|
|
||||||
@@ -9969,14 +9992,8 @@ function AIRBOSS:_CheckFoulDeck(playerData)
|
|||||||
-- Assume no check necessary.
|
-- Assume no check necessary.
|
||||||
local check=false
|
local check=false
|
||||||
|
|
||||||
-- Case I/II: Check is done, when AC is at the wake according to NATOPS. At the wake we switch to final.
|
-- CVN: Check at IM and IC.
|
||||||
if playerData.case<3 and playerData.step==AIRBOSS.PatternStep.FINAL then
|
if playerData.step==AIRBOSS.PatternStep.GROOVE_IM or
|
||||||
check=true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Case III: Check is done at 3/4 NM according to NATOPS.
|
|
||||||
if playerData.step==AIRBOSS.PatternStep.GROOVE_XX or
|
|
||||||
playerData.step==AIRBOSS.PatternStep.GROOVE_IM or
|
|
||||||
playerData.step==AIRBOSS.PatternStep.GROOVE_IC then
|
playerData.step==AIRBOSS.PatternStep.GROOVE_IC then
|
||||||
check=true
|
check=true
|
||||||
end
|
end
|
||||||
@@ -12742,6 +12759,9 @@ function AIRBOSS:_Debrief(playerData)
|
|||||||
-- Add LSO grade to player grades table.
|
-- Add LSO grade to player grades table.
|
||||||
table.insert(self.playerscores[playerData.name], mygrade)
|
table.insert(self.playerscores[playerData.name], mygrade)
|
||||||
|
|
||||||
|
-- Trigger grading event.
|
||||||
|
self:LSOGrade(playerdata, mygrade)
|
||||||
|
|
||||||
-- LSO grade: (OK) 3.0 PT - LURIM
|
-- LSO grade: (OK) 3.0 PT - LURIM
|
||||||
local text=string.format("%s %.1f PT - %s", grade, Points, analysis)
|
local text=string.format("%s %.1f PT - %s", grade, Points, analysis)
|
||||||
if Points==-1 then
|
if Points==-1 then
|
||||||
|
|||||||
@@ -361,6 +361,26 @@ function AIRBASE:FindByName( AirbaseName )
|
|||||||
return AirbaseFound
|
return AirbaseFound
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Find a AIRBASE in the _DATABASE by its ID.
|
||||||
|
-- @param #AIRBASE self
|
||||||
|
-- @param #number id Airbase ID.
|
||||||
|
-- @return #AIRBASE self
|
||||||
|
function AIRBASE:FindByID(id)
|
||||||
|
|
||||||
|
for name,_airbase in pairs(_DATABASE.AIRBASES) do
|
||||||
|
local airbase=_airbase --#AIRBASE
|
||||||
|
|
||||||
|
local aid=tonumber(airbase:GetID())
|
||||||
|
|
||||||
|
if aid==id then
|
||||||
|
return airbase
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
--- Get the DCS object of an airbase
|
--- Get the DCS object of an airbase
|
||||||
-- @param #AIRBASE self
|
-- @param #AIRBASE self
|
||||||
-- @return DCS#Airbase DCS airbase object.
|
-- @return DCS#Airbase DCS airbase object.
|
||||||
@@ -604,7 +624,7 @@ function AIRBASE:GetParkingSpotData(TerminalID)
|
|||||||
|
|
||||||
for _,_spot in pairs(parkingdata) do
|
for _,_spot in pairs(parkingdata) do
|
||||||
local spot=_spot --#AIRBASE.ParkingSpot
|
local spot=_spot --#AIRBASE.ParkingSpot
|
||||||
self:E({TerminalID=spot.TerminalID,TerminalType=spot.TerminalType})
|
self:T({TerminalID=spot.TerminalID,TerminalType=spot.TerminalType})
|
||||||
if TerminalID==spot.TerminalID then
|
if TerminalID==spot.TerminalID then
|
||||||
return spot
|
return spot
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ function STATIC:Destroy( GenerateEvent )
|
|||||||
end
|
end
|
||||||
|
|
||||||
DCSObject:destroy()
|
DCSObject:destroy()
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user