mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/master' into develop
# Conflicts: # Moose Development/Moose/Core/Menu.lua # Moose Development/Moose/Functional/Mantis.lua
This commit is contained in:
commit
da8a02465e
@ -1,9 +1,9 @@
|
||||
--- **Core** - Manage hierarchical menu structures and commands for players within a mission.
|
||||
--
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Features:
|
||||
--
|
||||
--
|
||||
-- ## Features:
|
||||
--
|
||||
-- * Setup mission sub menus.
|
||||
-- * Setup mission command menus.
|
||||
-- * Setup coalition sub menus.
|
||||
@ -21,35 +21,39 @@
|
||||
-- * Update the parameters and the receiving methods, without updating the menu within DCS!
|
||||
-- * Provide a great performance boost in menu management.
|
||||
-- * Provide a great tool to manage menus in your code.
|
||||
--
|
||||
-- DCS Menus can be managed using the MENU classes.
|
||||
-- The advantage of using MENU classes is that it hides the complexity of dealing with menu management in more advanced scenarios where you need to
|
||||
--
|
||||
-- DCS Menus can be managed using the MENU classes.
|
||||
-- The advantage of using MENU classes is that it hides the complexity of dealing with menu management in more advanced scenarios where you need to
|
||||
-- set menus and later remove them, and later set them again. You'll find while using use normal DCS scripting functions, that setting and removing
|
||||
-- menus is not a easy feat if you have complex menu hierarchies defined.
|
||||
-- menus is not a easy feat if you have complex menu hierarchies defined.
|
||||
-- Using the MOOSE menu classes, the removal and refreshing of menus are nicely being handled within these classes, and becomes much more easy.
|
||||
-- On top, MOOSE implements **variable parameter** passing for command menus.
|
||||
--
|
||||
-- On top, MOOSE implements **variable parameter** passing for command menus.
|
||||
--
|
||||
-- There are basically two different MENU class types that you need to use:
|
||||
--
|
||||
--
|
||||
-- ### To manage **main menus**, the classes begin with **MENU_**:
|
||||
--
|
||||
--
|
||||
-- * @{Core.Menu#MENU_MISSION}: Manages main menus for whole mission file.
|
||||
-- * @{Core.Menu#MENU_COALITION}: Manages main menus for whole coalition.
|
||||
-- * @{Core.Menu#MENU_GROUP}: Manages main menus for GROUPs.
|
||||
--
|
||||
--
|
||||
-- ### To manage **command menus**, which are menus that allow the player to issue **functions**, the classes begin with **MENU_COMMAND_**:
|
||||
--
|
||||
--
|
||||
-- * @{Core.Menu#MENU_MISSION_COMMAND}: Manages command menus for whole mission file.
|
||||
-- * @{Core.Menu#MENU_COALITION_COMMAND}: Manages command menus for whole coalition.
|
||||
-- * @{Core.Menu#MENU_GROUP_COMMAND}: Manages command menus for GROUPs.
|
||||
--
|
||||
--
|
||||
-- ===
|
||||
---
|
||||
--
|
||||
-- ### [Demo Missions](https://github.com/FlightControl-Master/MOOSE_Demos/tree/master/Core/Menu)
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
-- ### Author: **FlightControl**
|
||||
-- ### Contributions:
|
||||
--
|
||||
-- ### Contributions:
|
||||
--
|
||||
-- ===
|
||||
--
|
||||
--
|
||||
-- @module Core.Menu
|
||||
-- @image Core_Menu.JPG
|
||||
|
||||
@ -65,18 +69,18 @@ MENU_INDEX.Group = {}
|
||||
|
||||
function MENU_INDEX:ParentPath( ParentMenu, MenuText )
|
||||
local Path = ParentMenu and "@" .. table.concat( ParentMenu.MenuPath or {}, "@" ) or ""
|
||||
if ParentMenu then
|
||||
if ParentMenu then
|
||||
if ParentMenu:IsInstanceOf( "MENU_GROUP" ) or ParentMenu:IsInstanceOf( "MENU_GROUP_COMMAND" ) then
|
||||
local GroupName = ParentMenu.Group:GetName()
|
||||
if not self.Group[GroupName].Menus[Path] then
|
||||
BASE:E( { Path = Path, GroupName = GroupName } )
|
||||
BASE:E( { Path = Path, GroupName = GroupName } )
|
||||
error( "Parent path not found in menu index for group menu" )
|
||||
return nil
|
||||
end
|
||||
elseif ParentMenu:IsInstanceOf( "MENU_COALITION" ) or ParentMenu:IsInstanceOf( "MENU_COALITION_COMMAND" ) then
|
||||
local Coalition = ParentMenu.Coalition
|
||||
if not self.Coalition[Coalition].Menus[Path] then
|
||||
BASE:E( { Path = Path, Coalition = Coalition } )
|
||||
BASE:E( { Path = Path, Coalition = Coalition } )
|
||||
error( "Parent path not found in menu index for coalition menu" )
|
||||
return nil
|
||||
end
|
||||
@ -88,7 +92,7 @@ function MENU_INDEX:ParentPath( ParentMenu, MenuText )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Path = Path .. "@" .. MenuText
|
||||
return Path
|
||||
end
|
||||
@ -149,19 +153,19 @@ function MENU_INDEX:ClearGroupMenu( Group, Path )
|
||||
end
|
||||
function MENU_INDEX:Refresh( Group )
|
||||
for MenuID, Menu in pairs( self.MenuMission.Menus ) do
|
||||
Menu:Refresh()
|
||||
end
|
||||
Menu:Refresh()
|
||||
end
|
||||
for MenuID, Menu in pairs( self.Coalition[coalition.side.BLUE].Menus ) do
|
||||
Menu:Refresh()
|
||||
end
|
||||
Menu:Refresh()
|
||||
end
|
||||
for MenuID, Menu in pairs( self.Coalition[coalition.side.RED].Menus ) do
|
||||
Menu:Refresh()
|
||||
end
|
||||
Menu:Refresh()
|
||||
end
|
||||
local GroupName = Group:GetName()
|
||||
for MenuID, Menu in pairs( self.Group[GroupName].Menus ) do
|
||||
Menu:Refresh()
|
||||
end
|
||||
|
||||
Menu:Refresh()
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -178,19 +182,19 @@ do -- MENU_BASE
|
||||
MenuText = "",
|
||||
MenuParentPath = nil,
|
||||
}
|
||||
|
||||
|
||||
--- Constructor
|
||||
-- @param #MENU_BASE
|
||||
-- @return #MENU_BASE
|
||||
function MENU_BASE:New( MenuText, ParentMenu )
|
||||
|
||||
|
||||
local MenuParentPath = {}
|
||||
if ParentMenu ~= nil then
|
||||
MenuParentPath = ParentMenu.MenuPath
|
||||
end
|
||||
local self = BASE:Inherit( self, BASE:New() )
|
||||
|
||||
self.MenuPath = nil
|
||||
|
||||
self.MenuPath = nil
|
||||
self.MenuText = MenuText
|
||||
self.ParentMenu = ParentMenu
|
||||
self.MenuParentPath = MenuParentPath
|
||||
@ -199,12 +203,12 @@ do -- MENU_BASE
|
||||
self.MenuCount = 0
|
||||
self.MenuStamp = timer.getTime()
|
||||
self.MenuRemoveParent = false
|
||||
|
||||
|
||||
if self.ParentMenu then
|
||||
self.ParentMenu.Menus = self.ParentMenu.Menus or {}
|
||||
self.ParentMenu.Menus[MenuText] = self
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -233,7 +237,7 @@ do -- MENU_BASE
|
||||
self.MenuRemoveParent = RemoveParent
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Gets a @{Menu} from a parent @{Menu}
|
||||
-- @param #MENU_BASE self
|
||||
-- @param #string MenuText The text of the child menu.
|
||||
@ -241,7 +245,7 @@ do -- MENU_BASE
|
||||
function MENU_BASE:GetMenu( MenuText )
|
||||
return self.Menus[MenuText]
|
||||
end
|
||||
|
||||
|
||||
--- Sets a menu stamp for later prevention of menu removal.
|
||||
-- @param #MENU_BASE self
|
||||
-- @param MenuStamp
|
||||
@ -250,16 +254,16 @@ do -- MENU_BASE
|
||||
self.MenuStamp = MenuStamp
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--- Gets a menu stamp for later prevention of menu removal.
|
||||
-- @param #MENU_BASE self
|
||||
-- @return MenuStamp
|
||||
function MENU_BASE:GetStamp()
|
||||
return timer.getTime()
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--- Sets a time stamp for later prevention of menu removal.
|
||||
-- @param #MENU_BASE self
|
||||
-- @param MenuStamp
|
||||
@ -268,7 +272,7 @@ do -- MENU_BASE
|
||||
self.MenuStamp = MenuStamp
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Sets a tag for later selection of menu refresh.
|
||||
-- @param #MENU_BASE self
|
||||
-- @param #string MenuTag A Tag or Key that will filter only menu items set with this key.
|
||||
@ -277,7 +281,7 @@ do -- MENU_BASE
|
||||
self.MenuTag = MenuTag
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
do
|
||||
---
|
||||
@ -285,10 +289,10 @@ do
|
||||
-- @type MENU_COMMAND_BASE
|
||||
-- @field #function MenuCallHandler
|
||||
-- @extends Core.Menu#MENU_BASE
|
||||
|
||||
--- Defines the main MENU class where other MENU COMMAND_
|
||||
|
||||
--- Defines the main MENU class where other MENU COMMAND_
|
||||
-- classes are derived from, in order to set commands.
|
||||
--
|
||||
--
|
||||
-- @field #MENU_COMMAND_BASE
|
||||
MENU_COMMAND_BASE = {
|
||||
ClassName = "MENU_COMMAND_BASE",
|
||||
@ -296,12 +300,12 @@ do
|
||||
CommandMenuArgument = nil,
|
||||
MenuCallHandler = nil,
|
||||
}
|
||||
|
||||
|
||||
--- Constructor
|
||||
-- @param #MENU_COMMAND_BASE
|
||||
-- @return #MENU_COMMAND_BASE
|
||||
function MENU_COMMAND_BASE:New( MenuText, ParentMenu, CommandMenuFunction, CommandMenuArguments )
|
||||
|
||||
|
||||
local self = BASE:Inherit( self, MENU_BASE:New( MenuText, ParentMenu ) ) -- #MENU_COMMAND_BASE
|
||||
-- When a menu function goes into error, DCS displays an obscure menu message.
|
||||
-- This error handler catches the menu error and displays the full call stack.
|
||||
@ -312,20 +316,20 @@ do
|
||||
end
|
||||
return errmsg
|
||||
end
|
||||
|
||||
|
||||
self:SetCommandMenuFunction( CommandMenuFunction )
|
||||
self:SetCommandMenuArguments( CommandMenuArguments )
|
||||
self.MenuCallHandler = function()
|
||||
local function MenuFunction()
|
||||
local function MenuFunction()
|
||||
return self.CommandMenuFunction( unpack( self.CommandMenuArguments ) )
|
||||
end
|
||||
local Status, Result = xpcall( MenuFunction, ErrorHandler )
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- This sets the new command function of a menu,
|
||||
|
||||
--- This sets the new command function of a menu,
|
||||
-- so that if a menu is regenerated, or if command function changes,
|
||||
-- that the function set for the menu is loosely coupled with the menu itself!!!
|
||||
-- If the function changes, no new menu needs to be generated if the menu text is the same!!!
|
||||
@ -335,7 +339,7 @@ do
|
||||
self.CommandMenuFunction = CommandMenuFunction
|
||||
return self
|
||||
end
|
||||
--- This sets the new command arguments of a menu,
|
||||
--- This sets the new command arguments of a menu,
|
||||
-- so that if a menu is regenerated, or if command arguments change,
|
||||
-- that the arguments set for the menu are loosely coupled with the menu itself!!!
|
||||
-- If the arguments change, no new menu needs to be generated if the menu text is the same!!!
|
||||
@ -352,38 +356,38 @@ do
|
||||
-- MENU_MISSION
|
||||
-- @type MENU_MISSION
|
||||
-- @extends Core.Menu#MENU_BASE
|
||||
--- Manages the main menus for a complete mission.
|
||||
--
|
||||
--- Manages the main menus for a complete mission.
|
||||
--
|
||||
-- You can add menus with the @{#MENU_MISSION.New} method, which constructs a MENU_MISSION object and returns you the object reference.
|
||||
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_MISSION.Remove}.
|
||||
-- @field #MENU_MISSION
|
||||
MENU_MISSION = {
|
||||
ClassName = "MENU_MISSION",
|
||||
}
|
||||
|
||||
|
||||
--- MENU_MISSION constructor. Creates a new MENU_MISSION object and creates the menu for a complete mission file.
|
||||
-- @param #MENU_MISSION self
|
||||
-- @param #string MenuText The text for the menu.
|
||||
-- @param #table ParentMenu The parent menu. This parameter can be ignored if you want the menu to be located at the parent menu of DCS world (under F10 other).
|
||||
-- @return #MENU_MISSION
|
||||
function MENU_MISSION:New( MenuText, ParentMenu )
|
||||
|
||||
|
||||
MENU_INDEX:PrepareMission()
|
||||
local Path = MENU_INDEX:ParentPath( ParentMenu, MenuText )
|
||||
local MissionMenu = MENU_INDEX:HasMissionMenu( Path )
|
||||
local MissionMenu = MENU_INDEX:HasMissionMenu( Path )
|
||||
if MissionMenu then
|
||||
return MissionMenu
|
||||
else
|
||||
local self = BASE:Inherit( self, MENU_BASE:New( MenuText, ParentMenu ) )
|
||||
MENU_INDEX:SetMissionMenu( Path, self )
|
||||
|
||||
|
||||
self.MenuPath = missionCommands.addSubMenu( self.MenuText, self.MenuParentPath )
|
||||
self:SetParentMenu( self.MenuText, self )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- Refreshes a radio item for a mission
|
||||
-- @param #MENU_MISSION self
|
||||
-- @return #MENU_MISSION
|
||||
@ -394,28 +398,28 @@ do
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Removes the sub menus recursively of this MENU_MISSION. Note that the main menu is kept!
|
||||
-- @param #MENU_MISSION self
|
||||
-- @return #MENU_MISSION
|
||||
function MENU_MISSION:RemoveSubMenus()
|
||||
|
||||
|
||||
for MenuID, Menu in pairs( self.Menus or {} ) do
|
||||
Menu:Remove()
|
||||
end
|
||||
|
||||
|
||||
self.Menus = nil
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- Removes the main menu and the sub menus recursively of this MENU_MISSION.
|
||||
-- @param #MENU_MISSION self
|
||||
-- @return #nil
|
||||
function MENU_MISSION:Remove( MenuStamp, MenuTag )
|
||||
|
||||
|
||||
MENU_INDEX:PrepareMission()
|
||||
local Path = MENU_INDEX:ParentPath( self.ParentMenu, self.MenuText )
|
||||
local MissionMenu = MENU_INDEX:HasMissionMenu( Path )
|
||||
local MissionMenu = MENU_INDEX:HasMissionMenu( Path )
|
||||
if MissionMenu == self then
|
||||
self:RemoveSubMenus()
|
||||
if not MenuStamp or self.MenuStamp ~= MenuStamp then
|
||||
@ -432,27 +436,26 @@ do
|
||||
else
|
||||
BASE:E( { "Cannot Remove MENU_MISSION", Path = Path, ParentMenu = self.ParentMenu, MenuText = self.MenuText } )
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
end
|
||||
do
|
||||
do -- MENU_MISSION_COMMAND
|
||||
|
||||
--- MENU_MISSION_COMMAND
|
||||
-- @type MENU_MISSION_COMMAND
|
||||
--- @type MENU_MISSION_COMMAND
|
||||
-- @extends Core.Menu#MENU_COMMAND_BASE
|
||||
|
||||
--- Manages the command menus for a complete mission, which allow players to execute functions during mission execution.
|
||||
--
|
||||
|
||||
--- Manages the command menus for a complete mission, which allow players to execute functions during mission execution.
|
||||
--
|
||||
-- You can add menus with the @{#MENU_MISSION_COMMAND.New} method, which constructs a MENU_MISSION_COMMAND object and returns you the object reference.
|
||||
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_MISSION_COMMAND.Remove}.
|
||||
--
|
||||
--
|
||||
-- @field #MENU_MISSION_COMMAND
|
||||
MENU_MISSION_COMMAND = {
|
||||
ClassName = "MENU_MISSION_COMMAND",
|
||||
}
|
||||
|
||||
|
||||
--- MENU_MISSION constructor. Creates a new radio command item for a complete mission file, which can invoke a function with parameters.
|
||||
-- @param #MENU_MISSION_COMMAND self
|
||||
-- @param #string MenuText The text for the menu.
|
||||
@ -461,10 +464,10 @@ do
|
||||
-- @param CommandMenuArgument An argument for the function. There can only be ONE argument given. So multiple arguments must be wrapped into a table. See the below example how to do this.
|
||||
-- @return #MENU_MISSION_COMMAND self
|
||||
function MENU_MISSION_COMMAND:New( MenuText, ParentMenu, CommandMenuFunction, ... )
|
||||
|
||||
|
||||
MENU_INDEX:PrepareMission()
|
||||
local Path = MENU_INDEX:ParentPath( ParentMenu, MenuText )
|
||||
local MissionMenu = MENU_INDEX:HasMissionMenu( Path )
|
||||
local MissionMenu = MENU_INDEX:HasMissionMenu( Path )
|
||||
if MissionMenu then
|
||||
MissionMenu:SetCommandMenuFunction( CommandMenuFunction )
|
||||
MissionMenu:SetCommandMenuArguments( arg )
|
||||
@ -472,7 +475,7 @@ do
|
||||
else
|
||||
local self = BASE:Inherit( self, MENU_COMMAND_BASE:New( MenuText, ParentMenu, CommandMenuFunction, arg ) )
|
||||
MENU_INDEX:SetMissionMenu( Path, self )
|
||||
|
||||
|
||||
self.MenuPath = missionCommands.addCommand( MenuText, self.MenuParentPath, self.MenuCallHandler )
|
||||
self:SetParentMenu( self.MenuText, self )
|
||||
return self
|
||||
@ -488,15 +491,15 @@ do
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Removes a radio command item for a coalition
|
||||
-- @param #MENU_MISSION_COMMAND self
|
||||
-- @return #nil
|
||||
function MENU_MISSION_COMMAND:Remove()
|
||||
|
||||
|
||||
MENU_INDEX:PrepareMission()
|
||||
local Path = MENU_INDEX:ParentPath( self.ParentMenu, self.MenuText )
|
||||
local MissionMenu = MENU_INDEX:HasMissionMenu( Path )
|
||||
local MissionMenu = MENU_INDEX:HasMissionMenu( Path )
|
||||
if MissionMenu == self then
|
||||
if not MenuStamp or self.MenuStamp ~= MenuStamp then
|
||||
if ( not MenuTag ) or ( MenuTag and self.MenuTag and MenuTag == self.MenuTag ) then
|
||||
@ -512,7 +515,7 @@ do
|
||||
else
|
||||
BASE:E( { "Cannot Remove MENU_MISSION_COMMAND", Path = Path, ParentMenu = self.ParentMenu, MenuText = self.MenuText } )
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
end
|
||||
@ -520,12 +523,12 @@ do
|
||||
--- MENU_COALITION
|
||||
-- @type MENU_COALITION
|
||||
-- @extends Core.Menu#MENU_BASE
|
||||
|
||||
|
||||
--- Manages the main menus for DCS.coalition.
|
||||
--
|
||||
--
|
||||
-- You can add menus with the @{#MENU_COALITION.New} method, which constructs a MENU_COALITION object and returns you the object reference.
|
||||
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION.Remove}.
|
||||
--
|
||||
--
|
||||
--
|
||||
-- @usage
|
||||
-- -- This demo creates a menu structure for the planes within the red coalition.
|
||||
@ -555,7 +558,7 @@ do
|
||||
-- end
|
||||
--
|
||||
-- local function AddStatusMenu()
|
||||
--
|
||||
--
|
||||
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
||||
-- MenuStatus = MENU_COALITION:New( coalition.side.RED, "Status for Planes" )
|
||||
-- MenuStatusShow = MENU_COALITION_COMMAND:New( coalition.side.RED, "Show Status", MenuStatus, ShowStatus, "Status of planes is ok!", "Message to Red Coalition" )
|
||||
@ -563,12 +566,12 @@ do
|
||||
--
|
||||
-- local MenuAdd = MENU_COALITION_COMMAND:New( coalition.side.RED, "Add Status Menu", MenuCoalitionRed, AddStatusMenu )
|
||||
-- local MenuRemove = MENU_COALITION_COMMAND:New( coalition.side.RED, "Remove Status Menu", MenuCoalitionRed, RemoveStatusMenu )
|
||||
--
|
||||
--
|
||||
-- @field #MENU_COALITION
|
||||
MENU_COALITION = {
|
||||
ClassName = "MENU_COALITION"
|
||||
}
|
||||
|
||||
|
||||
--- MENU_COALITION constructor. Creates a new MENU_COALITION object and creates the menu for a complete coalition.
|
||||
-- @param #MENU_COALITION self
|
||||
-- @param DCS#coalition.side Coalition The coalition owning the menu.
|
||||
@ -578,15 +581,15 @@ do
|
||||
function MENU_COALITION:New( Coalition, MenuText, ParentMenu )
|
||||
MENU_INDEX:PrepareCoalition( Coalition )
|
||||
local Path = MENU_INDEX:ParentPath( ParentMenu, MenuText )
|
||||
local CoalitionMenu = MENU_INDEX:HasCoalitionMenu( Coalition, Path )
|
||||
local CoalitionMenu = MENU_INDEX:HasCoalitionMenu( Coalition, Path )
|
||||
if CoalitionMenu then
|
||||
return CoalitionMenu
|
||||
else
|
||||
local self = BASE:Inherit( self, MENU_BASE:New( MenuText, ParentMenu ) )
|
||||
MENU_INDEX:SetCoalitionMenu( Coalition, Path, self )
|
||||
|
||||
|
||||
self.Coalition = Coalition
|
||||
|
||||
|
||||
self.MenuPath = missionCommands.addSubMenuForCoalition( Coalition, MenuText, self.MenuParentPath )
|
||||
self:SetParentMenu( self.MenuText, self )
|
||||
return self
|
||||
@ -602,27 +605,27 @@ do
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Removes the sub menus recursively of this MENU_COALITION. Note that the main menu is kept!
|
||||
-- @param #MENU_COALITION self
|
||||
-- @return #MENU_COALITION
|
||||
function MENU_COALITION:RemoveSubMenus()
|
||||
|
||||
|
||||
for MenuID, Menu in pairs( self.Menus or {} ) do
|
||||
Menu:Remove()
|
||||
end
|
||||
|
||||
|
||||
self.Menus = nil
|
||||
end
|
||||
|
||||
|
||||
--- Removes the main menu and the sub menus recursively of this MENU_COALITION.
|
||||
-- @param #MENU_COALITION self
|
||||
-- @return #nil
|
||||
function MENU_COALITION:Remove( MenuStamp, MenuTag )
|
||||
|
||||
|
||||
MENU_INDEX:PrepareCoalition( self.Coalition )
|
||||
local Path = MENU_INDEX:ParentPath( self.ParentMenu, self.MenuText )
|
||||
local CoalitionMenu = MENU_INDEX:HasCoalitionMenu( self.Coalition, Path )
|
||||
local CoalitionMenu = MENU_INDEX:HasCoalitionMenu( self.Coalition, Path )
|
||||
if CoalitionMenu == self then
|
||||
self:RemoveSubMenus()
|
||||
if not MenuStamp or self.MenuStamp ~= MenuStamp then
|
||||
@ -639,7 +642,7 @@ do
|
||||
else
|
||||
BASE:E( { "Cannot Remove MENU_COALITION", Path = Path, ParentMenu = self.ParentMenu, MenuText = self.MenuText, Coalition = self.Coalition } )
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
end
|
||||
@ -648,9 +651,9 @@ do
|
||||
--- MENU_COALITION_COMMAND
|
||||
-- @type MENU_COALITION_COMMAND
|
||||
-- @extends Core.Menu#MENU_COMMAND_BASE
|
||||
|
||||
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||
--
|
||||
|
||||
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||
--
|
||||
-- You can add menus with the @{#MENU_COALITION_COMMAND.New} method, which constructs a MENU_COALITION_COMMAND object and returns you the object reference.
|
||||
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_COALITION_COMMAND.Remove}.
|
||||
--
|
||||
@ -658,7 +661,7 @@ do
|
||||
MENU_COALITION_COMMAND = {
|
||||
ClassName = "MENU_COALITION_COMMAND"
|
||||
}
|
||||
|
||||
|
||||
--- MENU_COALITION constructor. Creates a new radio command item for a coalition, which can invoke a function with parameters.
|
||||
-- @param #MENU_COALITION_COMMAND self
|
||||
-- @param DCS#coalition.side Coalition The coalition owning the menu.
|
||||
@ -668,19 +671,19 @@ do
|
||||
-- @param CommandMenuArgument An argument for the function. There can only be ONE argument given. So multiple arguments must be wrapped into a table. See the below example how to do this.
|
||||
-- @return #MENU_COALITION_COMMAND
|
||||
function MENU_COALITION_COMMAND:New( Coalition, MenuText, ParentMenu, CommandMenuFunction, ... )
|
||||
|
||||
|
||||
MENU_INDEX:PrepareCoalition( Coalition )
|
||||
local Path = MENU_INDEX:ParentPath( ParentMenu, MenuText )
|
||||
local CoalitionMenu = MENU_INDEX:HasCoalitionMenu( Coalition, Path )
|
||||
local CoalitionMenu = MENU_INDEX:HasCoalitionMenu( Coalition, Path )
|
||||
if CoalitionMenu then
|
||||
CoalitionMenu:SetCommandMenuFunction( CommandMenuFunction )
|
||||
CoalitionMenu:SetCommandMenuArguments( arg )
|
||||
return CoalitionMenu
|
||||
else
|
||||
|
||||
|
||||
local self = BASE:Inherit( self, MENU_COMMAND_BASE:New( MenuText, ParentMenu, CommandMenuFunction, arg ) )
|
||||
MENU_INDEX:SetCoalitionMenu( Coalition, Path, self )
|
||||
|
||||
|
||||
self.Coalition = Coalition
|
||||
self.MenuPath = missionCommands.addCommandForCoalition( self.Coalition, MenuText, self.MenuParentPath, self.MenuCallHandler )
|
||||
self:SetParentMenu( self.MenuText, self )
|
||||
@ -695,18 +698,18 @@ do
|
||||
missionCommands.removeItemForCoalition( self.Coalition, self.MenuPath )
|
||||
missionCommands.addCommandForCoalition( self.Coalition, self.MenuText, self.MenuParentPath, self.MenuCallHandler )
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Removes a radio command item for a coalition
|
||||
-- @param #MENU_COALITION_COMMAND self
|
||||
-- @return #nil
|
||||
function MENU_COALITION_COMMAND:Remove( MenuStamp, MenuTag )
|
||||
|
||||
|
||||
MENU_INDEX:PrepareCoalition( self.Coalition )
|
||||
local Path = MENU_INDEX:ParentPath( self.ParentMenu, self.MenuText )
|
||||
local CoalitionMenu = MENU_INDEX:HasCoalitionMenu( self.Coalition, Path )
|
||||
local CoalitionMenu = MENU_INDEX:HasCoalitionMenu( self.Coalition, Path )
|
||||
if CoalitionMenu == self then
|
||||
if not MenuStamp or self.MenuStamp ~= MenuStamp then
|
||||
if ( not MenuTag ) or ( MenuTag and self.MenuTag and MenuTag == self.MenuTag ) then
|
||||
@ -722,7 +725,7 @@ do
|
||||
else
|
||||
BASE:E( { "Cannot Remove MENU_COALITION_COMMAND", Path = Path, ParentMenu = self.ParentMenu, MenuText = self.MenuText, Coalition = self.Coalition } )
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
end
|
||||
@ -740,20 +743,20 @@ do
|
||||
---
|
||||
-- @type MENU_GROUP
|
||||
-- @extends Core.Menu#MENU_BASE
|
||||
|
||||
|
||||
--- Manages the main menus for @{Wrapper.Group}s.
|
||||
--
|
||||
|
||||
|
||||
--- Manages the main menus for @{Wrapper.Group}s.
|
||||
--
|
||||
-- You can add menus with the @{#MENU_GROUP.New} method, which constructs a MENU_GROUP object and returns you the object reference.
|
||||
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_GROUP.Remove}.
|
||||
--
|
||||
--
|
||||
-- @usage
|
||||
-- -- This demo creates a menu structure for the two groups of planes.
|
||||
-- -- Each group will receive a different menu structure.
|
||||
-- -- To test, join the planes, then look at the other radio menus (Option F10).
|
||||
-- -- Then switch planes and check if the menu is still there.
|
||||
-- -- And play with the Add and Remove menu options.
|
||||
--
|
||||
--
|
||||
-- -- Note that in multi player, this will only work after the DCS groups bug is solved.
|
||||
--
|
||||
-- local function ShowStatus( PlaneGroup, StatusText, Coalition )
|
||||
@ -801,7 +804,7 @@ do
|
||||
MENU_GROUP = {
|
||||
ClassName = "MENU_GROUP"
|
||||
}
|
||||
|
||||
|
||||
--- MENU_GROUP constructor. Creates a new radio menu item for a group.
|
||||
-- @param #MENU_GROUP self
|
||||
-- @param Wrapper.Group#GROUP Group The Group owning the menu.
|
||||
@ -809,7 +812,7 @@ do
|
||||
-- @param #table ParentMenu The parent menu.
|
||||
-- @return #MENU_GROUP self
|
||||
function MENU_GROUP:New( Group, MenuText, ParentMenu )
|
||||
|
||||
|
||||
MENU_INDEX:PrepareGroup( Group )
|
||||
local Path = MENU_INDEX:ParentPath( ParentMenu, MenuText )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( Group, Path )
|
||||
@ -821,13 +824,13 @@ do
|
||||
self.Group = Group
|
||||
self.GroupID = Group:GetID()
|
||||
self.MenuPath = missionCommands.addSubMenuForGroup( self.GroupID, MenuText, self.MenuParentPath )
|
||||
|
||||
|
||||
self:SetParentMenu( self.MenuText, self )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- Refreshes a new radio item for a group and submenus
|
||||
-- @param #MENU_GROUP self
|
||||
-- @return #MENU_GROUP
|
||||
@ -835,15 +838,15 @@ do
|
||||
do
|
||||
missionCommands.removeItemForGroup( self.GroupID, self.MenuPath )
|
||||
missionCommands.addSubMenuForGroup( self.GroupID, self.MenuText, self.MenuParentPath )
|
||||
|
||||
|
||||
for MenuText, Menu in pairs( self.Menus or {} ) do
|
||||
Menu:Refresh()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Refreshes a new radio item for a group and submenus, ordering by (numerical) MenuTag
|
||||
-- @param #MENU_GROUP self
|
||||
-- @return #MENU_GROUP
|
||||
@ -852,7 +855,7 @@ do
|
||||
do
|
||||
missionCommands.removeItemForGroup( self.GroupID, self.MenuPath )
|
||||
missionCommands.addSubMenuForGroup( self.GroupID, self.MenuText, self.MenuParentPath )
|
||||
|
||||
|
||||
local MenuTable = {}
|
||||
for MenuText, Menu in pairs( self.Menus or {} ) do
|
||||
local tag = Menu.MenuTag or math.random(1,10000)
|
||||
@ -861,12 +864,12 @@ do
|
||||
table.sort(MenuTable, function (k1, k2) return k1.tag < k2.tag end )
|
||||
for _, Menu in pairs( MenuTable ) do
|
||||
Menu.Entry:Refresh()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Removes the sub menus recursively of this MENU_GROUP.
|
||||
-- @param #MENU_GROUP self
|
||||
-- @param MenuStamp
|
||||
@ -876,9 +879,9 @@ do
|
||||
for MenuText, Menu in pairs( self.Menus or {} ) do
|
||||
Menu:Remove( MenuStamp, MenuTag )
|
||||
end
|
||||
|
||||
|
||||
self.Menus = nil
|
||||
|
||||
|
||||
end
|
||||
|
||||
--- Removes the main menu and sub menus recursively of this MENU_GROUP.
|
||||
@ -889,7 +892,7 @@ do
|
||||
function MENU_GROUP:Remove( MenuStamp, MenuTag )
|
||||
MENU_INDEX:PrepareGroup( self.Group )
|
||||
local Path = MENU_INDEX:ParentPath( self.ParentMenu, self.MenuText )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( self.Group, Path )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( self.Group, Path )
|
||||
if GroupMenu == self then
|
||||
self:RemoveSubMenus( MenuStamp, MenuTag )
|
||||
if not MenuStamp or self.MenuStamp ~= MenuStamp then
|
||||
@ -907,15 +910,15 @@ do
|
||||
BASE:E( { "Cannot Remove MENU_GROUP", Path = Path, ParentMenu = self.ParentMenu, MenuText = self.MenuText, Group = self.Group } )
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @type MENU_GROUP_COMMAND
|
||||
-- @extends Core.Menu#MENU_COMMAND_BASE
|
||||
|
||||
--- The @{Core.Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||
|
||||
--- The @{Core.Menu#MENU_GROUP_COMMAND} class manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||
-- You can add menus with the @{#MENU_GROUP_COMMAND.New} method, which constructs a MENU_GROUP_COMMAND object and returns you the object reference.
|
||||
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_GROUP_COMMAND.Remove}.
|
||||
--
|
||||
@ -923,7 +926,7 @@ do
|
||||
MENU_GROUP_COMMAND = {
|
||||
ClassName = "MENU_GROUP_COMMAND"
|
||||
}
|
||||
|
||||
|
||||
--- Creates a new radio command item for a group
|
||||
-- @param #MENU_GROUP_COMMAND self
|
||||
-- @param Wrapper.Group#GROUP Group The Group owning the menu.
|
||||
@ -935,7 +938,7 @@ do
|
||||
function MENU_GROUP_COMMAND:New( Group, MenuText, ParentMenu, CommandMenuFunction, ... )
|
||||
MENU_INDEX:PrepareGroup( Group )
|
||||
local Path = MENU_INDEX:ParentPath( ParentMenu, MenuText )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( Group, Path )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( Group, Path )
|
||||
if GroupMenu then
|
||||
GroupMenu:SetCommandMenuFunction( CommandMenuFunction )
|
||||
GroupMenu:SetCommandMenuArguments( arg )
|
||||
@ -943,12 +946,12 @@ do
|
||||
else
|
||||
self = BASE:Inherit( self, MENU_COMMAND_BASE:New( MenuText, ParentMenu, CommandMenuFunction, arg ) )
|
||||
MENU_INDEX:SetGroupMenu( Group, Path, self )
|
||||
|
||||
|
||||
self.Group = Group
|
||||
self.GroupID = Group:GetID()
|
||||
|
||||
|
||||
self.MenuPath = missionCommands.addCommandForGroup( self.GroupID, MenuText, self.MenuParentPath, self.MenuCallHandler )
|
||||
|
||||
|
||||
self:SetParentMenu( self.MenuText, self )
|
||||
return self
|
||||
end
|
||||
@ -961,10 +964,10 @@ do
|
||||
missionCommands.removeItemForGroup( self.GroupID, self.MenuPath )
|
||||
missionCommands.addCommandForGroup( self.GroupID, self.MenuText, self.MenuParentPath, self.MenuCallHandler )
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Removes a menu structure for a group.
|
||||
-- @param #MENU_GROUP_COMMAND self
|
||||
-- @param MenuStamp
|
||||
@ -973,7 +976,7 @@ do
|
||||
function MENU_GROUP_COMMAND:Remove( MenuStamp, MenuTag )
|
||||
MENU_INDEX:PrepareGroup( self.Group )
|
||||
local Path = MENU_INDEX:ParentPath( self.ParentMenu, self.MenuText )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( self.Group, Path )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( self.Group, Path )
|
||||
if GroupMenu == self then
|
||||
if not MenuStamp or self.MenuStamp ~= MenuStamp then
|
||||
if ( not MenuTag ) or ( MenuTag and self.MenuTag and MenuTag == self.MenuTag ) then
|
||||
@ -989,7 +992,7 @@ do
|
||||
else
|
||||
BASE:E( { "Cannot Remove MENU_GROUP_COMMAND", Path = Path, ParentMenu = self.ParentMenu, MenuText = self.MenuText, Group = self.Group } )
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
end
|
||||
@ -998,20 +1001,20 @@ do
|
||||
---
|
||||
-- @type MENU_GROUP_DELAYED
|
||||
-- @extends Core.Menu#MENU_BASE
|
||||
|
||||
|
||||
--- The MENU_GROUP_DELAYED class manages the main menus for groups.
|
||||
|
||||
|
||||
--- The MENU_GROUP_DELAYED class manages the main menus for groups.
|
||||
-- You can add menus with the @{#MENU_GROUP.New} method, which constructs a MENU_GROUP object and returns you the object reference.
|
||||
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_GROUP.Remove}.
|
||||
-- The creation of the menu item is delayed however, and must be created using the @{#MENU_GROUP.Set} method.
|
||||
-- This method is most of the time called after the "old" menu items have been removed from the sub menu.
|
||||
--
|
||||
--
|
||||
--
|
||||
-- @field #MENU_GROUP_DELAYED
|
||||
MENU_GROUP_DELAYED = {
|
||||
ClassName = "MENU_GROUP_DELAYED"
|
||||
}
|
||||
|
||||
|
||||
--- MENU_GROUP_DELAYED constructor. Creates a new radio menu item for a group.
|
||||
-- @param #MENU_GROUP_DELAYED self
|
||||
-- @param Wrapper.Group#GROUP Group The Group owning the menu.
|
||||
@ -1019,7 +1022,7 @@ do
|
||||
-- @param #table ParentMenu The parent menu.
|
||||
-- @return #MENU_GROUP_DELAYED self
|
||||
function MENU_GROUP_DELAYED:New( Group, MenuText, ParentMenu )
|
||||
|
||||
|
||||
MENU_INDEX:PrepareGroup( Group )
|
||||
local Path = MENU_INDEX:ParentPath( ParentMenu, MenuText )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( Group, Path )
|
||||
@ -1036,11 +1039,11 @@ do
|
||||
self.MenuPath = {}
|
||||
end
|
||||
table.insert( self.MenuPath, self.MenuText )
|
||||
|
||||
|
||||
self:SetParentMenu( self.MenuText, self )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
--- Refreshes a new radio item for a group and submenus
|
||||
@ -1052,7 +1055,7 @@ do
|
||||
missionCommands.addSubMenuForGroup( self.GroupID, self.MenuText, self.MenuParentPath )
|
||||
self.MenuSet = true
|
||||
end
|
||||
|
||||
|
||||
for MenuText, Menu in pairs( self.Menus or {} ) do
|
||||
Menu:Set()
|
||||
end
|
||||
@ -1066,15 +1069,15 @@ do
|
||||
do
|
||||
missionCommands.removeItemForGroup( self.GroupID, self.MenuPath )
|
||||
missionCommands.addSubMenuForGroup( self.GroupID, self.MenuText, self.MenuParentPath )
|
||||
|
||||
|
||||
for MenuText, Menu in pairs( self.Menus or {} ) do
|
||||
Menu:Refresh()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Removes the sub menus recursively of this MENU_GROUP_DELAYED.
|
||||
-- @param #MENU_GROUP_DELAYED self
|
||||
-- @param MenuStamp
|
||||
@ -1084,9 +1087,9 @@ do
|
||||
for MenuText, Menu in pairs( self.Menus or {} ) do
|
||||
Menu:Remove( MenuStamp, MenuTag )
|
||||
end
|
||||
|
||||
|
||||
self.Menus = nil
|
||||
|
||||
|
||||
end
|
||||
|
||||
--- Removes the main menu and sub menus recursively of this MENU_GROUP.
|
||||
@ -1097,7 +1100,7 @@ do
|
||||
function MENU_GROUP_DELAYED:Remove( MenuStamp, MenuTag )
|
||||
MENU_INDEX:PrepareGroup( self.Group )
|
||||
local Path = MENU_INDEX:ParentPath( self.ParentMenu, self.MenuText )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( self.Group, Path )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( self.Group, Path )
|
||||
if GroupMenu == self then
|
||||
self:RemoveSubMenus( MenuStamp, MenuTag )
|
||||
if not MenuStamp or self.MenuStamp ~= MenuStamp then
|
||||
@ -1115,16 +1118,16 @@ do
|
||||
BASE:E( { "Cannot Remove MENU_GROUP_DELAYED", Path = Path, ParentMenu = self.ParentMenu, MenuText = self.MenuText, Group = self.Group } )
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
---
|
||||
-- @type MENU_GROUP_COMMAND_DELAYED
|
||||
-- @extends Core.Menu#MENU_COMMAND_BASE
|
||||
|
||||
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||
--
|
||||
|
||||
--- Manages the command menus for coalitions, which allow players to execute functions during mission execution.
|
||||
--
|
||||
-- You can add menus with the @{#MENU_GROUP_COMMAND_DELAYED.New} method, which constructs a MENU_GROUP_COMMAND_DELAYED object and returns you the object reference.
|
||||
-- Using this object reference, you can then remove ALL the menus and submenus underlying automatically with @{#MENU_GROUP_COMMAND_DELAYED.Remove}.
|
||||
--
|
||||
@ -1132,7 +1135,7 @@ do
|
||||
MENU_GROUP_COMMAND_DELAYED = {
|
||||
ClassName = "MENU_GROUP_COMMAND_DELAYED"
|
||||
}
|
||||
|
||||
|
||||
--- Creates a new radio command item for a group
|
||||
-- @param #MENU_GROUP_COMMAND_DELAYED self
|
||||
-- @param Wrapper.Group#GROUP Group The Group owning the menu.
|
||||
@ -1144,7 +1147,7 @@ do
|
||||
function MENU_GROUP_COMMAND_DELAYED:New( Group, MenuText, ParentMenu, CommandMenuFunction, ... )
|
||||
MENU_INDEX:PrepareGroup( Group )
|
||||
local Path = MENU_INDEX:ParentPath( ParentMenu, MenuText )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( Group, Path )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( Group, Path )
|
||||
if GroupMenu then
|
||||
GroupMenu:SetCommandMenuFunction( CommandMenuFunction )
|
||||
GroupMenu:SetCommandMenuArguments( arg )
|
||||
@ -1152,17 +1155,17 @@ do
|
||||
else
|
||||
self = BASE:Inherit( self, MENU_COMMAND_BASE:New( MenuText, ParentMenu, CommandMenuFunction, arg ) )
|
||||
MENU_INDEX:SetGroupMenu( Group, Path, self )
|
||||
|
||||
|
||||
self.Group = Group
|
||||
self.GroupID = Group:GetID()
|
||||
|
||||
|
||||
if self.MenuParentPath then
|
||||
self.MenuPath = UTILS.DeepCopy( self.MenuParentPath )
|
||||
else
|
||||
self.MenuPath = {}
|
||||
end
|
||||
table.insert( self.MenuPath, self.MenuText )
|
||||
|
||||
|
||||
self:SetParentMenu( self.MenuText, self )
|
||||
return self
|
||||
end
|
||||
@ -1178,7 +1181,7 @@ do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Refreshes a radio item for a group
|
||||
-- @param #MENU_GROUP_COMMAND_DELAYED self
|
||||
-- @return #MENU_GROUP_COMMAND_DELAYED
|
||||
@ -1187,10 +1190,10 @@ do
|
||||
missionCommands.removeItemForGroup( self.GroupID, self.MenuPath )
|
||||
missionCommands.addCommandForGroup( self.GroupID, self.MenuText, self.MenuParentPath, self.MenuCallHandler )
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Removes a menu structure for a group.
|
||||
-- @param #MENU_GROUP_COMMAND_DELAYED self
|
||||
-- @param MenuStamp
|
||||
@ -1199,7 +1202,7 @@ do
|
||||
function MENU_GROUP_COMMAND_DELAYED:Remove( MenuStamp, MenuTag )
|
||||
MENU_INDEX:PrepareGroup( self.Group )
|
||||
local Path = MENU_INDEX:ParentPath( self.ParentMenu, self.MenuText )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( self.Group, Path )
|
||||
local GroupMenu = MENU_INDEX:HasGroupMenu( self.Group, Path )
|
||||
if GroupMenu == self then
|
||||
if not MenuStamp or self.MenuStamp ~= MenuStamp then
|
||||
if ( not MenuTag ) or ( MenuTag and self.MenuTag and MenuTag == self.MenuTag ) then
|
||||
@ -1215,7 +1218,7 @@ do
|
||||
else
|
||||
BASE:E( { "Cannot Remove MENU_GROUP_COMMAND_DELAYED", Path = Path, ParentMenu = self.ParentMenu, MenuText = self.MenuText, Group = self.Group } )
|
||||
end
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
end
|
||||
|
||||
@ -3076,9 +3076,25 @@ function ZONE_POLYGON:NewFromDrawing(DrawingName)
|
||||
-- points for the drawings are saved in local space, so add the object's map x and y coordinates to get
|
||||
-- world space points we can use
|
||||
for _, point in UTILS.spairs(object["points"]) do
|
||||
-- check if we want to skip adding a point
|
||||
local skip = false
|
||||
local p = {x = object["mapX"] + point["x"],
|
||||
y = object["mapY"] + point["y"] }
|
||||
table.add(points, p)
|
||||
|
||||
-- Check if the same coordinates already exist in the list, skip if they do
|
||||
-- This can happen when drawing a Polygon in Free mode, DCS adds points on
|
||||
-- top of each other that are in the `mission` file, but not visible in the
|
||||
-- Mission Editor
|
||||
for _, pt in pairs(points) do
|
||||
if pt.x == p.x and pt.y == p.y then
|
||||
skip = true
|
||||
end
|
||||
end
|
||||
|
||||
-- if it's a unique point, add it
|
||||
if not skip then
|
||||
table.add(points, p)
|
||||
end
|
||||
end
|
||||
elseif object["polygonMode"] == "rect" then
|
||||
-- the points for a rect are saved as local coordinates with an angle. To get the world space points from this
|
||||
@ -3096,6 +3112,7 @@ function ZONE_POLYGON:NewFromDrawing(DrawingName)
|
||||
|
||||
points = {p1, p2, p3, p4}
|
||||
else
|
||||
-- bring the Arrow code over from Shape/Polygon
|
||||
-- something else that might be added in the future
|
||||
end
|
||||
end
|
||||
|
||||
@ -638,7 +638,7 @@ do
|
||||
|
||||
-- TODO Version
|
||||
-- @field #string version
|
||||
self.version="0.8.16"
|
||||
self.version="0.8.17"
|
||||
self:I(string.format("***** Starting MANTIS Version %s *****", self.version))
|
||||
|
||||
--- FSM Functions ---
|
||||
@ -1264,7 +1264,7 @@ do
|
||||
end
|
||||
local friendlyset -- Core.Set#SET_GROUP
|
||||
if self.checkforfriendlies == true then
|
||||
friendlyset = SET_GROUP:New():FilterCoalitions(self.Coalition):FilterCategories({"plane","helicopter"}):FilterOnce()
|
||||
friendlyset = SET_GROUP:New():FilterCoalitions(self.Coalition):FilterCategories({"plane","helicopter"}):FilterFunction(function(grp) if grp and grp:InAir() then return true else return false end end):FilterOnce()
|
||||
end
|
||||
for _,_coord in pairs (set) do
|
||||
local coord = _coord -- get current coord to check
|
||||
|
||||
@ -1950,7 +1950,9 @@ function UTILS.GMTToLocalTimeDifference()
|
||||
elseif theatre==DCSMAP.Falklands then
|
||||
return -3 -- Fireland is UTC-3 hours.
|
||||
elseif theatre==DCSMAP.Sinai then
|
||||
return 2 -- Currently map is +2 but should be +3 (DCS bug?)
|
||||
return 2 -- Currently map is +2 but should be +3 (DCS bug?)
|
||||
elseif theatre==DCSMAP.Kola then
|
||||
return 3 -- Currently map is +2 but should be +3 (DCS bug?)
|
||||
else
|
||||
BASE:E(string.format("ERROR: Unknown Map %s in UTILS.GMTToLocal function. Returning 0", tostring(theatre)))
|
||||
return 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user