mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop' into FF/Develop
This commit is contained in:
@@ -142,11 +142,10 @@ function AI_CARGO:New( Carrier, CargoSet )
|
|||||||
-- @param #string Event
|
-- @param #string Event
|
||||||
-- @param #string To
|
-- @param #string To
|
||||||
|
|
||||||
-- FF "Workaround" for not being able to set the cargo bay limit manually for the carrier group.
|
for _, CarrierUnit in pairs( Carrier:GetUnits() ) do
|
||||||
-- FF Moreover, the carrier group is an input parameter and should not be overwritten here.
|
local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT
|
||||||
--for _, CarrierUnit in pairs( Carrier:GetUnits() ) do
|
CarrierUnit:SetCargoBayWeightLimit()
|
||||||
--CarrierUnit:SetCargoBayWeightLimit()
|
end
|
||||||
--end
|
|
||||||
|
|
||||||
self.Transporting = false
|
self.Transporting = false
|
||||||
self.Relocating = false
|
self.Relocating = false
|
||||||
|
|||||||
@@ -77,8 +77,10 @@ SPAWNSTATIC = {
|
|||||||
--- Creates the main object to spawn a @{Static} defined in the ME.
|
--- Creates the main object to spawn a @{Static} defined in the ME.
|
||||||
-- @param #SPAWNSTATIC self
|
-- @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 #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
|
-- @return #SPAWNSTATIC
|
||||||
function SPAWNSTATIC:NewFromStatic( SpawnTemplatePrefix, SpawnCountryID ) --R2.1
|
function SPAWNSTATIC:NewFromStatic( SpawnTemplatePrefix, SpawnCountryID, SpawnCoalitionID )
|
||||||
local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC
|
local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC
|
||||||
self:F( { SpawnTemplatePrefix } )
|
self:F( { SpawnTemplatePrefix } )
|
||||||
|
|
||||||
@@ -87,7 +89,7 @@ function SPAWNSTATIC:NewFromStatic( SpawnTemplatePrefix, SpawnCountryID ) --R2.1
|
|||||||
self.SpawnTemplatePrefix = SpawnTemplatePrefix
|
self.SpawnTemplatePrefix = SpawnTemplatePrefix
|
||||||
self.CountryID = SpawnCountryID or CountryID
|
self.CountryID = SpawnCountryID or CountryID
|
||||||
self.CategoryID = CategoryID
|
self.CategoryID = CategoryID
|
||||||
self.CoalitionID = CoalitionID
|
self.CoalitionID = SpawnCoalitionID or CoalitionID
|
||||||
self.SpawnIndex = 0
|
self.SpawnIndex = 0
|
||||||
else
|
else
|
||||||
error( "SPAWNSTATIC:New: There is no static declared in the mission editor with SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" )
|
error( "SPAWNSTATIC:New: There is no static declared in the mission editor with SpawnTemplatePrefix = '" .. SpawnTemplatePrefix .. "'" )
|
||||||
@@ -102,12 +104,13 @@ end
|
|||||||
-- @param #SPAWNSTATIC self
|
-- @param #SPAWNSTATIC self
|
||||||
-- @param #string SpawnTypeName is the name of the type.
|
-- @param #string SpawnTypeName is the name of the type.
|
||||||
-- @return #SPAWNSTATIC
|
-- @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
|
local self = BASE:Inherit( self, BASE:New() ) -- #SPAWNSTATIC
|
||||||
self:F( { SpawnTypeName } )
|
self:F( { SpawnTypeName } )
|
||||||
|
|
||||||
self.SpawnTypeName = SpawnTypeName
|
self.SpawnTypeName = SpawnTypeName
|
||||||
self.CountryID = CountryID
|
self.CountryID = SpawnCountryID
|
||||||
|
self.CoalitionID = SpawnCoalitionID
|
||||||
self.SpawnIndex = 0
|
self.SpawnIndex = 0
|
||||||
|
|
||||||
self:SetEventPriority( 5 )
|
self:SetEventPriority( 5 )
|
||||||
@@ -135,7 +138,7 @@ function SPAWNSTATIC:Spawn( Heading, NewName ) --R2.3
|
|||||||
|
|
||||||
_DATABASE:_RegisterStaticTemplate( StaticTemplate, CoalitionID, CategoryID, CountryID )
|
_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
|
self.SpawnIndex = self.SpawnIndex + 1
|
||||||
|
|
||||||
@@ -176,7 +179,7 @@ function SPAWNSTATIC:SpawnFromPointVec2( PointVec2, Heading, NewName ) --R2.1
|
|||||||
|
|
||||||
self:F({StaticTemplate = StaticTemplate})
|
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
|
self.SpawnIndex = self.SpawnIndex + 1
|
||||||
|
|
||||||
@@ -204,7 +207,7 @@ function SPAWNSTATIC:ReSpawn(countryid)
|
|||||||
StaticTemplate.route = nil
|
StaticTemplate.route = nil
|
||||||
StaticTemplate.groupId = 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())
|
return _DATABASE:FindStatic(Static:getName())
|
||||||
end
|
end
|
||||||
@@ -231,7 +234,7 @@ function SPAWNSTATIC:ReSpawnAt( Coordinate, Heading )
|
|||||||
|
|
||||||
StaticUnitTemplate.heading = Heading and ( ( Heading / 180 ) * math.pi ) or StaticTemplate.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())
|
return _DATABASE:FindStatic(Static:getName())
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1023,8 +1023,9 @@ do -- Cargo
|
|||||||
-- @param #POSITIONABLE self
|
-- @param #POSITIONABLE self
|
||||||
-- @param #number WeightLimit
|
-- @param #number WeightLimit
|
||||||
function POSITIONABLE:SetCargoBayWeightLimit( WeightLimit )
|
function POSITIONABLE:SetCargoBayWeightLimit( WeightLimit )
|
||||||
|
|
||||||
if WeightLimit then
|
if WeightLimit then
|
||||||
self.__.CargoBayWeightLimit = WeightLimit
|
self.__.CargoBayWeightLimit = self.__.CargoBayWeightLimit or WeightLimit
|
||||||
else
|
else
|
||||||
-- If weightlimit is not provided, we will calculate it depending on the type of unit.
|
-- 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
|
if self:IsAir() then
|
||||||
local Desc = self:GetDesc()
|
local Desc = self:GetDesc()
|
||||||
self:F({Desc=Desc})
|
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
|
else
|
||||||
local Desc = self:GetDesc()
|
local Desc = self:GetDesc()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user