Fix for clients which weren't initialized with a cargo bay weight limit value. Each time a cargo bay weight limit is enquired through the method GetCargoBayFeeWeight(), if there isn't a cargo bay weight limit set, the default cargo bay weight limit will be calculated, so that the logic will always be executed.

This commit is contained in:
FlightControl
2018-08-26 08:45:36 +02:00
parent d9a5618773
commit 185c27013d
3 changed files with 54 additions and 11 deletions

View File

@@ -946,6 +946,12 @@ do -- Cargo
-- @param #POSITIONABLE self
-- @return #number CargoBayFreeWeight
function POSITIONABLE:GetCargoBayFreeWeight()
-- When there is no cargo bay weight limit set, then calculate this for this positionable!
if not self.__.CargoBayWeightLimit then
self:SetCargoBayWeightLimit()
end
local CargoWeight = 0
for CargoName, Cargo in pairs( self.__.Cargo ) do
CargoWeight = CargoWeight + Cargo:GetWeight()
@@ -1007,6 +1013,7 @@ do -- Cargo
self.__.CargoBayWeightLimit = CargoBayWeightLimit
end
end
self:F({CargoBayWeightLimit = self.__.CargoBayWeightLimit})
end
end --- Cargo