From ac386d5ebefe8e0d92a79c50d3c4bebcbc9ee480 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Thu, 22 Jun 2023 09:34:02 +0200 Subject: [PATCH 1/3] #AIRBOSS * Bug fix --- Moose Development/Moose/Ops/Airboss.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 3cc61f949..005f5b614 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -10266,7 +10266,7 @@ function AIRBOSS:_GetSternCoord() elseif case==2 or case==1 then -- V/Stol: Translate 8 meters port. self.sterncoord:Translate(self.carrierparam.sterndist, hdg, true, true):Translate(8, FB-90, true, true) - end + end elseif self.carriertype==AIRBOSS.CarrierType.STENNIS then -- Stennis: translate 7 meters starboard wrt Final bearing. self.sterncoord:Translate( self.carrierparam.sterndist, hdg, true, true ):Translate( 7, FB + 90, true, true ) @@ -11585,7 +11585,13 @@ function AIRBOSS:GetHeadingIntoWind( magnetic, coord ) end -- Get direction the wind is blowing from. This is where we want to go. - local windfrom, vwind = self:GetWind( nil, nil, coord ) + adjustDegreesForWindSpeed(vwind) + local windfrom, vwind = self:GetWind( nil, nil, coord ) + + --self:I("windfrom="..windfrom.." vwind="..vwind) + + vwind = vwind + adjustDegreesForWindSpeed(vwind) + + --self:I("windfrom="..windfrom.." (c)vwind="..vwind) -- Actually, we want the runway in the wind. local intowind = windfrom - self.carrierparam.rwyangle @@ -17348,7 +17354,7 @@ function AIRBOSS:_DisplayCarrierInfo( _unitname ) state = "Deck closed" end if self.turning then - state = state .. " (turning currently)" + state = state .. " (currently turning)" end -- Message text. From 08be2d6e93e3269f6f9aa74101f16d6d5ee01d88 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Thu, 22 Jun 2023 13:49:21 +0200 Subject: [PATCH 2/3] CTLD (#1967) (#1968) * Added option for troops subcategories in menu --- Moose Development/Moose/Ops/CTLD.lua | 42 +++++++++++++++++++++------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index 298f7b1dd..7e79bdbc8 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -204,7 +204,7 @@ CTLD_CARGO = { -- @param #CTLD_CARGO self -- @param #boolean loaded function CTLD_CARGO:Isloaded() - if self.HasBeenMoved and not self.WasDropped() then + if self.HasBeenMoved and not self:WasDropped() then return true else return false @@ -1221,7 +1221,7 @@ CTLD.UnitTypes = { --- CTLD class version. -- @field #string version -CTLD.version="1.0.39" +CTLD.version="1.0.40" --- Instantiate a new CTLD. -- @param #CTLD self @@ -1390,6 +1390,7 @@ function CTLD:New(Coalition, Prefixes, Alias) -- sub categories self.usesubcats = false self.subcats = {} + self.subcatsTroop = {} -- disallow building in loadzones self.nobuildinloadzones = true @@ -2279,6 +2280,7 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop) if not drop then inzone = self:IsUnitInZone(Unit,CTLD.CargoZoneType.LOAD) if not inzone then +---@diagnostic disable-next-line: cast-local-type inzone, ship, zone, distance, width = self:IsUnitInZone(Unit,CTLD.CargoZoneType.SHIP) end else @@ -3468,6 +3470,12 @@ function CTLD:_RefreshF10Menus() self.subcats[entry.Subcategory] = entry.Subcategory end end + for _id,_cargo in pairs(self.Cargo_Troops) do + local entry = _cargo -- #CTLD_CARGO + if not self.subcatsTroop[entry.Subcategory] then + self.subcatsTroop[entry.Subcategory] = entry.Subcategory + end + end end -- build unit menus @@ -3504,15 +3512,28 @@ function CTLD:_RefreshF10Menus() local beaconself = MENU_GROUP_COMMAND:New(_group,"Drop beacon now",smoketopmenu, self.DropBeaconNow, self, _unit):Refresh() -- sub menus -- sub menu troops management - if cantroops then + if cantroops then local troopsmenu = MENU_GROUP:New(_group,"Load troops",toptroops) - for _,_entry in pairs(self.Cargo_Troops) do - local entry = _entry -- #CTLD_CARGO - menucount = menucount + 1 - menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,troopsmenu,self._LoadTroops, self, _group, _unit, entry) + if self.usesubcats then + local subcatmenus = {} + for _name,_entry in pairs(self.subcatsTroop) do + subcatmenus[_name] = MENU_GROUP:New(_group,_name,troopsmenu) + end + for _,_entry in pairs(self.Cargo_Troops) do + local entry = _entry -- #CTLD_CARGO + local subcat = entry.Subcategory + menucount = menucount + 1 + menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,subcatmenus[subcat],self._LoadTroops, self, _group, _unit, entry) + end + else + for _,_entry in pairs(self.Cargo_Troops) do + local entry = _entry -- #CTLD_CARGO + menucount = menucount + 1 + menus[menucount] = MENU_GROUP_COMMAND:New(_group,entry.Name,troopsmenu,self._LoadTroops, self, _group, _unit, entry) + end end local unloadmenu1 = MENU_GROUP_COMMAND:New(_group,"Drop troops",toptroops, self._UnloadTroops, self, _group, _unit):Refresh() - local extractMenu1 = MENU_GROUP_COMMAND:New(_group, "Extract troops", toptroops, self._ExtractTroops, self, _group, _unit):Refresh() + local extractMenu1 = MENU_GROUP_COMMAND:New(_group, "Extract troops", toptroops, self._ExtractTroops, self, _group, _unit):Refresh() end -- sub menu crates management if cancrates then @@ -3603,7 +3624,8 @@ end -- @param #number NoTroops Size of the group in number of Units across combined templates (for loading). -- @param #number PerTroopMass Mass in kg of each soldier -- @param #number Stock Number of groups in stock. Nil for unlimited. -function CTLD:AddTroopsCargo(Name,Templates,Type,NoTroops,PerTroopMass,Stock) +-- @param #string SubCategory Name of sub-category (optional). +function CTLD:AddTroopsCargo(Name,Templates,Type,NoTroops,PerTroopMass,Stock,SubCategory) self:T(self.lid .. " AddTroopsCargo") self:T({Name,Templates,Type,NoTroops,PerTroopMass,Stock}) if not self:_CheckTemplates(Templates) then @@ -3612,7 +3634,7 @@ function CTLD:AddTroopsCargo(Name,Templates,Type,NoTroops,PerTroopMass,Stock) end self.CargoCounter = self.CargoCounter + 1 -- Troops are directly loadable - local cargo = CTLD_CARGO:New(self.CargoCounter,Name,Templates,Type,false,true,NoTroops,nil,nil,PerTroopMass,Stock) + local cargo = CTLD_CARGO:New(self.CargoCounter,Name,Templates,Type,false,true,NoTroops,nil,nil,PerTroopMass,Stock, SubCategory) table.insert(self.Cargo_Troops,cargo) return self end From 0dab316514cbe4c0f19b78fe4803645182413b92 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Mon, 26 Jun 2023 13:29:34 +0200 Subject: [PATCH 3/3] Point - BRAANATO (#1969) (#1970) corrected Track to be direction of travel of bogey (self in this case) --- Moose Development/Moose/Core/Point.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/Core/Point.lua b/Moose Development/Moose/Core/Point.lua index d942e49ba..e699af694 100644 --- a/Moose Development/Moose/Core/Point.lua +++ b/Moose Development/Moose/Core/Point.lua @@ -2944,8 +2944,13 @@ do -- COORDINATE if alt < 1 then alttext = "very low" end - - local track = UTILS.BearingToCardinal(bearing) or "North" + + -- corrected Track to be direction of travel of bogey (self in this case) + local track = "Maneuver" + + if self.Heading then + track = UTILS.BearingToCardinal(self.Heading) or "North" + end if rangeNM > 3 then if SSML then -- google says "oh" instead of zero, be aware