mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fixed problem with Escort menus and could fine-tune the prototyping.
This commit is contained in:
parent
7abd07f545
commit
ca4d9f1464
@ -2857,7 +2857,7 @@ end
|
|||||||
env.info(( 'Init: Scripts Loaded v1.1' ))
|
env.info(( 'Init: Scripts Loaded v1.1' ))
|
||||||
|
|
||||||
--- BASE The base class for all the classes defined within MOOSE.
|
--- BASE The base class for all the classes defined within MOOSE.
|
||||||
-- @module BASE
|
-- @module Base
|
||||||
-- @author Flightcontrol
|
-- @author Flightcontrol
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
@ -2880,8 +2880,8 @@ _TraceClass = {
|
|||||||
--CARGO_SLINGLOAD = true,
|
--CARGO_SLINGLOAD = true,
|
||||||
--CARGO_ZONE = true,
|
--CARGO_ZONE = true,
|
||||||
--CLEANUP = true,
|
--CLEANUP = true,
|
||||||
--MENU_SUB_GROUP = true,
|
--MENU_CLIENT = true,
|
||||||
--MENU_COMMAND_GROUP = true,
|
--MENU_CLIENT_COMMAND = true,
|
||||||
--ESCORT = true,
|
--ESCORT = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3135,13 +3135,14 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Encapsulation of DCS World Menu system in a set of MENU classes.
|
--- Encapsulation of DCS World Menu system in a set of MENU classes.
|
||||||
-- @module MENU
|
-- @module Menu
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
Include.File( "Base" )
|
Include.File( "Base" )
|
||||||
|
|
||||||
--- The MENU class
|
--- The MENU class
|
||||||
-- @type
|
-- @type MENU
|
||||||
|
-- @extends Base#BASE
|
||||||
MENU = {
|
MENU = {
|
||||||
ClassName = "MENU",
|
ClassName = "MENU",
|
||||||
MenuPath = nil,
|
MenuPath = nil,
|
||||||
@ -3162,7 +3163,8 @@ function MENU:New( MenuText, MenuParentPath )
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- The COMMANDMENU class
|
--- The COMMANDMENU class
|
||||||
-- @type
|
-- @type COMMANDMENU
|
||||||
|
-- @extends Menu#MENU
|
||||||
COMMANDMENU = {
|
COMMANDMENU = {
|
||||||
ClassName = "COMMANDMENU",
|
ClassName = "COMMANDMENU",
|
||||||
CommandMenuFunction = nil,
|
CommandMenuFunction = nil,
|
||||||
@ -3187,7 +3189,8 @@ function COMMANDMENU:New( MenuText, ParentMenu, CommandMenuFunction, CommandMenu
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- The SUBMENU class
|
--- The SUBMENU class
|
||||||
-- @type
|
-- @type SUBMENU
|
||||||
|
-- @extends Menu#MENU
|
||||||
SUBMENU = {
|
SUBMENU = {
|
||||||
ClassName = "SUBMENU"
|
ClassName = "SUBMENU"
|
||||||
}
|
}
|
||||||
@ -3206,78 +3209,128 @@ function SUBMENU:New( MenuText, ParentMenu )
|
|||||||
return Child
|
return Child
|
||||||
end
|
end
|
||||||
|
|
||||||
--- The MENU_SUB_GROUP class
|
-- This local variable is used to cache the menus registered under clients.
|
||||||
-- @type
|
-- Menus don't dissapear when clients are destroyed and restarted.
|
||||||
MENU_SUB_GROUP = {
|
-- So every menu for a client created must be tracked so that program logic accidentally does not create
|
||||||
ClassName = "MENU_SUB_GROUP"
|
-- the same menus twice during initialization logic.
|
||||||
|
-- These menu classes are handling this logic with this variable.
|
||||||
|
local _MENUCLIENTS = {}
|
||||||
|
|
||||||
|
--- The MENU_CLIENT class
|
||||||
|
-- @type MENU_CLIENT
|
||||||
|
-- @extends Menu#MENU
|
||||||
|
MENU_CLIENT = {
|
||||||
|
ClassName = "MENU_CLIENT"
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates a new menu item for a group
|
--- Creates a new menu item for a group
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param CLIENT#CLIENT MenuClient The Client owning the menu.
|
-- @param Client#CLIENT MenuClient The Client owning the menu.
|
||||||
-- @param MenuText The text for the menu.
|
-- @param #string MenuText The text for the menu.
|
||||||
-- @param ParentMenu The parent menu.
|
-- @param #table ParentMenu The parent menu.
|
||||||
-- @return #MENU_SUB_GROUP self
|
-- @return #MENU_CLIENT self
|
||||||
function MENU_SUB_GROUP:New( MenuClient, MenuText, ParentMenu )
|
function MENU_CLIENT:New( MenuClient, MenuText, ParentMenu )
|
||||||
|
|
||||||
-- Arrange meta tables
|
-- Arrange meta tables
|
||||||
local MenuParentPath = nil
|
local MenuParentPath = {}
|
||||||
if ParentMenu ~= nil then
|
if ParentMenu ~= nil then
|
||||||
MenuParentPath = ParentMenu.MenuPath
|
MenuParentPath = ParentMenu.MenuPath
|
||||||
end
|
end
|
||||||
|
|
||||||
local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) )
|
local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) )
|
||||||
|
|
||||||
self:T( { MenuClient, MenuText, ParentMenu } )
|
|
||||||
|
|
||||||
self.MenuClient = MenuClient
|
self.MenuClient = MenuClient
|
||||||
self.MenuPath = missionCommands.addSubMenuForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath )
|
self.MenuClientGroupID = MenuClient:GetClientGroupID()
|
||||||
|
self.MenuParentPath = MenuParentPath
|
||||||
|
self.MenuText = MenuText
|
||||||
|
|
||||||
|
if not _MENUCLIENTS[self.MenuClientGroupID] then
|
||||||
|
_MENUCLIENTS[self.MenuClientGroupID] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
|
||||||
|
|
||||||
|
self:T( { MenuClient:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText } )
|
||||||
|
|
||||||
|
if not MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] then
|
||||||
|
self.MenuPath = missionCommands.addSubMenuForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath )
|
||||||
|
MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] = self.MenuPath
|
||||||
|
else
|
||||||
|
self.MenuPath = MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText]
|
||||||
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- The MENU_COMMAND_GROUP class
|
|
||||||
-- @type
|
--- The MENU_CLIENT_COMMAND class
|
||||||
MENU_COMMAND_GROUP = {
|
-- @type MENU_CLIENT_COMMAND
|
||||||
ClassName = "MENU_COMMAND_GROUP"
|
-- @extends Menu#MENU
|
||||||
|
MENU_CLIENT_COMMAND = {
|
||||||
|
ClassName = "MENU_CLIENT_COMMAND"
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates a new radio command item for a group
|
--- Creates a new radio command item for a group
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param CLIENT#CLIENT MenuClient The Client owning the menu.
|
-- @param Client#CLIENT MenuClient The Client owning the menu.
|
||||||
-- @param MenuText The text for the menu.
|
-- @param MenuText The text for the menu.
|
||||||
-- @param ParentMenu The parent menu.
|
-- @param ParentMenu The parent menu.
|
||||||
-- @param CommandMenuFunction A function that is called when the menu key is pressed.
|
-- @param CommandMenuFunction A function that is called when the menu key is pressed.
|
||||||
-- @param CommandMenuArgument An argument for the function.
|
-- @param CommandMenuArgument An argument for the function.
|
||||||
-- @return #MENU_COMMAND_GROUP self
|
-- @return Menu#MENU_CLIENT_COMMAND self
|
||||||
function MENU_COMMAND_GROUP:New( MenuClient, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument )
|
function MENU_CLIENT_COMMAND:New( MenuClient, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument )
|
||||||
|
|
||||||
-- Arrange meta tables
|
-- Arrange meta tables
|
||||||
|
|
||||||
local MenuParentPath = nil
|
local MenuParentPath = {}
|
||||||
if ParentMenu ~= nil then
|
if ParentMenu ~= nil then
|
||||||
MenuParentPath = ParentMenu.MenuPath
|
MenuParentPath = ParentMenu.MenuPath
|
||||||
end
|
end
|
||||||
|
|
||||||
local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) )
|
local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) )
|
||||||
|
|
||||||
self:T( { MenuClient, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument } )
|
|
||||||
|
|
||||||
self.MenuClient = MenuClient
|
self.MenuClient = MenuClient
|
||||||
self.MenuPath = missionCommands.addCommandForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath, CommandMenuFunction, CommandMenuArgument )
|
self.MenuClientGroupID = MenuClient:GetClientGroupID()
|
||||||
|
self.MenuParentPath = MenuParentPath
|
||||||
|
self.MenuText = MenuText
|
||||||
|
|
||||||
|
if not _MENUCLIENTS[self.MenuClientGroupID] then
|
||||||
|
_MENUCLIENTS[self.MenuClientGroupID] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
|
||||||
|
|
||||||
|
self:T( { MenuClient:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText, CommandMenuFunction, CommandMenuArgument } )
|
||||||
|
|
||||||
|
if not MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] then
|
||||||
|
self.MenuPath = missionCommands.addCommandForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath, CommandMenuFunction, CommandMenuArgument )
|
||||||
|
MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] = self.MenuPath
|
||||||
|
else
|
||||||
|
self.MenuPath = MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText]
|
||||||
|
end
|
||||||
|
|
||||||
self.CommandMenuFunction = CommandMenuFunction
|
self.CommandMenuFunction = CommandMenuFunction
|
||||||
self.CommandMenuArgument = CommandMenuArgument
|
self.CommandMenuArgument = CommandMenuArgument
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function MENU_COMMAND_GROUP:Remove()
|
function MENU_CLIENT_COMMAND:Remove()
|
||||||
|
|
||||||
|
if not _MENUCLIENTS[self.MenuClientGroupID] then
|
||||||
|
_MENUCLIENTS[self.MenuClientGroupID] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
|
||||||
|
|
||||||
|
if MenuPath[table.concat(self.MenuParentPath) .. "/" .. self.MenuText] then
|
||||||
|
MenuPath[table.concat(self.MenuParentPath) .. "/" .. self.MenuText] = nil
|
||||||
|
end
|
||||||
missionCommands.removeItemForGroup( self.MenuClient:GetClientGroupID(), self.MenuPath )
|
missionCommands.removeItemForGroup( self.MenuClient:GetClientGroupID(), self.MenuPath )
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
--- A GROUP class abstraction of a DCSGroup class.
|
--- A GROUP class abstraction of a DCSGroup class.
|
||||||
-- The GROUP class will take an abstraction of the DCSGroup class, providing more methods that can be done with a GROUP.
|
-- The GROUP class will take an abstraction of the DCSGroup class, providing more methods that can be done with a GROUP.
|
||||||
-- @module GROUP
|
-- @module Group
|
||||||
-- @extends BASE#BASE
|
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
Include.File( "Base" )
|
Include.File( "Base" )
|
||||||
@ -3286,6 +3339,7 @@ Include.File( "Unit" )
|
|||||||
|
|
||||||
--- The GROUP class
|
--- The GROUP class
|
||||||
-- @type GROUP
|
-- @type GROUP
|
||||||
|
-- @extends Base#BASE
|
||||||
-- @field #Group DCSGroup The DCS group class.
|
-- @field #Group DCSGroup The DCS group class.
|
||||||
-- @field #string GroupName The name of the group.
|
-- @field #string GroupName The name of the group.
|
||||||
-- @field #number GroupID the ID of the group.
|
-- @field #number GroupID the ID of the group.
|
||||||
@ -3924,7 +3978,8 @@ Include.File( "Base" )
|
|||||||
Include.File( "Message" )
|
Include.File( "Message" )
|
||||||
|
|
||||||
--- The UNIT class
|
--- The UNIT class
|
||||||
-- @type
|
-- @type UNIT
|
||||||
|
-- @Extends Base#BASE
|
||||||
UNIT = {
|
UNIT = {
|
||||||
ClassName="UNIT",
|
ClassName="UNIT",
|
||||||
CategoryName = {
|
CategoryName = {
|
||||||
@ -4042,14 +4097,15 @@ function UNIT:GetCategoryName()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- ZONE Classes
|
--- ZONE Classes
|
||||||
-- @module ZONE
|
-- @module Zone
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
Include.File( "Base" )
|
Include.File( "Base" )
|
||||||
Include.File( "Message" )
|
Include.File( "Message" )
|
||||||
|
|
||||||
--- The ZONE class
|
--- The ZONE class
|
||||||
-- @type
|
-- @type ZONE
|
||||||
|
-- @Extends Base#BASE
|
||||||
ZONE = {
|
ZONE = {
|
||||||
ClassName="ZONE",
|
ClassName="ZONE",
|
||||||
}
|
}
|
||||||
@ -4111,7 +4167,7 @@ end
|
|||||||
|
|
||||||
--- Administers the Initial Sets of the Mission Templates as defined within the Mission Editor.
|
--- Administers the Initial Sets of the Mission Templates as defined within the Mission Editor.
|
||||||
-- Administers the Spawning of new Groups within the DCSRTE and administers these new Groups within the DATABASE object(s).
|
-- Administers the Spawning of new Groups within the DCSRTE and administers these new Groups within the DATABASE object(s).
|
||||||
-- @module DATABASE
|
-- @module Database
|
||||||
-- @author FlightControl
|
-- @author FlightControl
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
@ -6061,7 +6117,8 @@ self:T()
|
|||||||
return Cargo
|
return Cargo
|
||||||
end
|
end
|
||||||
--- CLIENT Classes
|
--- CLIENT Classes
|
||||||
-- @module CLIENT
|
-- @module Client
|
||||||
|
-- @author FlightControl
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
Include.File( "Base" )
|
Include.File( "Base" )
|
||||||
@ -6073,6 +6130,7 @@ Include.File( "Message" )
|
|||||||
|
|
||||||
--- The CLIENT class
|
--- The CLIENT class
|
||||||
-- @type CLIENT
|
-- @type CLIENT
|
||||||
|
-- @extends Base#BASE
|
||||||
CLIENT = {
|
CLIENT = {
|
||||||
ONBOARDSIDE = {
|
ONBOARDSIDE = {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
@ -6233,18 +6291,13 @@ end
|
|||||||
function CLIENT:GetClientGroupUnit()
|
function CLIENT:GetClientGroupUnit()
|
||||||
self:T()
|
self:T()
|
||||||
|
|
||||||
if not self.ClientGroupUnit then
|
local ClientGroup = self:GetDCSGroup()
|
||||||
local ClientGroup = self:GetDCSGroup()
|
|
||||||
|
|
||||||
if ClientGroup and ClientGroup:isExist() then
|
|
||||||
self.ClientGroupUnit = UNIT:New( ClientGroup:getUnit(1) )
|
|
||||||
else
|
|
||||||
self.ClientGroupUnit = UNIT:New( self.ClientGroupUnit )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self:T( { self.ClientGroupUnit } )
|
if ClientGroup and ClientGroup:isExist() then
|
||||||
return self.ClientGroupUnit
|
return UNIT:New( ClientGroup:getUnit(1) )
|
||||||
|
else
|
||||||
|
return UNIT:New( self.ClientGroupUnit )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the DCSUnit of the @{CLIENT}.
|
--- Returns the DCSUnit of the @{CLIENT}.
|
||||||
@ -6252,18 +6305,13 @@ end
|
|||||||
function CLIENT:GetClientGroupDCSUnit()
|
function CLIENT:GetClientGroupDCSUnit()
|
||||||
self:T()
|
self:T()
|
||||||
|
|
||||||
if not self.ClientGroupDCSUnit then
|
local ClientGroup = self:GetDCSGroup()
|
||||||
local ClientGroup = self:GetDCSGroup()
|
|
||||||
|
if ClientGroup and ClientGroup:isExist() then
|
||||||
if ClientGroup and ClientGroup:isExist() then
|
return ClientGroup:getUnit(1)
|
||||||
self.ClientGroupDCSUnit = ClientGroup:getUnit(1)
|
else
|
||||||
else
|
return self.ClientGroupUnit
|
||||||
self.ClientGroupDCSUnit = self.ClientGroupUnit
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self:T( { self.ClientGroupDCSUnit } )
|
|
||||||
return self.ClientGroupDCSUnit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function CLIENT:GetUnit()
|
function CLIENT:GetUnit()
|
||||||
@ -6352,9 +6400,9 @@ self:T()
|
|||||||
|
|
||||||
if not self.MenuMessages then
|
if not self.MenuMessages then
|
||||||
if self:GetClientGroupID() then
|
if self:GetClientGroupID() then
|
||||||
self.MenuMessages = MENU_SUB_GROUP:New( self, 'Messages' )
|
self.MenuMessages = MENU_CLIENT:New( self, 'Messages' )
|
||||||
self.MenuRouteMessageOn = MENU_COMMAND_GROUP:New( self, 'Messages On', self.MenuMessages, CLIENT.SwitchMessages, { self, true } )
|
self.MenuRouteMessageOn = MENU_CLIENT_COMMAND:New( self, 'Messages On', self.MenuMessages, CLIENT.SwitchMessages, { self, true } )
|
||||||
self.MenuRouteMessageOff = MENU_COMMAND_GROUP:New( self,'Messages Off', self.MenuMessages, CLIENT.SwitchMessages, { self, false } )
|
self.MenuRouteMessageOff = MENU_CLIENT_COMMAND:New( self,'Messages Off', self.MenuMessages, CLIENT.SwitchMessages, { self, false } )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -7432,7 +7480,8 @@ Include.File( "Client" )
|
|||||||
Include.File( "Stage" )
|
Include.File( "Stage" )
|
||||||
|
|
||||||
--- The TASK class
|
--- The TASK class
|
||||||
-- @type
|
-- @type TASK
|
||||||
|
-- @extends Base#BASE
|
||||||
TASK = {
|
TASK = {
|
||||||
|
|
||||||
-- Defines the different signal types with a Task.
|
-- Defines the different signal types with a Task.
|
||||||
@ -9632,7 +9681,7 @@ end
|
|||||||
-- This models AI that has succesfully returned to their airbase, to restart their combat activities.
|
-- This models AI that has succesfully returned to their airbase, to restart their combat activities.
|
||||||
-- Check the @{#SPAWN.CleanUp} for further info.
|
-- Check the @{#SPAWN.CleanUp} for further info.
|
||||||
--
|
--
|
||||||
-- @module SPAWN
|
-- @module Spawn
|
||||||
-- @author FlightControl
|
-- @author FlightControl
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
@ -9643,6 +9692,7 @@ Include.File( "Zone" )
|
|||||||
|
|
||||||
--- SPAWN Class
|
--- SPAWN Class
|
||||||
-- @type SPAWN
|
-- @type SPAWN
|
||||||
|
-- @extends Base#BASE
|
||||||
-- @field ClassName
|
-- @field ClassName
|
||||||
SPAWN = {
|
SPAWN = {
|
||||||
ClassName = "SPAWN",
|
ClassName = "SPAWN",
|
||||||
@ -10914,7 +10964,7 @@ self:T( { self.MovePrefixes, self.MoveMaximum, self.AliveUnits, self.MovementGro
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
--- Provides defensive behaviour to a set of SAM sites within a running Mission.
|
--- Provides defensive behaviour to a set of SAM sites within a running Mission.
|
||||||
-- @module SEAD
|
-- @module Sead
|
||||||
-- @author to be searched on the forum
|
-- @author to be searched on the forum
|
||||||
-- @author (co) Flightcontrol (Modified and enriched with functionality)
|
-- @author (co) Flightcontrol (Modified and enriched with functionality)
|
||||||
|
|
||||||
@ -10925,7 +10975,8 @@ Include.File( "Client" )
|
|||||||
Include.File( "Task" )
|
Include.File( "Task" )
|
||||||
|
|
||||||
--- The SEAD class
|
--- The SEAD class
|
||||||
-- @type
|
-- @type SEAD
|
||||||
|
-- @extends Base#BASE
|
||||||
SEAD = {
|
SEAD = {
|
||||||
ClassName = "SEAD",
|
ClassName = "SEAD",
|
||||||
TargetSkill = {
|
TargetSkill = {
|
||||||
@ -11093,32 +11144,32 @@ function ESCORT:New( EscortClient, EscortGroup, EscortName )
|
|||||||
self.ReportTargets = true
|
self.ReportTargets = true
|
||||||
|
|
||||||
-- Escort Navigation
|
-- Escort Navigation
|
||||||
self.EscortMenu = MENU_SUB_GROUP:New( self.EscortClient, "Escort" .. self.EscortName )
|
self.EscortMenu = MENU_CLIENT:New( self.EscortClient, "Escort" .. self.EscortName )
|
||||||
self.EscortMenuHoldPosition = MENU_COMMAND_GROUP:New( self.EscortClient, "Hold Position and Stay Low", self.EscortMenu, ESCORT._HoldPosition, { ParamSelf = self } )
|
self.EscortMenuHoldPosition = MENU_CLIENT_COMMAND:New( self.EscortClient, "Hold Position and Stay Low", self.EscortMenu, ESCORT._HoldPosition, { ParamSelf = self } )
|
||||||
|
|
||||||
-- Report Targets
|
-- Report Targets
|
||||||
self.EscortMenuReportNearbyTargets = MENU_SUB_GROUP:New( self.EscortClient, "Report Targets", self.EscortMenu )
|
self.EscortMenuReportNearbyTargets = MENU_CLIENT:New( self.EscortClient, "Report Targets", self.EscortMenu )
|
||||||
self.EscortMenuReportNearbyTargetsOn = MENU_COMMAND_GROUP:New( self.EscortClient, "Report Targets On", self.EscortMenuReportNearbyTargets, ESCORT._ReportNearbyTargets, { ParamSelf = self, ParamReportTargets = true } )
|
self.EscortMenuReportNearbyTargetsOn = MENU_CLIENT_COMMAND:New( self.EscortClient, "Report Targets On", self.EscortMenuReportNearbyTargets, ESCORT._ReportNearbyTargets, { ParamSelf = self, ParamReportTargets = true } )
|
||||||
self.EscortMenuReportNearbyTargetsOff = MENU_COMMAND_GROUP:New( self.EscortClient, "Report Targets Off", self.EscortMenuReportNearbyTargets, ESCORT._ReportNearbyTargets, { ParamSelf = self, ParamReportTargets = false, } )
|
self.EscortMenuReportNearbyTargetsOff = MENU_CLIENT_COMMAND:New( self.EscortClient, "Report Targets Off", self.EscortMenuReportNearbyTargets, ESCORT._ReportNearbyTargets, { ParamSelf = self, ParamReportTargets = false, } )
|
||||||
|
|
||||||
-- Attack Targets
|
-- Attack Targets
|
||||||
self.EscortMenuAttackNearbyTargets = MENU_SUB_GROUP:New( self.EscortClient, "Attack nearby targets", self.EscortMenu )
|
self.EscortMenuAttackNearbyTargets = MENU_CLIENT:New( self.EscortClient, "Attack nearby targets", self.EscortMenu )
|
||||||
self.EscortMenuAttackTargets = {}
|
self.EscortMenuAttackTargets = {}
|
||||||
self.Targets = {}
|
self.Targets = {}
|
||||||
|
|
||||||
-- Rules of Engagement
|
-- Rules of Engagement
|
||||||
self.EscortMenuROE = MENU_SUB_GROUP:New( self.EscortClient, "ROE", self.EscortMenu )
|
self.EscortMenuROE = MENU_CLIENT:New( self.EscortClient, "ROE", self.EscortMenu )
|
||||||
self.EscortMenuROEHoldFire = MENU_COMMAND_GROUP:New( self.EscortClient, "Hold Fire", self.EscortMenuROE, ESCORT._ROEHoldFire, { ParamSelf = self, } )
|
self.EscortMenuROEHoldFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Hold Fire", self.EscortMenuROE, ESCORT._ROEHoldFire, { ParamSelf = self, } )
|
||||||
self.EscortMenuROEReturnFire = MENU_COMMAND_GROUP:New( self.EscortClient, "Return Fire", self.EscortMenuROE, ESCORT._ROEReturnFire, { ParamSelf = self, } )
|
self.EscortMenuROEReturnFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Return Fire", self.EscortMenuROE, ESCORT._ROEReturnFire, { ParamSelf = self, } )
|
||||||
self.EscortMenuROEOpenFire = MENU_COMMAND_GROUP:New( self.EscortClient, "Open Fire", self.EscortMenuROE, ESCORT._ROEOpenFire, { ParamSelf = self, } )
|
self.EscortMenuROEOpenFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Open Fire", self.EscortMenuROE, ESCORT._ROEOpenFire, { ParamSelf = self, } )
|
||||||
self.EscortMenuROEWeaponFree = MENU_COMMAND_GROUP:New( self.EscortClient, "Weapon Free", self.EscortMenuROE, ESCORT._ROEWeaponFree, { ParamSelf = self, } )
|
self.EscortMenuROEWeaponFree = MENU_CLIENT_COMMAND:New( self.EscortClient, "Weapon Free", self.EscortMenuROE, ESCORT._ROEWeaponFree, { ParamSelf = self, } )
|
||||||
|
|
||||||
-- Reaction to Threats
|
-- Reaction to Threats
|
||||||
self.EscortMenuEvasion = MENU_SUB_GROUP:New( self.EscortClient, "Evasion", self.EscortMenu )
|
self.EscortMenuEvasion = MENU_CLIENT:New( self.EscortClient, "Evasion", self.EscortMenu )
|
||||||
self.EscortMenuEvasionNoReaction = MENU_COMMAND_GROUP:New( self.EscortClient, "Fight until death", self.EscortMenuEvasion, ESCORT._EvasionNoReaction, { ParamSelf = self, } )
|
self.EscortMenuEvasionNoReaction = MENU_CLIENT_COMMAND:New( self.EscortClient, "Fight until death", self.EscortMenuEvasion, ESCORT._EvasionNoReaction, { ParamSelf = self, } )
|
||||||
self.EscortMenuEvasionPassiveDefense = MENU_COMMAND_GROUP:New( self.EscortClient, "Use flares, chaff and jammers", self.EscortMenuEvasion, ESCORT._EvasionPassiveDefense, { ParamSelf = self, } )
|
self.EscortMenuEvasionPassiveDefense = MENU_CLIENT_COMMAND:New( self.EscortClient, "Use flares, chaff and jammers", self.EscortMenuEvasion, ESCORT._EvasionPassiveDefense, { ParamSelf = self, } )
|
||||||
self.EscortMenuEvasionEvadeFire = MENU_COMMAND_GROUP:New( self.EscortClient, "Evade enemy fire", self.EscortMenuEvasion, ESCORT._EvasionEvadeFire, { ParamSelf = self, } )
|
self.EscortMenuEvasionEvadeFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Evade enemy fire", self.EscortMenuEvasion, ESCORT._EvasionEvadeFire, { ParamSelf = self, } )
|
||||||
self.EscortMenuEvasionVertical = MENU_COMMAND_GROUP:New( self.EscortClient, "Go below radar and evade fire", self.EscortMenuEvasion, ESCORT._EvasionVertical, { ParamSelf = self, } )
|
self.EscortMenuEvasionVertical = MENU_CLIENT_COMMAND:New( self.EscortClient, "Go below radar and evade fire", self.EscortMenuEvasion, ESCORT._EvasionVertical, { ParamSelf = self, } )
|
||||||
|
|
||||||
|
|
||||||
self.ScanForTargetsFunction = routines.scheduleFunction( self._ScanForTargets, { self }, timer.getTime() + 1, 30 )
|
self.ScanForTargetsFunction = routines.scheduleFunction( self._ScanForTargets, { self }, timer.getTime() + 1, 30 )
|
||||||
@ -11284,7 +11335,7 @@ function ESCORT:_ScanForTargets()
|
|||||||
self:T( { "Adding menu:", TargetID, "for Unit", self.Targets[TargetID].AttackUnit } )
|
self:T( { "Adding menu:", TargetID, "for Unit", self.Targets[TargetID].AttackUnit } )
|
||||||
if MenuIndex <= 10 then
|
if MenuIndex <= 10 then
|
||||||
self.EscortMenuAttackTargets[MenuIndex] =
|
self.EscortMenuAttackTargets[MenuIndex] =
|
||||||
MENU_COMMAND_GROUP:New( self.EscortClient,
|
MENU_CLIENT_COMMAND:New( self.EscortClient,
|
||||||
self.Targets[TargetID].AttackMessage,
|
self.Targets[TargetID].AttackMessage,
|
||||||
self.EscortMenuAttackNearbyTargets,
|
self.EscortMenuAttackNearbyTargets,
|
||||||
ESCORT._AttackTarget,
|
ESCORT._AttackTarget,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
--- BASE The base class for all the classes defined within MOOSE.
|
--- BASE The base class for all the classes defined within MOOSE.
|
||||||
-- @module BASE
|
-- @module Base
|
||||||
-- @author Flightcontrol
|
-- @author Flightcontrol
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
@ -22,8 +22,8 @@ _TraceClass = {
|
|||||||
--CARGO_SLINGLOAD = true,
|
--CARGO_SLINGLOAD = true,
|
||||||
--CARGO_ZONE = true,
|
--CARGO_ZONE = true,
|
||||||
--CLEANUP = true,
|
--CLEANUP = true,
|
||||||
--MENU_SUB_GROUP = true,
|
--MENU_CLIENT = true,
|
||||||
--MENU_COMMAND_GROUP = true,
|
--MENU_CLIENT_COMMAND = true,
|
||||||
--ESCORT = true,
|
--ESCORT = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
--- CLIENT Classes
|
--- CLIENT Classes
|
||||||
-- @module CLIENT
|
-- @module Client
|
||||||
|
-- @author FlightControl
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
Include.File( "Base" )
|
Include.File( "Base" )
|
||||||
@ -11,6 +12,7 @@ Include.File( "Message" )
|
|||||||
|
|
||||||
--- The CLIENT class
|
--- The CLIENT class
|
||||||
-- @type CLIENT
|
-- @type CLIENT
|
||||||
|
-- @extends Base#BASE
|
||||||
CLIENT = {
|
CLIENT = {
|
||||||
ONBOARDSIDE = {
|
ONBOARDSIDE = {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
@ -171,18 +173,13 @@ end
|
|||||||
function CLIENT:GetClientGroupUnit()
|
function CLIENT:GetClientGroupUnit()
|
||||||
self:T()
|
self:T()
|
||||||
|
|
||||||
if not self.ClientGroupUnit then
|
local ClientGroup = self:GetDCSGroup()
|
||||||
local ClientGroup = self:GetDCSGroup()
|
|
||||||
|
|
||||||
if ClientGroup and ClientGroup:isExist() then
|
|
||||||
self.ClientGroupUnit = UNIT:New( ClientGroup:getUnit(1) )
|
|
||||||
else
|
|
||||||
self.ClientGroupUnit = UNIT:New( self.ClientGroupUnit )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self:T( { self.ClientGroupUnit } )
|
if ClientGroup and ClientGroup:isExist() then
|
||||||
return self.ClientGroupUnit
|
return UNIT:New( ClientGroup:getUnit(1) )
|
||||||
|
else
|
||||||
|
return UNIT:New( self.ClientGroupUnit )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Returns the DCSUnit of the @{CLIENT}.
|
--- Returns the DCSUnit of the @{CLIENT}.
|
||||||
@ -190,18 +187,13 @@ end
|
|||||||
function CLIENT:GetClientGroupDCSUnit()
|
function CLIENT:GetClientGroupDCSUnit()
|
||||||
self:T()
|
self:T()
|
||||||
|
|
||||||
if not self.ClientGroupDCSUnit then
|
local ClientGroup = self:GetDCSGroup()
|
||||||
local ClientGroup = self:GetDCSGroup()
|
|
||||||
|
if ClientGroup and ClientGroup:isExist() then
|
||||||
if ClientGroup and ClientGroup:isExist() then
|
return ClientGroup:getUnit(1)
|
||||||
self.ClientGroupDCSUnit = ClientGroup:getUnit(1)
|
else
|
||||||
else
|
return self.ClientGroupUnit
|
||||||
self.ClientGroupDCSUnit = self.ClientGroupUnit
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self:T( { self.ClientGroupDCSUnit } )
|
|
||||||
return self.ClientGroupDCSUnit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function CLIENT:GetUnit()
|
function CLIENT:GetUnit()
|
||||||
@ -290,9 +282,9 @@ self:T()
|
|||||||
|
|
||||||
if not self.MenuMessages then
|
if not self.MenuMessages then
|
||||||
if self:GetClientGroupID() then
|
if self:GetClientGroupID() then
|
||||||
self.MenuMessages = MENU_SUB_GROUP:New( self, 'Messages' )
|
self.MenuMessages = MENU_CLIENT:New( self, 'Messages' )
|
||||||
self.MenuRouteMessageOn = MENU_COMMAND_GROUP:New( self, 'Messages On', self.MenuMessages, CLIENT.SwitchMessages, { self, true } )
|
self.MenuRouteMessageOn = MENU_CLIENT_COMMAND:New( self, 'Messages On', self.MenuMessages, CLIENT.SwitchMessages, { self, true } )
|
||||||
self.MenuRouteMessageOff = MENU_COMMAND_GROUP:New( self,'Messages Off', self.MenuMessages, CLIENT.SwitchMessages, { self, false } )
|
self.MenuRouteMessageOff = MENU_CLIENT_COMMAND:New( self,'Messages Off', self.MenuMessages, CLIENT.SwitchMessages, { self, false } )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
--- Administers the Initial Sets of the Mission Templates as defined within the Mission Editor.
|
--- Administers the Initial Sets of the Mission Templates as defined within the Mission Editor.
|
||||||
-- Administers the Spawning of new Groups within the DCSRTE and administers these new Groups within the DATABASE object(s).
|
-- Administers the Spawning of new Groups within the DCSRTE and administers these new Groups within the DATABASE object(s).
|
||||||
-- @module DATABASE
|
-- @module Database
|
||||||
-- @author FlightControl
|
-- @author FlightControl
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
|
|||||||
@ -42,32 +42,32 @@ function ESCORT:New( EscortClient, EscortGroup, EscortName )
|
|||||||
self.ReportTargets = true
|
self.ReportTargets = true
|
||||||
|
|
||||||
-- Escort Navigation
|
-- Escort Navigation
|
||||||
self.EscortMenu = MENU_SUB_GROUP:New( self.EscortClient, "Escort" .. self.EscortName )
|
self.EscortMenu = MENU_CLIENT:New( self.EscortClient, "Escort" .. self.EscortName )
|
||||||
self.EscortMenuHoldPosition = MENU_COMMAND_GROUP:New( self.EscortClient, "Hold Position and Stay Low", self.EscortMenu, ESCORT._HoldPosition, { ParamSelf = self } )
|
self.EscortMenuHoldPosition = MENU_CLIENT_COMMAND:New( self.EscortClient, "Hold Position and Stay Low", self.EscortMenu, ESCORT._HoldPosition, { ParamSelf = self } )
|
||||||
|
|
||||||
-- Report Targets
|
-- Report Targets
|
||||||
self.EscortMenuReportNearbyTargets = MENU_SUB_GROUP:New( self.EscortClient, "Report Targets", self.EscortMenu )
|
self.EscortMenuReportNearbyTargets = MENU_CLIENT:New( self.EscortClient, "Report Targets", self.EscortMenu )
|
||||||
self.EscortMenuReportNearbyTargetsOn = MENU_COMMAND_GROUP:New( self.EscortClient, "Report Targets On", self.EscortMenuReportNearbyTargets, ESCORT._ReportNearbyTargets, { ParamSelf = self, ParamReportTargets = true } )
|
self.EscortMenuReportNearbyTargetsOn = MENU_CLIENT_COMMAND:New( self.EscortClient, "Report Targets On", self.EscortMenuReportNearbyTargets, ESCORT._ReportNearbyTargets, { ParamSelf = self, ParamReportTargets = true } )
|
||||||
self.EscortMenuReportNearbyTargetsOff = MENU_COMMAND_GROUP:New( self.EscortClient, "Report Targets Off", self.EscortMenuReportNearbyTargets, ESCORT._ReportNearbyTargets, { ParamSelf = self, ParamReportTargets = false, } )
|
self.EscortMenuReportNearbyTargetsOff = MENU_CLIENT_COMMAND:New( self.EscortClient, "Report Targets Off", self.EscortMenuReportNearbyTargets, ESCORT._ReportNearbyTargets, { ParamSelf = self, ParamReportTargets = false, } )
|
||||||
|
|
||||||
-- Attack Targets
|
-- Attack Targets
|
||||||
self.EscortMenuAttackNearbyTargets = MENU_SUB_GROUP:New( self.EscortClient, "Attack nearby targets", self.EscortMenu )
|
self.EscortMenuAttackNearbyTargets = MENU_CLIENT:New( self.EscortClient, "Attack nearby targets", self.EscortMenu )
|
||||||
self.EscortMenuAttackTargets = {}
|
self.EscortMenuAttackTargets = {}
|
||||||
self.Targets = {}
|
self.Targets = {}
|
||||||
|
|
||||||
-- Rules of Engagement
|
-- Rules of Engagement
|
||||||
self.EscortMenuROE = MENU_SUB_GROUP:New( self.EscortClient, "ROE", self.EscortMenu )
|
self.EscortMenuROE = MENU_CLIENT:New( self.EscortClient, "ROE", self.EscortMenu )
|
||||||
self.EscortMenuROEHoldFire = MENU_COMMAND_GROUP:New( self.EscortClient, "Hold Fire", self.EscortMenuROE, ESCORT._ROEHoldFire, { ParamSelf = self, } )
|
self.EscortMenuROEHoldFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Hold Fire", self.EscortMenuROE, ESCORT._ROEHoldFire, { ParamSelf = self, } )
|
||||||
self.EscortMenuROEReturnFire = MENU_COMMAND_GROUP:New( self.EscortClient, "Return Fire", self.EscortMenuROE, ESCORT._ROEReturnFire, { ParamSelf = self, } )
|
self.EscortMenuROEReturnFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Return Fire", self.EscortMenuROE, ESCORT._ROEReturnFire, { ParamSelf = self, } )
|
||||||
self.EscortMenuROEOpenFire = MENU_COMMAND_GROUP:New( self.EscortClient, "Open Fire", self.EscortMenuROE, ESCORT._ROEOpenFire, { ParamSelf = self, } )
|
self.EscortMenuROEOpenFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Open Fire", self.EscortMenuROE, ESCORT._ROEOpenFire, { ParamSelf = self, } )
|
||||||
self.EscortMenuROEWeaponFree = MENU_COMMAND_GROUP:New( self.EscortClient, "Weapon Free", self.EscortMenuROE, ESCORT._ROEWeaponFree, { ParamSelf = self, } )
|
self.EscortMenuROEWeaponFree = MENU_CLIENT_COMMAND:New( self.EscortClient, "Weapon Free", self.EscortMenuROE, ESCORT._ROEWeaponFree, { ParamSelf = self, } )
|
||||||
|
|
||||||
-- Reaction to Threats
|
-- Reaction to Threats
|
||||||
self.EscortMenuEvasion = MENU_SUB_GROUP:New( self.EscortClient, "Evasion", self.EscortMenu )
|
self.EscortMenuEvasion = MENU_CLIENT:New( self.EscortClient, "Evasion", self.EscortMenu )
|
||||||
self.EscortMenuEvasionNoReaction = MENU_COMMAND_GROUP:New( self.EscortClient, "Fight until death", self.EscortMenuEvasion, ESCORT._EvasionNoReaction, { ParamSelf = self, } )
|
self.EscortMenuEvasionNoReaction = MENU_CLIENT_COMMAND:New( self.EscortClient, "Fight until death", self.EscortMenuEvasion, ESCORT._EvasionNoReaction, { ParamSelf = self, } )
|
||||||
self.EscortMenuEvasionPassiveDefense = MENU_COMMAND_GROUP:New( self.EscortClient, "Use flares, chaff and jammers", self.EscortMenuEvasion, ESCORT._EvasionPassiveDefense, { ParamSelf = self, } )
|
self.EscortMenuEvasionPassiveDefense = MENU_CLIENT_COMMAND:New( self.EscortClient, "Use flares, chaff and jammers", self.EscortMenuEvasion, ESCORT._EvasionPassiveDefense, { ParamSelf = self, } )
|
||||||
self.EscortMenuEvasionEvadeFire = MENU_COMMAND_GROUP:New( self.EscortClient, "Evade enemy fire", self.EscortMenuEvasion, ESCORT._EvasionEvadeFire, { ParamSelf = self, } )
|
self.EscortMenuEvasionEvadeFire = MENU_CLIENT_COMMAND:New( self.EscortClient, "Evade enemy fire", self.EscortMenuEvasion, ESCORT._EvasionEvadeFire, { ParamSelf = self, } )
|
||||||
self.EscortMenuEvasionVertical = MENU_COMMAND_GROUP:New( self.EscortClient, "Go below radar and evade fire", self.EscortMenuEvasion, ESCORT._EvasionVertical, { ParamSelf = self, } )
|
self.EscortMenuEvasionVertical = MENU_CLIENT_COMMAND:New( self.EscortClient, "Go below radar and evade fire", self.EscortMenuEvasion, ESCORT._EvasionVertical, { ParamSelf = self, } )
|
||||||
|
|
||||||
|
|
||||||
self.ScanForTargetsFunction = routines.scheduleFunction( self._ScanForTargets, { self }, timer.getTime() + 1, 30 )
|
self.ScanForTargetsFunction = routines.scheduleFunction( self._ScanForTargets, { self }, timer.getTime() + 1, 30 )
|
||||||
@ -233,7 +233,7 @@ function ESCORT:_ScanForTargets()
|
|||||||
self:T( { "Adding menu:", TargetID, "for Unit", self.Targets[TargetID].AttackUnit } )
|
self:T( { "Adding menu:", TargetID, "for Unit", self.Targets[TargetID].AttackUnit } )
|
||||||
if MenuIndex <= 10 then
|
if MenuIndex <= 10 then
|
||||||
self.EscortMenuAttackTargets[MenuIndex] =
|
self.EscortMenuAttackTargets[MenuIndex] =
|
||||||
MENU_COMMAND_GROUP:New( self.EscortClient,
|
MENU_CLIENT_COMMAND:New( self.EscortClient,
|
||||||
self.Targets[TargetID].AttackMessage,
|
self.Targets[TargetID].AttackMessage,
|
||||||
self.EscortMenuAttackNearbyTargets,
|
self.EscortMenuAttackNearbyTargets,
|
||||||
ESCORT._AttackTarget,
|
ESCORT._AttackTarget,
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
--- A GROUP class abstraction of a DCSGroup class.
|
--- A GROUP class abstraction of a DCSGroup class.
|
||||||
-- The GROUP class will take an abstraction of the DCSGroup class, providing more methods that can be done with a GROUP.
|
-- The GROUP class will take an abstraction of the DCSGroup class, providing more methods that can be done with a GROUP.
|
||||||
-- @module GROUP
|
-- @module Group
|
||||||
-- @extends BASE#BASE
|
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
Include.File( "Base" )
|
Include.File( "Base" )
|
||||||
@ -10,6 +9,7 @@ Include.File( "Unit" )
|
|||||||
|
|
||||||
--- The GROUP class
|
--- The GROUP class
|
||||||
-- @type GROUP
|
-- @type GROUP
|
||||||
|
-- @extends Base#BASE
|
||||||
-- @field #Group DCSGroup The DCS group class.
|
-- @field #Group DCSGroup The DCS group class.
|
||||||
-- @field #string GroupName The name of the group.
|
-- @field #string GroupName The name of the group.
|
||||||
-- @field #number GroupID the ID of the group.
|
-- @field #number GroupID the ID of the group.
|
||||||
|
|||||||
114
Moose/Menu.lua
114
Moose/Menu.lua
@ -1,11 +1,12 @@
|
|||||||
--- Encapsulation of DCS World Menu system in a set of MENU classes.
|
--- Encapsulation of DCS World Menu system in a set of MENU classes.
|
||||||
-- @module MENU
|
-- @module Menu
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
Include.File( "Base" )
|
Include.File( "Base" )
|
||||||
|
|
||||||
--- The MENU class
|
--- The MENU class
|
||||||
-- @type
|
-- @type MENU
|
||||||
|
-- @extends Base#BASE
|
||||||
MENU = {
|
MENU = {
|
||||||
ClassName = "MENU",
|
ClassName = "MENU",
|
||||||
MenuPath = nil,
|
MenuPath = nil,
|
||||||
@ -26,7 +27,8 @@ function MENU:New( MenuText, MenuParentPath )
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- The COMMANDMENU class
|
--- The COMMANDMENU class
|
||||||
-- @type
|
-- @type COMMANDMENU
|
||||||
|
-- @extends Menu#MENU
|
||||||
COMMANDMENU = {
|
COMMANDMENU = {
|
||||||
ClassName = "COMMANDMENU",
|
ClassName = "COMMANDMENU",
|
||||||
CommandMenuFunction = nil,
|
CommandMenuFunction = nil,
|
||||||
@ -51,7 +53,8 @@ function COMMANDMENU:New( MenuText, ParentMenu, CommandMenuFunction, CommandMenu
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- The SUBMENU class
|
--- The SUBMENU class
|
||||||
-- @type
|
-- @type SUBMENU
|
||||||
|
-- @extends Menu#MENU
|
||||||
SUBMENU = {
|
SUBMENU = {
|
||||||
ClassName = "SUBMENU"
|
ClassName = "SUBMENU"
|
||||||
}
|
}
|
||||||
@ -70,71 +73,122 @@ function SUBMENU:New( MenuText, ParentMenu )
|
|||||||
return Child
|
return Child
|
||||||
end
|
end
|
||||||
|
|
||||||
--- The MENU_SUB_GROUP class
|
-- This local variable is used to cache the menus registered under clients.
|
||||||
-- @type
|
-- Menus don't dissapear when clients are destroyed and restarted.
|
||||||
MENU_SUB_GROUP = {
|
-- So every menu for a client created must be tracked so that program logic accidentally does not create
|
||||||
ClassName = "MENU_SUB_GROUP"
|
-- the same menus twice during initialization logic.
|
||||||
|
-- These menu classes are handling this logic with this variable.
|
||||||
|
local _MENUCLIENTS = {}
|
||||||
|
|
||||||
|
--- The MENU_CLIENT class
|
||||||
|
-- @type MENU_CLIENT
|
||||||
|
-- @extends Menu#MENU
|
||||||
|
MENU_CLIENT = {
|
||||||
|
ClassName = "MENU_CLIENT"
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates a new menu item for a group
|
--- Creates a new menu item for a group
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param CLIENT#CLIENT MenuClient The Client owning the menu.
|
-- @param Client#CLIENT MenuClient The Client owning the menu.
|
||||||
-- @param MenuText The text for the menu.
|
-- @param #string MenuText The text for the menu.
|
||||||
-- @param ParentMenu The parent menu.
|
-- @param #table ParentMenu The parent menu.
|
||||||
-- @return #MENU_SUB_GROUP self
|
-- @return #MENU_CLIENT self
|
||||||
function MENU_SUB_GROUP:New( MenuClient, MenuText, ParentMenu )
|
function MENU_CLIENT:New( MenuClient, MenuText, ParentMenu )
|
||||||
|
|
||||||
-- Arrange meta tables
|
-- Arrange meta tables
|
||||||
local MenuParentPath = nil
|
local MenuParentPath = {}
|
||||||
if ParentMenu ~= nil then
|
if ParentMenu ~= nil then
|
||||||
MenuParentPath = ParentMenu.MenuPath
|
MenuParentPath = ParentMenu.MenuPath
|
||||||
end
|
end
|
||||||
|
|
||||||
local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) )
|
local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) )
|
||||||
|
|
||||||
self:T( { MenuClient, MenuText, ParentMenu } )
|
|
||||||
|
|
||||||
self.MenuClient = MenuClient
|
self.MenuClient = MenuClient
|
||||||
self.MenuPath = missionCommands.addSubMenuForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath )
|
self.MenuClientGroupID = MenuClient:GetClientGroupID()
|
||||||
|
self.MenuParentPath = MenuParentPath
|
||||||
|
self.MenuText = MenuText
|
||||||
|
|
||||||
|
if not _MENUCLIENTS[self.MenuClientGroupID] then
|
||||||
|
_MENUCLIENTS[self.MenuClientGroupID] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
|
||||||
|
|
||||||
|
self:T( { MenuClient:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText } )
|
||||||
|
|
||||||
|
if not MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] then
|
||||||
|
self.MenuPath = missionCommands.addSubMenuForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath )
|
||||||
|
MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] = self.MenuPath
|
||||||
|
else
|
||||||
|
self.MenuPath = MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText]
|
||||||
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- The MENU_COMMAND_GROUP class
|
|
||||||
-- @type
|
--- The MENU_CLIENT_COMMAND class
|
||||||
MENU_COMMAND_GROUP = {
|
-- @type MENU_CLIENT_COMMAND
|
||||||
ClassName = "MENU_COMMAND_GROUP"
|
-- @extends Menu#MENU
|
||||||
|
MENU_CLIENT_COMMAND = {
|
||||||
|
ClassName = "MENU_CLIENT_COMMAND"
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Creates a new radio command item for a group
|
--- Creates a new radio command item for a group
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param CLIENT#CLIENT MenuClient The Client owning the menu.
|
-- @param Client#CLIENT MenuClient The Client owning the menu.
|
||||||
-- @param MenuText The text for the menu.
|
-- @param MenuText The text for the menu.
|
||||||
-- @param ParentMenu The parent menu.
|
-- @param ParentMenu The parent menu.
|
||||||
-- @param CommandMenuFunction A function that is called when the menu key is pressed.
|
-- @param CommandMenuFunction A function that is called when the menu key is pressed.
|
||||||
-- @param CommandMenuArgument An argument for the function.
|
-- @param CommandMenuArgument An argument for the function.
|
||||||
-- @return #MENU_COMMAND_GROUP self
|
-- @return Menu#MENU_CLIENT_COMMAND self
|
||||||
function MENU_COMMAND_GROUP:New( MenuClient, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument )
|
function MENU_CLIENT_COMMAND:New( MenuClient, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument )
|
||||||
|
|
||||||
-- Arrange meta tables
|
-- Arrange meta tables
|
||||||
|
|
||||||
local MenuParentPath = nil
|
local MenuParentPath = {}
|
||||||
if ParentMenu ~= nil then
|
if ParentMenu ~= nil then
|
||||||
MenuParentPath = ParentMenu.MenuPath
|
MenuParentPath = ParentMenu.MenuPath
|
||||||
end
|
end
|
||||||
|
|
||||||
local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) )
|
local self = BASE:Inherit( self, MENU:New( MenuText, MenuParentPath ) )
|
||||||
|
|
||||||
self:T( { MenuClient, MenuText, ParentMenu, CommandMenuFunction, CommandMenuArgument } )
|
|
||||||
|
|
||||||
self.MenuClient = MenuClient
|
self.MenuClient = MenuClient
|
||||||
self.MenuPath = missionCommands.addCommandForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath, CommandMenuFunction, CommandMenuArgument )
|
self.MenuClientGroupID = MenuClient:GetClientGroupID()
|
||||||
|
self.MenuParentPath = MenuParentPath
|
||||||
|
self.MenuText = MenuText
|
||||||
|
|
||||||
|
if not _MENUCLIENTS[self.MenuClientGroupID] then
|
||||||
|
_MENUCLIENTS[self.MenuClientGroupID] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
|
||||||
|
|
||||||
|
self:T( { MenuClient:GetClientGroupName(), MenuPath[table.concat(MenuParentPath)], MenuParentPath, MenuText, CommandMenuFunction, CommandMenuArgument } )
|
||||||
|
|
||||||
|
if not MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] then
|
||||||
|
self.MenuPath = missionCommands.addCommandForGroup( self.MenuClient:GetClientGroupID(), MenuText, MenuParentPath, CommandMenuFunction, CommandMenuArgument )
|
||||||
|
MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText] = self.MenuPath
|
||||||
|
else
|
||||||
|
self.MenuPath = MenuPath[table.concat(MenuParentPath) .. "/" .. MenuText]
|
||||||
|
end
|
||||||
|
|
||||||
self.CommandMenuFunction = CommandMenuFunction
|
self.CommandMenuFunction = CommandMenuFunction
|
||||||
self.CommandMenuArgument = CommandMenuArgument
|
self.CommandMenuArgument = CommandMenuArgument
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function MENU_COMMAND_GROUP:Remove()
|
function MENU_CLIENT_COMMAND:Remove()
|
||||||
|
|
||||||
|
if not _MENUCLIENTS[self.MenuClientGroupID] then
|
||||||
|
_MENUCLIENTS[self.MenuClientGroupID] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local MenuPath = _MENUCLIENTS[self.MenuClientGroupID]
|
||||||
|
|
||||||
|
if MenuPath[table.concat(self.MenuParentPath) .. "/" .. self.MenuText] then
|
||||||
|
MenuPath[table.concat(self.MenuParentPath) .. "/" .. self.MenuText] = nil
|
||||||
|
end
|
||||||
missionCommands.removeItemForGroup( self.MenuClient:GetClientGroupID(), self.MenuPath )
|
missionCommands.removeItemForGroup( self.MenuClient:GetClientGroupID(), self.MenuPath )
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
--- Provides defensive behaviour to a set of SAM sites within a running Mission.
|
--- Provides defensive behaviour to a set of SAM sites within a running Mission.
|
||||||
-- @module SEAD
|
-- @module Sead
|
||||||
-- @author to be searched on the forum
|
-- @author to be searched on the forum
|
||||||
-- @author (co) Flightcontrol (Modified and enriched with functionality)
|
-- @author (co) Flightcontrol (Modified and enriched with functionality)
|
||||||
|
|
||||||
@ -10,7 +10,8 @@ Include.File( "Client" )
|
|||||||
Include.File( "Task" )
|
Include.File( "Task" )
|
||||||
|
|
||||||
--- The SEAD class
|
--- The SEAD class
|
||||||
-- @type
|
-- @type SEAD
|
||||||
|
-- @extends Base#BASE
|
||||||
SEAD = {
|
SEAD = {
|
||||||
ClassName = "SEAD",
|
ClassName = "SEAD",
|
||||||
TargetSkill = {
|
TargetSkill = {
|
||||||
|
|||||||
@ -67,7 +67,7 @@
|
|||||||
-- This models AI that has succesfully returned to their airbase, to restart their combat activities.
|
-- This models AI that has succesfully returned to their airbase, to restart their combat activities.
|
||||||
-- Check the @{#SPAWN.CleanUp} for further info.
|
-- Check the @{#SPAWN.CleanUp} for further info.
|
||||||
--
|
--
|
||||||
-- @module SPAWN
|
-- @module Spawn
|
||||||
-- @author FlightControl
|
-- @author FlightControl
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
@ -78,6 +78,7 @@ Include.File( "Zone" )
|
|||||||
|
|
||||||
--- SPAWN Class
|
--- SPAWN Class
|
||||||
-- @type SPAWN
|
-- @type SPAWN
|
||||||
|
-- @extends Base#BASE
|
||||||
-- @field ClassName
|
-- @field ClassName
|
||||||
SPAWN = {
|
SPAWN = {
|
||||||
ClassName = "SPAWN",
|
ClassName = "SPAWN",
|
||||||
|
|||||||
@ -8,7 +8,8 @@ Include.File( "Client" )
|
|||||||
Include.File( "Stage" )
|
Include.File( "Stage" )
|
||||||
|
|
||||||
--- The TASK class
|
--- The TASK class
|
||||||
-- @type
|
-- @type TASK
|
||||||
|
-- @extends Base#BASE
|
||||||
TASK = {
|
TASK = {
|
||||||
|
|
||||||
-- Defines the different signal types with a Task.
|
-- Defines the different signal types with a Task.
|
||||||
|
|||||||
@ -6,7 +6,8 @@ Include.File( "Base" )
|
|||||||
Include.File( "Message" )
|
Include.File( "Message" )
|
||||||
|
|
||||||
--- The UNIT class
|
--- The UNIT class
|
||||||
-- @type
|
-- @type UNIT
|
||||||
|
-- @Extends Base#BASE
|
||||||
UNIT = {
|
UNIT = {
|
||||||
ClassName="UNIT",
|
ClassName="UNIT",
|
||||||
CategoryName = {
|
CategoryName = {
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
--- ZONE Classes
|
--- ZONE Classes
|
||||||
-- @module ZONE
|
-- @module Zone
|
||||||
|
|
||||||
Include.File( "Routines" )
|
Include.File( "Routines" )
|
||||||
Include.File( "Base" )
|
Include.File( "Base" )
|
||||||
Include.File( "Message" )
|
Include.File( "Message" )
|
||||||
|
|
||||||
--- The ZONE class
|
--- The ZONE class
|
||||||
-- @type
|
-- @type ZONE
|
||||||
|
-- @Extends Base#BASE
|
||||||
ZONE = {
|
ZONE = {
|
||||||
ClassName="ZONE",
|
ClassName="ZONE",
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user