mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
xxx
This commit is contained in:
parent
be85aab755
commit
b9cb6dbffb
@ -20,7 +20,7 @@
|
|||||||
--
|
--
|
||||||
-- @module Core.ClientMenu
|
-- @module Core.ClientMenu
|
||||||
-- @image Core_Menu.JPG
|
-- @image Core_Menu.JPG
|
||||||
-- last change: Oct 2023
|
-- last change: Apr 2024
|
||||||
|
|
||||||
-- TODO
|
-- TODO
|
||||||
----------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------
|
||||||
@ -51,6 +51,7 @@
|
|||||||
-- @field #boolean Generic
|
-- @field #boolean Generic
|
||||||
-- @field #boolean debug
|
-- @field #boolean debug
|
||||||
-- @field #CLIENTMENUMANAGER Controller
|
-- @field #CLIENTMENUMANAGER Controller
|
||||||
|
-- @field #active boolean
|
||||||
-- @extends Core.Base#BASE
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -58,7 +59,7 @@
|
|||||||
CLIENTMENU = {
|
CLIENTMENU = {
|
||||||
ClassName = "CLIENTMENUE",
|
ClassName = "CLIENTMENUE",
|
||||||
lid = "",
|
lid = "",
|
||||||
version = "0.1.1",
|
version = "0.1.2",
|
||||||
name = nil,
|
name = nil,
|
||||||
path = nil,
|
path = nil,
|
||||||
group = nil,
|
group = nil,
|
||||||
@ -70,6 +71,7 @@ CLIENTMENU = {
|
|||||||
debug = false,
|
debug = false,
|
||||||
Controller = nil,
|
Controller = nil,
|
||||||
groupname = nil,
|
groupname = nil,
|
||||||
|
active = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -114,7 +116,7 @@ function CLIENTMENU:NewEntry(Client,Text,Parent,Function,...)
|
|||||||
if self.Functionargs and self.debug then
|
if self.Functionargs and self.debug then
|
||||||
self:T({"Functionargs",self.Functionargs})
|
self:T({"Functionargs",self.Functionargs})
|
||||||
end
|
end
|
||||||
if not self.Generic then
|
if not self.Generic and self.active == false then
|
||||||
if Function ~= nil then
|
if Function ~= nil then
|
||||||
local ErrorHandler = function( errmsg )
|
local ErrorHandler = function( errmsg )
|
||||||
env.info( "MOOSE Error in CLIENTMENU COMMAND function: " .. errmsg )
|
env.info( "MOOSE Error in CLIENTMENU COMMAND function: " .. errmsg )
|
||||||
@ -133,8 +135,10 @@ function CLIENTMENU:NewEntry(Client,Text,Parent,Function,...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.path = missionCommands.addCommandForGroup(self.GroupID,Text,self.parentpath, self.CallHandler)
|
self.path = missionCommands.addCommandForGroup(self.GroupID,Text,self.parentpath, self.CallHandler)
|
||||||
|
self.active = true
|
||||||
else
|
else
|
||||||
self.path = missionCommands.addSubMenuForGroup(self.GroupID,Text,self.parentpath)
|
self.path = missionCommands.addSubMenuForGroup(self.GroupID,Text,self.parentpath)
|
||||||
|
self.active = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if self.parentpath then
|
if self.parentpath then
|
||||||
@ -200,6 +204,7 @@ function CLIENTMENU:RemoveF10()
|
|||||||
if not status then
|
if not status then
|
||||||
self:I(string.format("**** Error Removing Menu Entry %s for %s!",tostring(self.name),self.groupname))
|
self:I(string.format("**** Error Removing Menu Entry %s for %s!",tostring(self.name),self.groupname))
|
||||||
end
|
end
|
||||||
|
self.active = false
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -302,6 +307,7 @@ end
|
|||||||
-- @field #table flattree
|
-- @field #table flattree
|
||||||
-- @field #table rootentries
|
-- @field #table rootentries
|
||||||
-- @field #table menutree
|
-- @field #table menutree
|
||||||
|
-- @field #table SecondSeat
|
||||||
-- @field #number entrycount
|
-- @field #number entrycount
|
||||||
-- @field #boolean debug
|
-- @field #boolean debug
|
||||||
-- @field #table PlayerMenu
|
-- @field #table PlayerMenu
|
||||||
@ -412,7 +418,7 @@ end
|
|||||||
CLIENTMENUMANAGER = {
|
CLIENTMENUMANAGER = {
|
||||||
ClassName = "CLIENTMENUMANAGER",
|
ClassName = "CLIENTMENUMANAGER",
|
||||||
lid = "",
|
lid = "",
|
||||||
version = "0.1.4",
|
version = "0.1.5",
|
||||||
name = nil,
|
name = nil,
|
||||||
clientset = nil,
|
clientset = nil,
|
||||||
menutree = {},
|
menutree = {},
|
||||||
@ -423,6 +429,7 @@ CLIENTMENUMANAGER = {
|
|||||||
debug = true,
|
debug = true,
|
||||||
PlayerMenu = {},
|
PlayerMenu = {},
|
||||||
Coalition = nil,
|
Coalition = nil,
|
||||||
|
SecondSeat = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Create a new ClientManager instance.
|
--- Create a new ClientManager instance.
|
||||||
@ -676,6 +683,7 @@ end
|
|||||||
function CLIENTMENUMANAGER:Propagate(Client)
|
function CLIENTMENUMANAGER:Propagate(Client)
|
||||||
self:T(self.lid.."Propagate")
|
self:T(self.lid.."Propagate")
|
||||||
--self:I(UTILS.PrintTableToLog(Client,1))
|
--self:I(UTILS.PrintTableToLog(Client,1))
|
||||||
|
local knownunits = {} -- track so we can ID multi seated
|
||||||
local Set = self.clientset.Set
|
local Set = self.clientset.Set
|
||||||
if Client then
|
if Client then
|
||||||
Set = {Client}
|
Set = {Client}
|
||||||
@ -684,7 +692,15 @@ function CLIENTMENUMANAGER:Propagate(Client)
|
|||||||
for _,_client in pairs(Set) do
|
for _,_client in pairs(Set) do
|
||||||
local client = _client -- Wrapper.Client#CLIENT
|
local client = _client -- Wrapper.Client#CLIENT
|
||||||
if client and client:IsAlive() then
|
if client and client:IsAlive() then
|
||||||
|
local playerunit = client:GetName()
|
||||||
|
local playergroup = client:GetGroup()
|
||||||
local playername = client:GetPlayerName() or "none"
|
local playername = client:GetPlayerName() or "none"
|
||||||
|
if not knownunits[playerunit] then
|
||||||
|
knownunits[playerunit] = true
|
||||||
|
else
|
||||||
|
self:I("Player in multi seat unit: "..playername)
|
||||||
|
break -- multi seat already build
|
||||||
|
end
|
||||||
if not self.playertree[playername] then
|
if not self.playertree[playername] then
|
||||||
self.playertree[playername] = {}
|
self.playertree[playername] = {}
|
||||||
end
|
end
|
||||||
@ -719,6 +735,7 @@ end
|
|||||||
function CLIENTMENUMANAGER:AddEntry(Entry,Client)
|
function CLIENTMENUMANAGER:AddEntry(Entry,Client)
|
||||||
self:T(self.lid.."AddEntry")
|
self:T(self.lid.."AddEntry")
|
||||||
local Set = self.clientset.Set
|
local Set = self.clientset.Set
|
||||||
|
local knownunits = {}
|
||||||
if Client then
|
if Client then
|
||||||
Set = {Client}
|
Set = {Client}
|
||||||
end
|
end
|
||||||
@ -726,6 +743,13 @@ function CLIENTMENUMANAGER:AddEntry(Entry,Client)
|
|||||||
local client = _client -- Wrapper.Client#CLIENT
|
local client = _client -- Wrapper.Client#CLIENT
|
||||||
if client and client:IsAlive() then
|
if client and client:IsAlive() then
|
||||||
local playername = client:GetPlayerName()
|
local playername = client:GetPlayerName()
|
||||||
|
local unitname = client:GetName()
|
||||||
|
if not knownunits[unitname] then
|
||||||
|
knownunits[unitname] = true
|
||||||
|
else
|
||||||
|
self:I("Player in multi seat unit: "..playername)
|
||||||
|
break
|
||||||
|
end
|
||||||
if Entry then
|
if Entry then
|
||||||
self:T("Adding generic entry:" .. Entry.UUID)
|
self:T("Adding generic entry:" .. Entry.UUID)
|
||||||
local parent = nil
|
local parent = nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user