mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-25 13:02:39 +00:00
Update OpsGroup.lua
- Storage transport
This commit is contained in:
@@ -9411,7 +9411,19 @@ function OPSGROUP:onafterLoading(From, Event, To)
|
||||
local function _sort(a, b)
|
||||
local cargoA=a --Ops.OpsGroup#OPSGROUP.CargoGroup
|
||||
local cargoB=b --Ops.OpsGroup#OPSGROUP.CargoGroup
|
||||
return cargoA.opsgroup:GetWeightTotal()>cargoB.opsgroup:GetWeightTotal()
|
||||
local weightA=0
|
||||
local weightB=0
|
||||
if cargoA.opsgroup then
|
||||
weightA=cargoA.opsgroup:GetWeightTotal()
|
||||
else
|
||||
weightA=self:_GetWeightStorage(cargoA.storage)
|
||||
end
|
||||
if cargoB.opsgroup then
|
||||
weightB=cargoB.opsgroup:GetWeightTotal()
|
||||
else
|
||||
weightB=self:_GetWeightStorage(cargoB.storage)
|
||||
end
|
||||
return weightA>weightB
|
||||
end
|
||||
table.sort(cargos, _sort)
|
||||
|
||||
@@ -9965,6 +9977,9 @@ function OPSGROUP:onafterUnloading(From, Event, To)
|
||||
-- STORAGE
|
||||
---
|
||||
|
||||
-- TODO: should proabaly move this check to the top to include OPSGROUPS as well?!
|
||||
if not cargo.delivered then
|
||||
|
||||
for _,_element in pairs(self.elements) do
|
||||
local element=_element --#OPSGROUP.Element
|
||||
|
||||
@@ -10001,7 +10016,7 @@ function OPSGROUP:onafterUnloading(From, Event, To)
|
||||
local amountTotal=self:_GetWeightStorage(cargo.storage, true, false, true)
|
||||
|
||||
-- Debug info.
|
||||
local text=string.format("FF Amount delivered=%d, total=%d", amountToDeliver, amountTotal)
|
||||
local text=string.format("Amount delivered=%d, total=%d", amountToDeliver, amountTotal)
|
||||
self:T(self.lid..text)
|
||||
|
||||
if amountToDeliver<=0 then
|
||||
@@ -10012,6 +10027,11 @@ function OPSGROUP:onafterUnloading(From, Event, To)
|
||||
-- Increase number of delivered cargos.
|
||||
self.cargoTransport.Ndelivered=self.cargoTransport.Ndelivered+1
|
||||
|
||||
-- Debug info.
|
||||
local text=string.format("Ndelivered=%d delivered=%s", self.cargoTransport.Ndelivered, tostring(cargo.delivered))
|
||||
self:T(self.lid..text)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user