From 93fd9e5d42ff08bec87fc2ad4e3fcec7f1e64a48 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 5 Sep 2023 10:35:12 +0200 Subject: [PATCH 1/3] #CLIENTMENU * Catch error on Menu removes --- Moose Development/Moose/Core/ClientMenu.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Core/ClientMenu.lua b/Moose Development/Moose/Core/ClientMenu.lua index 1f11eebaa..458143c77 100644 --- a/Moose Development/Moose/Core/ClientMenu.lua +++ b/Moose Development/Moose/Core/ClientMenu.lua @@ -35,6 +35,7 @@ -- @field #string lid Lid for log entries -- @field #string version Version string -- @field #string name Name +-- @field #string groupname Group name -- @field #table path -- @field #table parentpath -- @field #CLIENTMENU Parent @@ -57,7 +58,7 @@ CLIENTMENU = { ClassName = "CLIENTMENUE", lid = "", - version = "0.1.0", + version = "0.1.1", name = nil, path = nil, group = nil, @@ -68,6 +69,7 @@ CLIENTMENU = { Generic = false, debug = false, Controller = nil, + groupname = nil, } --- @@ -91,6 +93,7 @@ function CLIENTMENU:NewEntry(Client,Text,Parent,Function,...) self.group = Client:GetGroup() self.client = Client self.GroupID = self.group:GetID() + self.groupname = self.group:GetName() or "Unknown Groupname" else self.Generic = true end @@ -190,7 +193,10 @@ function CLIENTMENU:RemoveF10() self:T(self.lid.."RemoveF10") if self.GroupID then --self:I(self.lid.."Removing "..table.concat(self.path,";")) - missionCommands.removeItemForGroup(self.GroupID , self.path ) + local status, err = pcall(missionCommands.removeItemForGroup(self.GroupID , self.path )) + if not status then + self:I(string.format("**** Error Removing Menu Entry %s for %s!",tostring(self.name),self.groupname)) + end end return self end From 02105b1efcfaeaa5dedf819d83ede61ccd494fa7 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 5 Sep 2023 20:53:02 +0200 Subject: [PATCH 2/3] Update Airboss.lua Fixed bug missing end in if statement --- Moose Development/Moose/Ops/Airboss.lua | 108 ++++++++++++------------ 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 56546d662..2e03496d8 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -14792,66 +14792,68 @@ function AIRBOSS:RadioTransmission( radio, call, loud, delay, interval, click, p end else + -- SRS transmission if call.subtitle ~= nil and string.len(call.subtitle) > 1 then - else - -- SRS transmission + else + -- SRS transmission - local frequency = self.MarshalRadio.frequency - local modulation = self.MarshalRadio.modulation - local voice = nil - local gender = nil - local culture = nil + local frequency = self.MarshalRadio.frequency + local modulation = self.MarshalRadio.modulation + local voice = nil + local gender = nil + local culture = nil - if radio.alias == "AIRBOSS" then - frequency = self.AirbossRadio.frequency - modulation = self.AirbossRadio.modulation - voice = self.AirbossRadio.voice - gender = self.AirbossRadio.gender - culture = self.AirbossRadio.culture + if radio.alias == "AIRBOSS" then + frequency = self.AirbossRadio.frequency + modulation = self.AirbossRadio.modulation + voice = self.AirbossRadio.voice + gender = self.AirbossRadio.gender + culture = self.AirbossRadio.culture + end + + if radio.alias == "MARSHAL" then + voice = self.MarshalRadio.voice + gender = self.MarshalRadio.gender + culture = self.MarshalRadio.culture + end + + if radio.alias == "LSO" then + frequency = self.LSORadio.frequency + modulation = self.LSORadio.modulation + voice = self.LSORadio.voice + gender = self.LSORadio.gender + culture = self.LSORadio.culture + end + + if pilotcall then + voice = self.PilotRadio.voice + gender = self.PilotRadio.gender + culture = self.PilotRadio.culture + radio.alias = "PILOT" + end + + if not radio.alias then + -- TODO - what freq to use here? + frequency = self.AirbossRadio.frequency + modulation = self.AirbossRadio.modulation + radio.alias = "AIRBOSS" + end + + local volume = nil + + if loud then + volume = 1.0 + end + + --local text = tostring(call.modexreceiver).."; "..radio.alias.."; "..call.subtitle + local text = call.subtitle + self:I(self.lid..text) + local srstext = self:_GetNiceSRSText(text) + self.SRSQ:NewTransmission(srstext, call.duration, self.SRS, tstart, 0.1, subgroups, call.subtitle, call.subduration, frequency, modulation, gender, culture, voice, volume, radio.alias) end - - if radio.alias == "MARSHAL" then - voice = self.MarshalRadio.voice - gender = self.MarshalRadio.gender - culture = self.MarshalRadio.culture - end - - if radio.alias == "LSO" then - frequency = self.LSORadio.frequency - modulation = self.LSORadio.modulation - voice = self.LSORadio.voice - gender = self.LSORadio.gender - culture = self.LSORadio.culture - end - - if pilotcall then - voice = self.PilotRadio.voice - gender = self.PilotRadio.gender - culture = self.PilotRadio.culture - radio.alias = "PILOT" - end - - if not radio.alias then - -- TODO - what freq to use here? - frequency = self.AirbossRadio.frequency - modulation = self.AirbossRadio.modulation - radio.alias = "AIRBOSS" - end - - local volume = nil - - if loud then - volume = 1.0 - end - - --local text = tostring(call.modexreceiver).."; "..radio.alias.."; "..call.subtitle - local text = call.subtitle - self:I(self.lid..text) - local srstext = self:_GetNiceSRSText(text) - self.SRSQ:NewTransmission(srstext, call.duration, self.SRS, tstart, 0.1, subgroups, call.subtitle, call.subduration, frequency, modulation, gender, culture, voice, volume, radio.alias) end end From 792222f5679b5b908ece92bdebffc29fde9036ca Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 7 Sep 2023 12:45:26 +0200 Subject: [PATCH 3/3] #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]