#PLAYERTASK, #CLIENTMENU

* Fixes
This commit is contained in:
Applevangelist 2023-09-07 12:45:26 +02:00
parent 93fd9e5d42
commit 792222f567
2 changed files with 14 additions and 18 deletions

View File

@ -20,7 +20,7 @@
-- --
-- @module Core.ClientMenu -- @module Core.ClientMenu
-- @image Core_Menu.JPG -- @image Core_Menu.JPG
-- last change: July 2023 -- last change: Sept 2023
-- TODO -- TODO
---------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------
@ -193,7 +193,10 @@ function CLIENTMENU:RemoveF10()
self:T(self.lid.."RemoveF10") self:T(self.lid.."RemoveF10")
if self.GroupID then if self.GroupID then
--self:I(self.lid.."Removing "..table.concat(self.path,";")) --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 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
@ -477,13 +480,13 @@ function CLIENTMENUMANAGER:FindUUIDsByText(Text,Parent)
for _uuid,_entry in pairs(self.flattree) do for _uuid,_entry in pairs(self.flattree) do
local Entry = _entry -- #CLIENTMENU local Entry = _entry -- #CLIENTMENU
if Parent then 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(matches,_uuid)
table.insert(entries,Entry ) table.insert(entries,Entry )
n=n+1 n=n+1
end end
else 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(matches,_uuid)
table.insert(entries,Entry ) table.insert(entries,Entry )
n=n+1 n=n+1
@ -519,7 +522,7 @@ function CLIENTMENUMANAGER:FindUUIDsByParent(Parent)
for _uuid,_entry in pairs(self.flattree) do for _uuid,_entry in pairs(self.flattree) do
local Entry = _entry -- #CLIENTMENU local Entry = _entry -- #CLIENTMENU
if Parent then 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(matches,_uuid)
table.insert(entries,Entry ) table.insert(entries,Entry )
n=n+1 n=n+1
@ -720,7 +723,7 @@ function CLIENTMENUMANAGER:DeleteGenericEntry(Entry)
--self:I("Level = "..i) --self:I("Level = "..i)
for _id,_uuid in pairs(tbl[i]) do for _id,_uuid in pairs(tbl[i]) do
self:T(_uuid) 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:I("Match for ".._uuid)
self.menutree[i][_id] = nil self.menutree[i][_id] = nil
self.flattree[_uuid] = nil self.flattree[_uuid] = nil
@ -749,7 +752,7 @@ function CLIENTMENUMANAGER:RemoveGenericSubEntries(Entry)
self:T("Level = "..i) self:T("Level = "..i)
for _id,_uuid in pairs(tbl[i]) do for _id,_uuid in pairs(tbl[i]) do
self:T(_uuid) self:T(_uuid)
if string.find(_uuid,uuid) then if string.find(_uuid,uuid,1,true) then
self:T("Match for ".._uuid) self:T("Match for ".._uuid)
self.menutree[i][_id] = nil self.menutree[i][_id] = nil
self.flattree[_uuid] = nil self.flattree[_uuid] = nil

View File

@ -21,7 +21,7 @@
-- === -- ===
-- @module Ops.PlayerTask -- @module Ops.PlayerTask
-- @image OPS_PlayerTask.jpg -- @image OPS_PlayerTask.jpg
-- @date Last Update July 2023 -- @date Last Update Sept 2023
do do
@ -1551,7 +1551,7 @@ PLAYERTASKCONTROLLER.Messages = {
--- PLAYERTASK class version. --- PLAYERTASK class version.
-- @field #string version -- @field #string version
PLAYERTASKCONTROLLER.version="0.1.60a" PLAYERTASKCONTROLLER.version="0.1.61"
--- Create and run a new TASKCONTROLLER instance. --- Create and run a new TASKCONTROLLER instance.
-- @param #PLAYERTASKCONTROLLER self -- @param #PLAYERTASKCONTROLLER self
@ -2503,7 +2503,8 @@ function PLAYERTASKCONTROLLER:_CheckTaskQueue()
end end
end end
local TNow = timer.getAbsTime() 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 local task = self.TaskQueue:PullByID(_id) -- Ops.PlayerTask#PLAYERTASK
task = nil task = nil
end end
@ -3516,13 +3517,6 @@ function PLAYERTASKCONTROLLER:_UpdateJoinMenuTemplate()
if _task.InMenu then if _task.InMenu then
self:T("**** Task already in Menu ".._task.Target:GetName()) self:T("**** Task already in Menu ".._task.Target:GetName())
else 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 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 [%d%s",menutaskno,_task.PlayerTaskNr,pilotcount,newtext)
local text = string.format("%s %03d",menutaskno,_task.PlayerTaskNr) local text = string.format("%s %03d",menutaskno,_task.PlayerTaskNr)
@ -3533,7 +3527,6 @@ function PLAYERTASKCONTROLLER:_UpdateJoinMenuTemplate()
text = string.format("%s (%03d)",name,_task.PlayerTaskNr) text = string.format("%s (%03d)",name,_task.PlayerTaskNr)
end end
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) local parenttable, number = controller:FindEntriesByText(_tasktype,JoinMenu)
if number > 0 then if number > 0 then
local Parent = parenttable[1] local Parent = parenttable[1]