From 4307ddcad379150951e4aa7a4d15aeba6146fa9b Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 4 Feb 2024 13:13:06 +0100 Subject: [PATCH 1/2] CLIENTMENUMANAGER - dicu --- Moose Development/Moose/Core/ClientMenu.lua | 24 +++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Core/ClientMenu.lua b/Moose Development/Moose/Core/ClientMenu.lua index 525b3533d..a87583be9 100644 --- a/Moose Development/Moose/Core/ClientMenu.lua +++ b/Moose Development/Moose/Core/ClientMenu.lua @@ -78,7 +78,7 @@ CLIENTMENU_ID = 0 --- Create an new CLIENTMENU object. -- @param #CLIENTMENU self --- @param Wrapper.Client#CLIENT Client The client for whom this entry is. +-- @param Wrapper.Client#CLIENT Client The client for whom this entry is. Leave as nil for a generic entry. -- @param #string Text Text of the F10 menu entry. -- @param #CLIENTMENU Parent The parent menu entry. -- @param #string Function (optional) Function to call when the entry is used. @@ -324,6 +324,22 @@ end -- -- Many functions can either change the tree for one client or for all clients. -- +-- ## Conceptual remarks +-- +-- There's a couple of things to fully understand: +-- +-- 1) **CLIENTMENUMANAGER** manages a set of entries from **CLIENTMENU**, it's main purpose is to administer the *shadow menu tree*, ie. a menu structure which is not +-- (yet) visible to any client +-- 2) The entries are **CLIENTMENU** objects, which are linked in a tree form. There's two ways to create them: +-- A) in the manager with ":NewEntry()" which initially +-- adds it to the shadow menu **only** +-- B) stand-alone directly as `CLIENTMENU:NewEntry()` - here it depends on whether or not you gave a CLIENT object if the entry is created as generic entry or pushed +-- a **specific** client. **Be aware** though that the entries are not managed by the CLIENTMANAGER before the next step! +-- A generic entry can be added to the manager (and the shadow tree) with `:AddEntry()` - this will also push it to all clients(!) if no client is given, or a specific client only. +-- 3) Pushing only works for alive clients. +-- 4) Live and shadow tree entries are managed via the CLIENTMENUMANAGER object. +-- 5) `Propagate()`refreshes the menu tree for all, or a single client. +-- -- ## Create a base reference tree and send to all clients -- -- local clientset = SET_CLIENT:New():FilterStart() @@ -492,7 +508,7 @@ function CLIENTMENUMANAGER:_EventHandler(EventData) return self end ---- Set this Client Manager to auto-propagate menus to newly joined players. Useful if you have **one** menu structure only. +--- Set this Client Manager to auto-propagate menus **once** to newly joined players. Useful if you have **one** menu structure only. Does not automatically push follow-up changes to the client(s). -- @param #CLIENTMENUMANAGER self -- @return #CLIENTMENUMANAGER self function CLIENTMENUMANAGER:InitAutoPropagation() @@ -507,7 +523,7 @@ function CLIENTMENUMANAGER:InitAutoPropagation() return self end ---- Create a new entry in the generic structure. +--- Create a new entry in the **generic** structure. -- @param #CLIENTMENUMANAGER self -- @param #string Text Text of the F10 menu entry. -- @param #CLIENTMENU Parent The parent menu entry. @@ -695,7 +711,7 @@ function CLIENTMENUMANAGER:Propagate(Client) return self end ---- Push a single previously created entry into the menu structure of all clients. +--- Push a single previously created entry into the F10 menu structure of all clients. -- @param #CLIENTMENUMANAGER self -- @param #CLIENTMENU Entry The entry to add. -- @param Wrapper.Client#CLIENT Client (optional) If given, make this change only for this client. From df0dbc9108598eeba4b854b0ee4751d8d97791f4 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 8 Feb 2024 11:59:23 +0100 Subject: [PATCH 2/2] PLAYERTASK - small fix for a possibly missing coordinate --- Moose Development/Moose/Ops/PlayerTask.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index 643355ed8..e0c7f8c60 100644 --- a/Moose Development/Moose/Ops/PlayerTask.lua +++ b/Moose Development/Moose/Ops/PlayerTask.lua @@ -21,7 +21,7 @@ -- === -- @module Ops.PlayerTask -- @image OPS_PlayerTask.jpg --- @date Last Update Jan 2024 +-- @date Last Update Feb 2024 do @@ -411,6 +411,15 @@ function PLAYERTASK:IsDone() return IsDone end +--- [User] Check if PLAYERTASK has clients assigned to it. +-- @param #PLAYERTASK self +-- @return #boolean hasclients +function PLAYERTASK:HasClients() + self:T(self.lid.."HasClients?") + local hasclients = self:CountClients() > 0 and true or false + return hasclients +end + --- [User] Get client names assigned as table of #strings -- @param #PLAYERTASK self -- @return #table clients @@ -1552,7 +1561,7 @@ PLAYERTASKCONTROLLER.Messages = { --- PLAYERTASK class version. -- @field #string version -PLAYERTASKCONTROLLER.version="0.1.64" +PLAYERTASKCONTROLLER.version="0.1.65" --- Create and run a new TASKCONTROLLER instance. -- @param #PLAYERTASKCONTROLLER self @@ -3173,7 +3182,7 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Task, Group, Client) local ttsname = self.gettext:GetEntry("TASKNAMETTS",self.locale) local taskname = string.format(tname,task.Type,task.PlayerTaskNr) local ttstaskname = string.format(ttsname,task.TTSType,task.PlayerTaskNr) - local Coordinate = task.Target:GetCoordinate() + local Coordinate = task.Target:GetCoordinate() or COORDINATE:New(0,0,0) local CoordText = "" local CoordTextLLDM = nil if self.Type ~= PLAYERTASKCONTROLLER.Type.A2A then