From b9bd8d88a91c34788d9ec146fd85fca82b48c52a Mon Sep 17 00:00:00 2001 From: Niels Vaes Date: Mon, 15 Apr 2024 08:57:28 +0200 Subject: [PATCH 1/6] Adding a new TerminalType (100)that seems to be introduced in the update that brought Muwaffaq Salti. The base has a couple of spots (like 04, 05, 06) that can only accommodate smaller type fixed wing aircraft, like the F-16, but not bigger types like the Warthog of the Strike Eagle. (#2109) Because we weren't checking for this new type, spawning in these particular spots always resulted in an airstart, because `_CheckTerminalType` would always return `false` --- Moose Development/Moose/Wrapper/Airbase.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Moose Development/Moose/Wrapper/Airbase.lua b/Moose Development/Moose/Wrapper/Airbase.lua index c58904917..715f9eabd 100644 --- a/Moose Development/Moose/Wrapper/Airbase.lua +++ b/Moose Development/Moose/Wrapper/Airbase.lua @@ -760,11 +760,13 @@ AIRBASE.Sinai = { -- @field #number OpenMedOrBig 176: Combines OpenMed and OpenBig spots. -- @field #number HelicopterUsable 216: Combines HelicopterOnly, OpenMed and OpenBig. -- @field #number FighterAircraft 244: Combines Shelter. OpenMed and OpenBig spots. So effectively all spots usable by fixed wing aircraft. +-- @field #number SmallSizeFigher 100: Tight spots for smaller type fixed wing aircraft, like the F-16. Example of these spots: 04, 05, 06 on Muwaffaq_Salti. A Viper sized plane can spawn here, but an A-10 or Strike Eagle can't AIRBASE.TerminalType = { Runway=16, HelicopterOnly=40, Shelter=68, OpenMed=72, + SmallSizeFighter=100, OpenBig=104, OpenMedOrBig=176, HelicopterUsable=216, @@ -1841,7 +1843,7 @@ function AIRBASE._CheckTerminalType(Term_Type, termtype) match=true end elseif termtype==AIRBASE.TerminalType.FighterAircraft then - if Term_Type==AIRBASE.TerminalType.OpenMed or Term_Type==AIRBASE.TerminalType.OpenBig or Term_Type==AIRBASE.TerminalType.Shelter then + if Term_Type==AIRBASE.TerminalType.OpenMed or Term_Type==AIRBASE.TerminalType.OpenBig or Term_Type==AIRBASE.TerminalType.Shelter or Term_Type==AIRBASE.TerminalType.SmallSizeFighter then match=true end end From d4a49ae68be0e756acc51e60396b6c9568d21867 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Mon, 15 Apr 2024 12:52:19 +0200 Subject: [PATCH 2/6] #CLIENTMENU/MANAGER * Attempt to avoid dual menu builds for multi-seated aircraft --- Moose Development/Moose/Core/ClientMenu.lua | 72 ++++++++++++++------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/Moose Development/Moose/Core/ClientMenu.lua b/Moose Development/Moose/Core/ClientMenu.lua index a87583be9..6071c7e4f 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: Oct 2023 +-- last change: Apr 2024 -- TODO ---------------------------------------------------------------------------------------------------------------- @@ -51,6 +51,7 @@ -- @field #boolean Generic -- @field #boolean debug -- @field #CLIENTMENUMANAGER Controller +-- @field #active boolean -- @extends Core.Base#BASE --- @@ -58,7 +59,7 @@ CLIENTMENU = { ClassName = "CLIENTMENUE", lid = "", - version = "0.1.1", + version = "0.1.2", name = nil, path = nil, group = nil, @@ -70,6 +71,7 @@ CLIENTMENU = { debug = false, Controller = nil, groupname = nil, + active = false, } --- @@ -114,7 +116,7 @@ function CLIENTMENU:NewEntry(Client,Text,Parent,Function,...) if self.Functionargs and self.debug then self:T({"Functionargs",self.Functionargs}) end - if not self.Generic then + if not self.Generic and self.active == false then if Function ~= nil then local ErrorHandler = function( errmsg ) env.info( "MOOSE Error in CLIENTMENU COMMAND function: " .. errmsg ) @@ -133,8 +135,10 @@ function CLIENTMENU:NewEntry(Client,Text,Parent,Function,...) end end self.path = missionCommands.addCommandForGroup(self.GroupID,Text,self.parentpath, self.CallHandler) + self.active = true else self.path = missionCommands.addSubMenuForGroup(self.GroupID,Text,self.parentpath) + self.active = true end else if self.parentpath then @@ -200,6 +204,7 @@ function CLIENTMENU:RemoveF10() if not status then self:I(string.format("**** Error Removing Menu Entry %s for %s!",tostring(self.name),self.groupname)) end + self.active = false end return self end @@ -302,6 +307,7 @@ end -- @field #table flattree -- @field #table rootentries -- @field #table menutree +-- @field #table SecondSeat -- @field #number entrycount -- @field #boolean debug -- @field #table PlayerMenu @@ -412,7 +418,7 @@ end CLIENTMENUMANAGER = { ClassName = "CLIENTMENUMANAGER", lid = "", - version = "0.1.4", + version = "0.1.5", name = nil, clientset = nil, menutree = {}, @@ -423,6 +429,7 @@ CLIENTMENUMANAGER = { debug = true, PlayerMenu = {}, Coalition = nil, + SecondSeat = {}, } --- Create a new ClientManager instance. @@ -676,6 +683,7 @@ end function CLIENTMENUMANAGER:Propagate(Client) self:T(self.lid.."Propagate") --self:I(UTILS.PrintTableToLog(Client,1)) + local knownunits = {} -- track so we can ID multi seated local Set = self.clientset.Set if Client then Set = {Client} @@ -684,28 +692,36 @@ function CLIENTMENUMANAGER:Propagate(Client) for _,_client in pairs(Set) do local client = _client -- Wrapper.Client#CLIENT if client and client:IsAlive() then + local playerunit = client:GetName() + local playergroup = client:GetGroup() local playername = client:GetPlayerName() or "none" - if not self.playertree[playername] then - self.playertree[playername] = {} - end - for level,branch in pairs (self.menutree) do - self:T("Building branch:" .. level) - for _,leaf in pairs(branch) do - self:T("Building leaf:" .. leaf) - local entry = self:FindEntryByUUID(leaf) - if entry then - self:T("Found generic entry:" .. entry.UUID) - local parent = nil - if entry.Parent and entry.Parent.UUID then - parent = self.playertree[playername][entry.Parent.UUID] or self:FindEntryByUUID(entry.Parent.UUID) - end - self.playertree[playername][entry.UUID] = CLIENTMENU:NewEntry(client,entry.name,parent,entry.Function,unpack(entry.Functionargs)) - self.playertree[playername][entry.UUID].Once = entry.Once - else - self:T("NO generic entry for:" .. leaf) - end - end + 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 + self.playertree[playername] = {} + end + for level,branch in pairs (self.menutree) do + self:T("Building branch:" .. level) + for _,leaf in pairs(branch) do + self:T("Building leaf:" .. leaf) + local entry = self:FindEntryByUUID(leaf) + if entry then + self:T("Found generic entry:" .. entry.UUID) + local parent = nil + if entry.Parent and entry.Parent.UUID then + parent = self.playertree[playername][entry.Parent.UUID] or self:FindEntryByUUID(entry.Parent.UUID) + end + self.playertree[playername][entry.UUID] = CLIENTMENU:NewEntry(client,entry.name,parent,entry.Function,unpack(entry.Functionargs)) + self.playertree[playername][entry.UUID].Once = entry.Once + else + self:T("NO generic entry for:" .. leaf) + end end + end end end return self @@ -719,6 +735,7 @@ end function CLIENTMENUMANAGER:AddEntry(Entry,Client) self:T(self.lid.."AddEntry") local Set = self.clientset.Set + local knownunits = {} if Client then Set = {Client} end @@ -726,6 +743,13 @@ function CLIENTMENUMANAGER:AddEntry(Entry,Client) local client = _client -- Wrapper.Client#CLIENT if client and client:IsAlive() then 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 self:T("Adding generic entry:" .. Entry.UUID) local parent = nil From 9a3effd063cea53fc4de2f2fcc0090dcfbd89a2a Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Mon, 15 Apr 2024 18:54:22 +0200 Subject: [PATCH 3/6] Docu --- Moose Development/Moose/Core/Base.lua | 2 +- Moose Development/Moose/Core/Set.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Core/Base.lua b/Moose Development/Moose/Core/Base.lua index d4851370c..3cb847f54 100644 --- a/Moose Development/Moose/Core/Base.lua +++ b/Moose Development/Moose/Core/Base.lua @@ -1153,7 +1153,7 @@ function BASE:_Serialize(Arguments) text = string.gsub(text,"(\n+)","") text = string.gsub(text,"%(%(","%(") text = string.gsub(text,"%)%)","%)") - text = string.gsub(text,"(%s+)","") + text = string.gsub(text,"(%s+)"," ") return text end diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index af0dfe661..ce3a11827 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -4388,8 +4388,8 @@ do -- SET_CLIENT return self end - --- Builds a set of CLIENTs that contain the given string in their unit/pilot name. - -- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all clients that **contain** the string. + --- Builds a set of CLIENTs that contain the given string in their **unit/pilot** name and **NOT** the group name! + -- **Attention!** Bad naming convention as this **does not** filter only **prefixes** but all clients that **contain** the string. Pattern matching applies. -- @param #SET_CLIENT self -- @param #string Prefixes The string pattern(s) that needs to be contained in the unit/pilot name. Can also be passed as a `#table` of strings. -- @return #SET_CLIENT self From 0764d076dbd29b02dc3da751eba4520ede78c8cb Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 16 Apr 2024 08:46:06 +0200 Subject: [PATCH 4/6] Housekeeping --- Moose Development/Moose/Core/ClientMenu.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Moose Development/Moose/Core/ClientMenu.lua b/Moose Development/Moose/Core/ClientMenu.lua index 6071c7e4f..bcc348814 100644 --- a/Moose Development/Moose/Core/ClientMenu.lua +++ b/Moose Development/Moose/Core/ClientMenu.lua @@ -307,7 +307,6 @@ end -- @field #table flattree -- @field #table rootentries -- @field #table menutree --- @field #table SecondSeat -- @field #number entrycount -- @field #boolean debug -- @field #table PlayerMenu @@ -418,7 +417,7 @@ end CLIENTMENUMANAGER = { ClassName = "CLIENTMENUMANAGER", lid = "", - version = "0.1.5", + version = "0.1.5a", name = nil, clientset = nil, menutree = {}, @@ -429,7 +428,6 @@ CLIENTMENUMANAGER = { debug = true, PlayerMenu = {}, Coalition = nil, - SecondSeat = {}, } --- Create a new ClientManager instance. From 743baac94525030ed37659c78bab285f49bd69ee Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 16 Apr 2024 16:01:43 +0200 Subject: [PATCH 5/6] Small fix for callsign not traversing from Squadron to Flightgroup --- Moose Development/Moose/Ops/Cohort.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Moose Development/Moose/Ops/Cohort.lua b/Moose Development/Moose/Ops/Cohort.lua index 5ed60451c..0d25c9c5d 100644 --- a/Moose Development/Moose/Ops/Cohort.lua +++ b/Moose Development/Moose/Ops/Cohort.lua @@ -505,6 +505,9 @@ end function COHORT:SetCallsign(Callsign, Index) self.callsignName=Callsign self.callsignIndex=Index + self.callsign={} + self.callsign.NumberSquad=Callsign + self.callsign.NumberGroup=Index return self end From 73bddddba40b0ed3ccbcb93c743ad825e8c394b5 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 18 Apr 2024 09:30:35 +0200 Subject: [PATCH 6/6] #CTLD - ensure extracting troops are not diverted --- Moose Development/Moose/Ops/CTLD.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index 3c4cbb563..d55132fee 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -24,7 +24,7 @@ -- @module Ops.CTLD -- @image OPS_CTLD.jpg --- Last Update March 2024 +-- Last Update April 2024 do @@ -1253,7 +1253,7 @@ CTLD.UnitTypeCapabilities = { --- CTLD class version. -- @field #string version -CTLD.version="1.0.50" +CTLD.version="1.0.51" --- Instantiate a new CTLD. -- @param #CTLD self @@ -2240,7 +2240,9 @@ end local extractdistance = self.CrateDistance * self.ExtractFactor for k,v in pairs(self.DroppedTroops) do local distance = self:_GetDistance(v:GetCoordinate(),unitcoord) - if distance <= extractdistance and distance ~= -1 then + local TNow = timer.getTime() + local vtime = v.ExtractTime or TNow-310 + if distance <= extractdistance and distance ~= -1 and (TNow - vtime > 300) then nearestGroup = v nearestGroupIndex = k nearestDistance = distance @@ -2291,9 +2293,11 @@ end end if troopsize + numberonboard > trooplimit then self:_SendMessage("Sorry, we\'re crammed already!", 10, false, Group) + nearestGroup.ExtractTime = 0 --return self else self.CargoCounter = self.CargoCounter + 1 + nearestGroup.ExtractTime = timer.GetTime() local loadcargotype = CTLD_CARGO:New(self.CargoCounter, Cargotype.Name, Cargotype.Templates, Cargotype.CargoType, true, true, Cargotype.CratesNeeded,nil,nil,Cargotype.PerCrateMass) self:T({cargotype=loadcargotype}) local running = math.floor(nearestDistance / 4)+10 -- time run to helo plus boarding