diff --git a/Moose Development/Moose/AI/AI_Cargo.lua b/Moose Development/Moose/AI/AI_Cargo.lua index 18155df55..9b0a8e6a1 100644 --- a/Moose Development/Moose/AI/AI_Cargo.lua +++ b/Moose Development/Moose/AI/AI_Cargo.lua @@ -142,11 +142,10 @@ function AI_CARGO:New( Carrier, CargoSet ) -- @param #string Event -- @param #string To - -- FF "Workaround" for not being able to set the cargo bay limit manually for the carrier group. - -- FF Moreover, the carrier group is an input parameter and should not be overwritten here. - --for _, CarrierUnit in pairs( Carrier:GetUnits() ) do - --CarrierUnit:SetCargoBayWeightLimit() - --end + for _, CarrierUnit in pairs( Carrier:GetUnits() ) do + local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT + CarrierUnit:SetCargoBayWeightLimit() + end self.Transporting = false self.Relocating = false diff --git a/Moose Development/Moose/Core/SpawnStatic.lua b/Moose Development/Moose/Core/SpawnStatic.lua index 47db57503..5fa87ddb6 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(countryid) 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 diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index 7a37c7426..97becb610 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -1023,8 +1023,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. @@ -1032,7 +1033,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()