Cargo Transport

This commit is contained in:
FlightControl_Master 2018-03-10 08:11:08 +01:00
parent 34592a53be
commit a780f6635f
2 changed files with 14 additions and 8 deletions

View File

@ -338,6 +338,13 @@ function CARGO:IsUnLoaded()
return self:Is( "UnLoaded" )
end
--- Check if cargo is boarding.
-- @param #CARGO self
-- @return #boolean true if boarding
function CARGO:IsBoarding()
return self:Is( "Boarding" )
end
--- Check if cargo is alive.
-- @param #CARGO self
-- @return #boolean true if unloaded
@ -944,7 +951,7 @@ do -- CARGO_UNIT
else
self:__Boarding( -1, CargoCarrier, NearRadius, ... )
self.RunCount = self.RunCount + 1
if self.RunCount >= 20 then
if self.RunCount >= 60 then
self.RunCount = 0
local Speed = 90
local Angle = 180

View File

@ -228,7 +228,6 @@ do -- TASK_CARGO
if Cargo:IsAlive() then
self:E( "Cargo is alive" )
-- if Task:is( "RoutingToPickup" ) then
-- MENU_GROUP_COMMAND:New(
-- TaskUnit:GetGroup(),
@ -240,7 +239,7 @@ do -- TASK_CARGO
-- ):SetTime(MenuTime)
-- end
self:E( { CargoUnloaded = Cargo:IsUnLoaded(), CargoLoaded = Cargo:IsLoaded(), CargoItemCount = CargoItemCount } )
self:F( { CargoUnloaded = Cargo:IsUnLoaded(), CargoLoaded = Cargo:IsLoaded(), CargoItemCount = CargoItemCount } )
if Cargo:IsUnLoaded() then
if CargoItemCount <= Task.CargoLimit then
@ -251,14 +250,12 @@ do -- TASK_CARGO
NotInDeployZones = false
end
end
self:E( { NotInDeployZones = NotInDeployZones } )
if NotInDeployZones then
if not TaskUnit:InAir() then
MENU_GROUP_COMMAND:New( TaskUnit:GetGroup(), "Board cargo " .. Cargo.Name, TaskUnit.Menu, self.MenuBoardCargo, self, Cargo ):SetTime(MenuTime)
end
end
else
self:E( { "Route" } )
MENU_GROUP_COMMAND:New( TaskUnit:GetGroup(), "Route to Pickup cargo " .. Cargo.Name, TaskUnit.Menu, self.MenuRouteToPickup, self, Cargo ):SetTime(MenuTime)
end
end
@ -280,7 +277,7 @@ do -- TASK_CARGO
end
)
--TaskUnit.Menu:Remove( MenuTime )
TaskUnit.Menu:Remove( MenuTime )
self:__SelectAction( -15 )
@ -481,8 +478,10 @@ do -- TASK_CARGO
if TaskUnit:InAir() then
--- ABORT the boarding. Split group if any and go back to select action.
else
self.Cargo:MessageToGroup( "Boarding ...", TaskUnit:GetGroup() )
self.Cargo:Board( TaskUnit, 20, self )
self.Cargo:MessageToGroup( "Boarding ...", TaskUnit:GetGroup() )
if not self.Cargo:IsBoarding() then
self.Cargo:Board( TaskUnit, 20, self )
end
end
else
--self:__ArriveAtCargo( -0.1 )