mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Unboarding and Unboarding timing updates.
This commit is contained in:
parent
8516cb349c
commit
c8f2786611
@ -213,7 +213,7 @@ function AI_CARGO:onbeforeLoad( Carrier, From, Event, To, PickupZone )
|
||||
|
||||
local Boarding = false
|
||||
|
||||
local LoadInterval = 2
|
||||
local LoadInterval = 5
|
||||
local LoadDelay = 0
|
||||
local Carrier_List = {}
|
||||
local Carrier_Weight = {}
|
||||
@ -261,8 +261,8 @@ function AI_CARGO:onbeforeLoad( Carrier, From, Event, To, PickupZone )
|
||||
if Carrier_Weight[CarrierUnit] > CargoWeight then --and CargoBayFreeVolume > CargoVolume then
|
||||
Carrier:RouteStop()
|
||||
--Cargo:Ungroup()
|
||||
Cargo:__Board( LoadDelay, CarrierUnit, 25 )
|
||||
LoadDelay = LoadDelay + LoadInterval
|
||||
Cargo:__Board( -LoadDelay, CarrierUnit, 25 )
|
||||
LoadDelay = LoadDelay + Cargo:GetCount() * LoadInterval
|
||||
self:__Board( LoadDelay, Cargo, CarrierUnit, PickupZone )
|
||||
|
||||
-- So now this CarrierUnit has Cargo that is being loaded.
|
||||
@ -308,7 +308,7 @@ function AI_CARGO:onafterBoard( Carrier, From, Event, To, Cargo, CarrierUnit, Pi
|
||||
if Carrier and Carrier:IsAlive() then
|
||||
self:F({ IsLoaded = Cargo:IsLoaded(), Cargo:GetName(), Carrier:GetName() } )
|
||||
if not Cargo:IsLoaded() then
|
||||
self:__Board( 10, Cargo, CarrierUnit, PickupZone )
|
||||
self:__Board( -10, Cargo, CarrierUnit, PickupZone )
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -397,7 +397,7 @@ function AI_CARGO:onafterUnload( Carrier, From, Event, To, DeployZone )
|
||||
self:F( { Cargo = Cargo:GetName(), Isloaded = Cargo:IsLoaded() } )
|
||||
if Cargo:IsLoaded() then
|
||||
Cargo:__UnBoard( UnboardDelay )
|
||||
UnboardDelay = UnboardDelay + UnboardInterval
|
||||
UnboardDelay = UnboardDelay + Cargo:GetCount() * UnboardInterval
|
||||
Cargo:SetDeployed( true )
|
||||
self:__Unboard( UnboardDelay, Cargo, CarrierUnit, DeployZone )
|
||||
end
|
||||
|
||||
@ -1097,13 +1097,14 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
|
||||
local PickupCargo = nil
|
||||
local PickupZone = nil
|
||||
|
||||
--self.SetCargo:Flush()
|
||||
for CargoName, Cargo in UTILS.spairs( self.SetCargo:GetSet(), function( t, a, b ) return t[a]:GetWeight() < t[b]:GetWeight() end ) do
|
||||
local Cargo = Cargo -- Cargo.Cargo#CARGO
|
||||
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()
|
||||
local CoordinateFree = true
|
||||
self.PickupZoneSet:Flush()
|
||||
--self.PickupZoneSet:Flush()
|
||||
PickupZone = self.PickupZoneSet and self.PickupZoneSet:IsCoordinateInZone( CargoCoordinate )
|
||||
if not self.PickupZoneSet or PickupZone then
|
||||
for CarrierPickup, Coordinate in pairs( self.PickupCargo ) do
|
||||
|
||||
@ -271,7 +271,7 @@ do -- CARGO_UNIT
|
||||
|
||||
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
||||
self.CargoObject:SetTask( TaskRoute, 2 )
|
||||
self:__Boarding( -1, CargoCarrier, NearRadius )
|
||||
self:__Boarding( -5, CargoCarrier, NearRadius )
|
||||
self.RunCount = 0
|
||||
end
|
||||
end
|
||||
@ -297,8 +297,13 @@ do -- CARGO_UNIT
|
||||
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
|
||||
self:__Load( 1, CargoCarrier, ... )
|
||||
else
|
||||
self:__Boarding( -1, CargoCarrier, NearRadius, ... )
|
||||
self.RunCount = self.RunCount + 1
|
||||
if self:IsNear( CargoCarrier:GetPointVec2(), 20 ) then
|
||||
self:__Boarding( -2, CargoCarrier, NearRadius, ... )
|
||||
self.RunCount = self.RunCount + 2
|
||||
else
|
||||
self:__Boarding( -10, CargoCarrier, NearRadius, ... )
|
||||
self.RunCount = self.RunCount + 10
|
||||
end
|
||||
if self.RunCount >= 40 then
|
||||
self.RunCount = 0
|
||||
local Speed = 90
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user