Progress on AI_CARGO_TROOPS

This commit is contained in:
FlightControl_Master 2018-04-07 14:21:34 +02:00
parent a247f56c7e
commit 7735120f25
3 changed files with 46 additions and 24 deletions

View File

@ -232,6 +232,10 @@ do -- CARGO_UNIT
self.CargoInAir = self.CargoObject:InAir() self.CargoInAir = self.CargoObject:InAir()
local Desc = self.CargoObject:GetDesc()
local MaxSpeed = Desc.speedMaxOffRoad
local TypeName = Desc.typeName
self:T( self.CargoInAir ) self:T( self.CargoInAir )
-- Only move the group to the carrier when the cargo is not in the air -- Only move the group to the carrier when the cargo is not in the air
@ -240,6 +244,10 @@ do -- CARGO_UNIT
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
self:Load( CargoCarrier, NearRadius, ... ) self:Load( CargoCarrier, NearRadius, ... )
else else
if MaxSpeed and MaxSpeed == 0 or TypeName and TypeName == "Stinger comm" then
self:Load( CargoCarrier, NearRadius, ... )
else
local Speed = 90 local Speed = 90
local Angle = 180 local Angle = 180
local Distance = 5 local Distance = 5
@ -264,6 +272,7 @@ do -- CARGO_UNIT
self.RunCount = 0 self.RunCount = 0
end end
end end
end
end end

View File

@ -4131,6 +4131,19 @@ function SET_CARGO:New() --R2.1
return self return self
end end
--- (R2.1) Add CARGO to SET_CARGO.
-- @param Core.Set#SET_CARGO self
-- @param Cargo.Cargo#CARGO Cargo A single cargo.
-- @return self
function SET_CARGO:AddCargo( Cargo ) --R2.4
self:Add( Cargo:GetName(), Cargo )
return self
end
--- (R2.1) Add CARGOs to SET_CARGO. --- (R2.1) Add CARGOs to SET_CARGO.
-- @param Core.Set#SET_CARGO self -- @param Core.Set#SET_CARGO self
-- @param #string AddCargoNames A single name or an array of CARGO names. -- @param #string AddCargoNames A single name or an array of CARGO names.

View File

@ -1892,7 +1892,7 @@ end
-- @param #CONTROLLABLE self -- @param #CONTROLLABLE self
-- @return #CONTROLLABLE -- @return #CONTROLLABLE
function CONTROLLABLE:RouteStop() function CONTROLLABLE:RouteStop()
self:F2() self:F("RouteStop")
local CommandStop = self:CommandStopRoute( true ) local CommandStop = self:CommandStopRoute( true )
self:SetCommand( CommandStop ) self:SetCommand( CommandStop )
@ -1903,7 +1903,7 @@ end
-- @param #CONTROLLABLE self -- @param #CONTROLLABLE self
-- @return #CONTROLLABLE -- @return #CONTROLLABLE
function CONTROLLABLE:RouteResume() function CONTROLLABLE:RouteResume()
self:F2() self:F("RouteResume")
local CommandResume = self:CommandStopRoute( false ) local CommandResume = self:CommandStopRoute( false )
self:SetCommand( CommandResume ) self:SetCommand( CommandResume )