From 792222f5679b5b908ece92bdebffc29fde9036ca Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 7 Sep 2023 12:45:26 +0200 Subject: [PATCH] #PLAYERTASK, #CLIENTMENU * Fixes --- Moose Development/Moose/Core/ClientMenu.lua | 17 ++++++++++------- Moose Development/Moose/Ops/PlayerTask.lua | 15 ++++----------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/Moose Development/Moose/Core/ClientMenu.lua b/Moose Development/Moose/Core/ClientMenu.lua index 458143c77..d5ace7d9e 100644 --- a/Moose Development/Moose/Core/ClientMenu.lua +++ b/Moose Development/Moose/Core/ClientMenu.lua @@ -20,7 +20,7 @@ -- -- @module Core.ClientMenu -- @image Core_Menu.JPG --- last change: July 2023 +-- last change: Sept 2023 -- TODO ---------------------------------------------------------------------------------------------------------------- @@ -193,7 +193,10 @@ function CLIENTMENU:RemoveF10() self:T(self.lid.."RemoveF10") if self.GroupID then --self:I(self.lid.."Removing "..table.concat(self.path,";")) - local status, err = pcall(missionCommands.removeItemForGroup(self.GroupID , self.path )) + local function RemoveFunction() + return missionCommands.removeItemForGroup(self.GroupID , self.path ) + end + local status, err = pcall(RemoveFunction) if not status then self:I(string.format("**** Error Removing Menu Entry %s for %s!",tostring(self.name),self.groupname)) end @@ -477,13 +480,13 @@ function CLIENTMENUMANAGER:FindUUIDsByText(Text,Parent) for _uuid,_entry in pairs(self.flattree) do local Entry = _entry -- #CLIENTMENU if Parent then - if Entry and string.find(Entry.name,Text) and string.find(Entry.UUID,Parent.UUID) then + if Entry and string.find(Entry.name,Text,1,true) and string.find(Entry.UUID,Parent.UUID,1,true) then table.insert(matches,_uuid) table.insert(entries,Entry ) n=n+1 end else - if Entry and string.find(Entry.name,Text) then + if Entry and string.find(Entry.name,Text,1,true) then table.insert(matches,_uuid) table.insert(entries,Entry ) n=n+1 @@ -519,7 +522,7 @@ function CLIENTMENUMANAGER:FindUUIDsByParent(Parent) for _uuid,_entry in pairs(self.flattree) do local Entry = _entry -- #CLIENTMENU if Parent then - if Entry and string.find(Entry.UUID,Parent.UUID) then + if Entry and string.find(Entry.UUID,Parent.UUID,1,true) then table.insert(matches,_uuid) table.insert(entries,Entry ) n=n+1 @@ -720,7 +723,7 @@ function CLIENTMENUMANAGER:DeleteGenericEntry(Entry) --self:I("Level = "..i) for _id,_uuid in pairs(tbl[i]) do self:T(_uuid) - if string.find(_uuid,uuid) or _uuid == uuid then + if string.find(_uuid,uuid,1,true) or _uuid == uuid then --self:I("Match for ".._uuid) self.menutree[i][_id] = nil self.flattree[_uuid] = nil @@ -749,7 +752,7 @@ function CLIENTMENUMANAGER:RemoveGenericSubEntries(Entry) self:T("Level = "..i) for _id,_uuid in pairs(tbl[i]) do self:T(_uuid) - if string.find(_uuid,uuid) then + if string.find(_uuid,uuid,1,true) then self:T("Match for ".._uuid) self.menutree[i][_id] = nil self.flattree[_uuid] = nil diff --git a/Moose Development/Moose/Ops/PlayerTask.lua b/Moose Development/Moose/Ops/PlayerTask.lua index f91893c7e..190bc8976 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 July 2023 +-- @date Last Update Sept 2023 do @@ -1551,7 +1551,7 @@ PLAYERTASKCONTROLLER.Messages = { --- PLAYERTASK class version. -- @field #string version -PLAYERTASKCONTROLLER.version="0.1.60a" +PLAYERTASKCONTROLLER.version="0.1.61" --- Create and run a new TASKCONTROLLER instance. -- @param #PLAYERTASKCONTROLLER self @@ -2503,7 +2503,8 @@ function PLAYERTASKCONTROLLER:_CheckTaskQueue() end end local TNow = timer.getAbsTime() - if TNow - task.timestamp > 10 then + if TNow - task.timestamp > 5 then + self:_RemoveMenuEntriesForTask(task) local task = self.TaskQueue:PullByID(_id) -- Ops.PlayerTask#PLAYERTASK task = nil end @@ -3516,13 +3517,6 @@ function PLAYERTASKCONTROLLER:_UpdateJoinMenuTemplate() if _task.InMenu then self:T("**** Task already in Menu ".._task.Target:GetName()) else - --local pilotcount = _task:CountClients() - --local newtext = "]" - --local tnow = timer.getTime() - -- marker for new tasks - --if tnow - _task.timestamp < 60 then - --newtext = "*]" - --end local menutaskno = self.gettext:GetEntry("MENUTASKNO",self.locale) --local text = string.format("%s %03d [%d%s",menutaskno,_task.PlayerTaskNr,pilotcount,newtext) local text = string.format("%s %03d",menutaskno,_task.PlayerTaskNr) @@ -3533,7 +3527,6 @@ function PLAYERTASKCONTROLLER:_UpdateJoinMenuTemplate() text = string.format("%s (%03d)",name,_task.PlayerTaskNr) end end - --local taskentry = MENU_GROUP_COMMAND:New(group,text,ttypes[_tasktype],self._JoinTask,self,group,client,_task):SetTag(newtag) local parenttable, number = controller:FindEntriesByText(_tasktype,JoinMenu) if number > 0 then local Parent = parenttable[1]