From f8e1c21a139f54d99e22da9a3164c1986522cb41 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Mon, 17 Sep 2018 11:17:59 +0200 Subject: [PATCH 1/2] Improvement of the C-130 and C-17A --- Moose Development/Moose/AI/AI_Cargo.lua | 1 + Moose Development/Moose/Wrapper/Positionable.lua | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Moose Development/Moose/AI/AI_Cargo.lua b/Moose Development/Moose/AI/AI_Cargo.lua index 1d358b735..9b0a8e6a1 100644 --- a/Moose Development/Moose/AI/AI_Cargo.lua +++ b/Moose Development/Moose/AI/AI_Cargo.lua @@ -143,6 +143,7 @@ function AI_CARGO:New( Carrier, CargoSet ) -- @param #string To for _, CarrierUnit in pairs( Carrier:GetUnits() ) do + local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT CarrierUnit:SetCargoBayWeightLimit() end diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index fc84e5f54..4a2dfc739 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -1022,8 +1022,9 @@ do -- Cargo -- @param #POSITIONABLE self -- @param #number WeightLimit function POSITIONABLE:SetCargoBayWeightLimit( WeightLimit ) + if WeightLimit then - self.__.CargoBayWeightLimit = WeightLimit + self.__.CargoBayWeightLimit = self.__.CargoBayWeightLimit or WeightLimit else -- If weightlimit is not provided, we will calculate it depending on the type of unit. @@ -1031,7 +1032,13 @@ do -- Cargo if self:IsAir() then local Desc = self:GetDesc() self:F({Desc=Desc}) - self.__.CargoBayWeightLimit = Desc.massMax - ( Desc.massEmpty + Desc.fuelMassMax ) + + local Weights = { + ["C-17A"] = 35000, --77519 cannot be used, because it loads way too much apcs and infantry., + ["C-130"] = 22000 --The real value cannot be used, because it loads way too much apcs and infantry., + } + + self.__.CargoBayWeightLimit = Weights[Desc.typeName] or ( Desc.massMax - ( Desc.massEmpty + Desc.fuelMassMax ) ) else local Desc = self:GetDesc() From 6de86ac7080c9cd7d4ba3d19dca6595e8091386a Mon Sep 17 00:00:00 2001 From: FlightControl Date: Mon, 17 Sep 2018 12:35:05 +0200 Subject: [PATCH 2/2] Frank can you retry? --- Moose Development/Moose/Core/SpawnStatic.lua | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Moose Development/Moose/Core/SpawnStatic.lua b/Moose Development/Moose/Core/SpawnStatic.lua index 2efce77f7..ac3b776ef 100644 --- a/Moose Development/Moose/Core/SpawnStatic.lua +++ b/Moose Development/Moose/Core/SpawnStatic.lua @@ -77,8 +77,10 @@ SPAWNSTATIC = { --- Creates the main object to spawn a @{Static} defined in the ME. -- @param #SPAWNSTATIC self -- @param #string SpawnTemplatePrefix is the name of the Group in the ME that defines the Template. Each new group will have the name starting with SpawnTemplatePrefix. +-- @param DCS#country.id SpawnCountryID The ID of the country. +-- @param DCS#coalition.side SpawnCoalitionID The ID of the coalition. -- @return #SPAWNSTATIC -function SPAWNSTATIC:NewFromStatic( SpawnTemplatePrefix, SpawnCountryID ) --R2.1 +function SPAWNSTATIC:NewFromStatic( SpawnTemplatePrefix, SpawnCountryID, SpawnCoalitionID ) local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC self:F( { SpawnTemplatePrefix } ) @@ -87,7 +89,7 @@ function SPAWNSTATIC:NewFromStatic( SpawnTemplatePrefix, SpawnCountryID ) --R2.1 self.SpawnTemplatePrefix = SpawnTemplatePrefix self.CountryID = SpawnCountryID or CountryID self.CategoryID = CategoryID - self.CoalitionID = CoalitionID + self.CoalitionID = SpawnCoalitionID or CoalitionID self.SpawnIndex = 0 else error( "SPAWNSTATIC:New: There is no static declared in the mission editor with SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" ) @@ -102,12 +104,13 @@ end -- @param #SPAWNSTATIC self -- @param #string SpawnTypeName is the name of the type. -- @return #SPAWNSTATIC -function SPAWNSTATIC:NewFromType( SpawnTypeName, SpawnShapeName, SpawnCategory, CountryID ) --R2.1 +function SPAWNSTATIC:NewFromType( SpawnTypeName, SpawnShapeName, SpawnCategory, SpawnCountryID, SpawnCoalitionID ) local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC self:F( { SpawnTypeName } ) self.SpawnTypeName = SpawnTypeName - self.CountryID = CountryID + self.CountryID = SpawnCountryID + self.CoalitionID = SpawnCoalitionID self.SpawnIndex = 0 self:SetEventPriority( 5 ) @@ -135,7 +138,7 @@ function SPAWNSTATIC:Spawn( Heading, NewName ) --R2.3 _DATABASE:_RegisterStaticTemplate( StaticTemplate, CoalitionID, CategoryID, CountryID ) - local Static = coalition.addStaticObject( CountryID, StaticTemplate.units[1] ) + local Static = coalition.addStaticObject( self.CountryID or CountryID, StaticTemplate.units[1] ) self.SpawnIndex = self.SpawnIndex + 1 @@ -176,7 +179,7 @@ function SPAWNSTATIC:SpawnFromPointVec2( PointVec2, Heading, NewName ) --R2.1 self:F({StaticTemplate = StaticTemplate}) - local Static = coalition.addStaticObject( CountryID, StaticTemplate.units[1] ) + local Static = coalition.addStaticObject( self.CountryID or CountryID, StaticTemplate.units[1] ) self.SpawnIndex = self.SpawnIndex + 1 @@ -204,7 +207,7 @@ function SPAWNSTATIC:ReSpawn() StaticTemplate.route = nil StaticTemplate.groupId = nil - local Static = coalition.addStaticObject( CountryID, StaticTemplate.units[1] ) + local Static = coalition.addStaticObject( self.CountryID or CountryID, StaticTemplate.units[1] ) return _DATABASE:FindStatic(Static:getName()) end @@ -231,7 +234,7 @@ function SPAWNSTATIC:ReSpawnAt( Coordinate, Heading ) StaticUnitTemplate.heading = Heading and ( ( Heading / 180 ) * math.pi ) or StaticTemplate.heading - local Static = coalition.addStaticObject( CountryID, StaticTemplate.units[1] ) + local Static = coalition.addStaticObject( self.CountryID or CountryID, StaticTemplate.units[1] ) return _DATABASE:FindStatic(Static:getName()) end