Cargo Dispatcher APC - Multiple Cargo Groups and Weight in APC

This commit is contained in:
FlightControl
2018-08-17 07:59:53 +02:00
parent 9650129769
commit a02d3c1950
7 changed files with 97 additions and 31 deletions

View File

@@ -416,6 +416,7 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
self:F( { Cargo = Cargo:GetName(), UnLoaded = Cargo:IsUnLoaded(), Deployed = Cargo:IsDeployed(), PickupCargo = self.PickupCargo[Carrier] ~= nil } )
if Cargo:IsUnLoaded() == true and Cargo:IsDeployed() == false then
local CargoCoordinate = Cargo:GetCoordinate()
self:F({CargoCoordinate = CargoCoordinate })
local CoordinateFree = true
for CarrierPickup, Coordinate in pairs( self.PickupCargo ) do
if CarrierPickup:IsAlive() == true then
@@ -427,6 +428,7 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
self.PickupCargo[CarrierPickup] = nil
end
end
self:F({CoordinateFree = CoordinateFree})
if CoordinateFree == true then
self.PickupCargo[Carrier] = CargoCoordinate
PickupCargo = Cargo
@@ -435,6 +437,8 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
end
end
self:F( { PickupCargo = PickupCargo} )
if PickupCargo then
self.CarrierHome[Carrier] = nil
local PickupCoordinate = PickupCargo:GetCoordinate():GetRandomCoordinateInRadius( self.PickupOuterRadius, self.PickupInnerRadius )
@@ -567,6 +571,7 @@ function AI_CARGO_DISPATCHER:OnAfterLoaded( From, Event, To, Carrier, Cargo )
end
end
self:F({Carrier=Carrier})
self.PickupCargo[Carrier] = nil
end