mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'FC/HotFix-Cargo-Transport_(Issue_#821)'
This commit is contained in:
commit
75f5cf9ac5
@ -338,6 +338,13 @@ function CARGO:IsUnLoaded()
|
|||||||
return self:Is( "UnLoaded" )
|
return self:Is( "UnLoaded" )
|
||||||
end
|
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.
|
--- Check if cargo is alive.
|
||||||
-- @param #CARGO self
|
-- @param #CARGO self
|
||||||
-- @return #boolean true if unloaded
|
-- @return #boolean true if unloaded
|
||||||
@ -944,7 +951,7 @@ do -- CARGO_UNIT
|
|||||||
else
|
else
|
||||||
self:__Boarding( -1, CargoCarrier, NearRadius, ... )
|
self:__Boarding( -1, CargoCarrier, NearRadius, ... )
|
||||||
self.RunCount = self.RunCount + 1
|
self.RunCount = self.RunCount + 1
|
||||||
if self.RunCount >= 20 then
|
if self.RunCount >= 60 then
|
||||||
self.RunCount = 0
|
self.RunCount = 0
|
||||||
local Speed = 90
|
local Speed = 90
|
||||||
local Angle = 180
|
local Angle = 180
|
||||||
|
|||||||
@ -226,6 +226,45 @@ function TASKINFO:AddWindAtCoordinate( Coordinate, Order, Detail, Keep )
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Add Cargo.
|
||||||
|
-- @param #TASKINFO self
|
||||||
|
-- @param Core.Cargo#CARGO Cargo
|
||||||
|
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||||
|
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||||
|
-- @param #boolean Keep (optional) If true, this would indicate that the planned taskinfo would be persistent when the task is completed, so that the original planned task info is used at the completed reports.
|
||||||
|
-- @return #TASKINFO self
|
||||||
|
function TASKINFO:AddCargo( Cargo, Order, Detail, Keep )
|
||||||
|
self:AddInfo( "Cargo", Cargo, Order, Detail, Keep )
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Add Cargo set.
|
||||||
|
-- @param #TASKINFO self
|
||||||
|
-- @param Core.Set#SET_CARGO SetCargo
|
||||||
|
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||||
|
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||||
|
-- @param #boolean Keep (optional) If true, this would indicate that the planned taskinfo would be persistent when the task is completed, so that the original planned task info is used at the completed reports.
|
||||||
|
-- @return #TASKINFO self
|
||||||
|
function TASKINFO:AddCargoSet( SetCargo, Order, Detail, Keep )
|
||||||
|
|
||||||
|
local CargoReport = REPORT:New()
|
||||||
|
SetCargo:ForEachCargo(
|
||||||
|
--- @param Core.Cargo#CARGO Cargo
|
||||||
|
function( Cargo )
|
||||||
|
local CargoType = Cargo:GetType()
|
||||||
|
local CargoName = Cargo:GetName()
|
||||||
|
local CargoCoordinate = Cargo:GetCoordinate()
|
||||||
|
CargoReport:Add( string.format( '- "%s" (%s) at %s', CargoName, CargoType, CargoCoordinate:ToStringMGRS() ) )
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
self:AddInfo( "CargoSet", CargoReport:Text(), Order, Detail, Keep )
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Create the taskinfo Report
|
--- Create the taskinfo Report
|
||||||
-- @param #TASKINFO self
|
-- @param #TASKINFO self
|
||||||
@ -280,6 +319,10 @@ function TASKINFO:Report( Report, Detail, ReportGroup )
|
|||||||
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
local Coordinate = Data.Data -- Core.Point#COORDINATE
|
||||||
Text = Coordinate:ToStringWind( ReportGroup:GetUnit(1), nil, self )
|
Text = Coordinate:ToStringWind( ReportGroup:GetUnit(1), nil, self )
|
||||||
end
|
end
|
||||||
|
if Key == "CargoSet" then
|
||||||
|
local DataText = Data.Data -- #string
|
||||||
|
Text = DataText
|
||||||
|
end
|
||||||
|
|
||||||
if Line < math.floor( Data.Order / 10 ) then
|
if Line < math.floor( Data.Order / 10 ) then
|
||||||
if Line == 0 then
|
if Line == 0 then
|
||||||
|
|||||||
@ -162,7 +162,7 @@ do -- TASK_CARGO
|
|||||||
self.SmokeColor = SMOKECOLOR.Red
|
self.SmokeColor = SMOKECOLOR.Red
|
||||||
|
|
||||||
self.CargoItemCount = {} -- Map of Carriers having a cargo item count to check the cargo loading limits.
|
self.CargoItemCount = {} -- Map of Carriers having a cargo item count to check the cargo loading limits.
|
||||||
self.CargoLimit = 2
|
self.CargoLimit = 6
|
||||||
|
|
||||||
self.DeployZones = {} -- setmetatable( {}, { __mode = "v" } ) -- weak table on value
|
self.DeployZones = {} -- setmetatable( {}, { __mode = "v" } ) -- weak table on value
|
||||||
|
|
||||||
@ -239,10 +239,10 @@ do -- TASK_CARGO
|
|||||||
-- ):SetTime(MenuTime)
|
-- ):SetTime(MenuTime)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
|
self:F( { CargoUnloaded = Cargo:IsUnLoaded(), CargoLoaded = Cargo:IsLoaded(), CargoItemCount = CargoItemCount } )
|
||||||
|
|
||||||
if Cargo:IsUnLoaded() then
|
if Cargo:IsUnLoaded() then
|
||||||
if CargoItemCount < Task.CargoLimit then
|
if CargoItemCount <= Task.CargoLimit then
|
||||||
if Cargo:IsInRadius( TaskUnit:GetPointVec2() ) then
|
if Cargo:IsInRadius( TaskUnit:GetPointVec2() ) then
|
||||||
local NotInDeployZones = true
|
local NotInDeployZones = true
|
||||||
for DeployZoneName, DeployZone in pairs( Task.DeployZones ) do
|
for DeployZoneName, DeployZone in pairs( Task.DeployZones ) do
|
||||||
@ -478,8 +478,10 @@ do -- TASK_CARGO
|
|||||||
if TaskUnit:InAir() then
|
if TaskUnit:InAir() then
|
||||||
--- ABORT the boarding. Split group if any and go back to select action.
|
--- ABORT the boarding. Split group if any and go back to select action.
|
||||||
else
|
else
|
||||||
self.Cargo:MessageToGroup( "Boarding ...", TaskUnit:GetGroup() )
|
self.Cargo:MessageToGroup( "Boarding ...", TaskUnit:GetGroup() )
|
||||||
self.Cargo:Board( TaskUnit, 20, self )
|
if not self.Cargo:IsBoarding() then
|
||||||
|
self.Cargo:Board( TaskUnit, 20, self )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
--self:__ArriveAtCargo( -0.1 )
|
--self:__ArriveAtCargo( -0.1 )
|
||||||
@ -800,6 +802,13 @@ do -- TASK_CARGO
|
|||||||
return self.GoalTotal
|
return self.GoalTotal
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function TASK_CARGO:UpdateTaskInfo()
|
||||||
|
|
||||||
|
if self:IsStatePlanned() or self:IsStateAssigned() then
|
||||||
|
self.TaskInfo:AddTaskName( 0, "MSOD" )
|
||||||
|
self.TaskInfo:AddCargoSet( self.SetCargo, 10, "SOD" )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user