From 5fcd394dddfb2341443887ab8bed7983e40deb9c Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 15 Jun 2024 08:11:14 +0200 Subject: [PATCH 1/3] Update CSAR.lua Kiowa type name --- Moose Development/Moose/Ops/CSAR.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/CSAR.lua b/Moose Development/Moose/Ops/CSAR.lua index 9867523e5..7b716ed5c 100644 --- a/Moose Development/Moose/Ops/CSAR.lua +++ b/Moose Development/Moose/Ops/CSAR.lua @@ -292,7 +292,7 @@ CSAR.AircraftType["AH-64D_BLK_II"] = 2 CSAR.AircraftType["Bronco-OV-10A"] = 2 CSAR.AircraftType["MH-60R"] = 10 CSAR.AircraftType["OH-6A"] = 2 -CSAR.AircraftType["OH-58D"] = 2 +CSAR.AircraftType["OH58D"] = 2 --- CSAR class version. -- @field #string version From 2d1fcb9be8bc73ebe983c56f7c4d628ac90f97b9 Mon Sep 17 00:00:00 2001 From: Thomas <72444570+Applevangelist@users.noreply.github.com> Date: Sat, 15 Jun 2024 08:12:54 +0200 Subject: [PATCH 2/3] Update CTLD.lua --- Moose Development/Moose/Ops/CTLD.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Moose Development/Moose/Ops/CTLD.lua b/Moose Development/Moose/Ops/CTLD.lua index da51b1e5a..037446ea4 100644 --- a/Moose Development/Moose/Ops/CTLD.lua +++ b/Moose Development/Moose/Ops/CTLD.lua @@ -1250,7 +1250,7 @@ CTLD.UnitTypeCapabilities = { ["AH-64D_BLK_II"] = {type="AH-64D_BLK_II", crates=false, troops=true, cratelimit = 0, trooplimit = 2, length = 17, cargoweightlimit = 200}, -- 2 ppl **outside** the helo ["Bronco-OV-10A"] = {type="Bronco-OV-10A", crates= false, troops=true, cratelimit = 0, trooplimit = 5, length = 13, cargoweightlimit = 1450}, ["OH-6A"] = {type="OH-6A", crates=false, troops=true, cratelimit = 0, trooplimit = 4, length = 7, cargoweightlimit = 550}, - ["OH-58D"] = {type="OH-58D", crates=false, troops=false, cratelimit = 0, trooplimit = 0, length = 14, cargoweightlimit = 400}, + ["OH58D"] = {type="OH58D", crates=false, troops=false, cratelimit = 0, trooplimit = 0, length = 14, cargoweightlimit = 400}, } --- CTLD class version. From 5f9d4405b1944551eeb3984b0741ec3f9a8b55ad Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 18 Jun 2024 09:20:59 +0200 Subject: [PATCH 3/3] AIRBOSS - Added case that group template cannot be found in MOOSE db --- Moose Development/Moose/Core/Database.lua | 11 +++-- Moose Development/Moose/Ops/Airboss.lua | 59 ++++++++++++++++------- Moose Development/Moose/Wrapper/Group.lua | 8 ++- 3 files changed, 54 insertions(+), 24 deletions(-) diff --git a/Moose Development/Moose/Core/Database.lua b/Moose Development/Moose/Core/Database.lua index 8f031fdd0..db54e8dc2 100644 --- a/Moose Development/Moose/Core/Database.lua +++ b/Moose Development/Moose/Core/Database.lua @@ -1147,10 +1147,13 @@ end -- @param #string GroupName Group name. -- @return #table Group template table. function DATABASE:GetGroupTemplate( GroupName ) - local GroupTemplate = self.Templates.Groups[GroupName].Template - GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID - GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID - GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID + local GroupTemplate=nil + if self.Templates.Groups[GroupName] then + GroupTemplate = self.Templates.Groups[GroupName].Template + GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID + GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID + GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID + end return GroupTemplate end diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index 13ec474c9..6d67eb0a3 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -14365,32 +14365,55 @@ function AIRBOSS:_GetOnboardNumbers( group, playeronly ) -- Debug text. local text = string.format( "Onboard numbers of group %s:", groupname ) - -- Units of template group. - local units = group:GetTemplate().units + local template=group:GetTemplate() - -- Get numbers. local numbers = {} - for _, unit in pairs( units ) do + if template then - -- Onboard number and unit name. - local n = tostring( unit.onboard_num ) - local name = unit.name - local skill = unit.skill or "Unknown" + -- Units of template group. + local units = template.units - -- Debug text. - text = text .. string.format( "\n- unit %s: onboard #=%s skill=%s", name, n, tostring( skill ) ) + -- Get numbers. + for _, unit in pairs( units ) do - if playeronly and skill == "Client" or skill == "Player" then - -- There can be only one player in the group, so we skip everything else. - return n + -- Onboard number and unit name. + local n = tostring( unit.onboard_num ) + local name = unit.name + local skill = unit.skill or "Unknown" + + -- Debug text. + text = text .. string.format( "\n- unit %s: onboard #=%s skill=%s", name, n, tostring( skill ) ) + + if playeronly and skill == "Client" or skill == "Player" then + -- There can be only one player in the group, so we skip everything else. + return n + end + + -- Table entry. + numbers[name] = n end - -- Table entry. - numbers[name] = n - end + -- Debug info. + self:T2( self.lid .. text ) - -- Debug info. - self:T2( self.lid .. text ) + else + + if playeronly then + return 101 + else + + local units=group:GetUnits() + + for i,_unit in pairs(units) do + local name=_unit:GetName() + + numbers[name]=100+i + + end + + end + + end return numbers end diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index 4f214c7bf..5122d2b9c 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -1775,10 +1775,14 @@ end --- Returns the group template from the global _DATABASE object (an instance of @{Core.Database#DATABASE}). -- @param #GROUP self --- @return #table +-- @return #table Template table. function GROUP:GetTemplate() local GroupName = self:GetName() - return UTILS.DeepCopy( _DATABASE:GetGroupTemplate( GroupName ) ) + local template=_DATABASE:GetGroupTemplate( GroupName ) + if template then + return UTILS.DeepCopy( template ) + end + return nil end --- Returns the group template route.points[] (the waypoints) from the global _DATABASE object (an instance of @{Core.Database#DATABASE}).