From a780f6635ffe4b60a4a1336433434619a7bcddb1 Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Sat, 10 Mar 2018 08:11:08 +0100 Subject: [PATCH] Cargo Transport --- Moose Development/Moose/Core/Cargo.lua | 9 ++++++++- Moose Development/Moose/Tasking/Task_CARGO.lua | 13 ++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Moose Development/Moose/Core/Cargo.lua b/Moose Development/Moose/Core/Cargo.lua index 3d7d4ec14..8bdbbd205 100644 --- a/Moose Development/Moose/Core/Cargo.lua +++ b/Moose Development/Moose/Core/Cargo.lua @@ -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 diff --git a/Moose Development/Moose/Tasking/Task_CARGO.lua b/Moose Development/Moose/Tasking/Task_CARGO.lua index c3123da7b..e7cc3f939 100644 --- a/Moose Development/Moose/Tasking/Task_CARGO.lua +++ b/Moose Development/Moose/Tasking/Task_CARGO.lua @@ -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 )