mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Progress on AI_CARGO_TROOPS
This commit is contained in:
parent
a247f56c7e
commit
7735120f25
@ -232,6 +232,10 @@ do -- CARGO_UNIT
|
||||
|
||||
self.CargoInAir = self.CargoObject:InAir()
|
||||
|
||||
local Desc = self.CargoObject:GetDesc()
|
||||
local MaxSpeed = Desc.speedMaxOffRoad
|
||||
local TypeName = Desc.typeName
|
||||
|
||||
self:T( self.CargoInAir )
|
||||
|
||||
-- Only move the group to the carrier when the cargo is not in the air
|
||||
@ -240,28 +244,33 @@ do -- CARGO_UNIT
|
||||
if self:IsNear( CargoCarrier:GetPointVec2(), NearRadius ) then
|
||||
self:Load( CargoCarrier, NearRadius, ... )
|
||||
else
|
||||
local Speed = 90
|
||||
local Angle = 180
|
||||
local Distance = 5
|
||||
if MaxSpeed and MaxSpeed == 0 or TypeName and TypeName == "Stinger comm" then
|
||||
self:Load( CargoCarrier, NearRadius, ... )
|
||||
else
|
||||
|
||||
NearRadius = NearRadius or 25
|
||||
local Speed = 90
|
||||
local Angle = 180
|
||||
local Distance = 5
|
||||
|
||||
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
||||
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
|
||||
local CargoDeployPointVec2 = CargoCarrierPointVec2:Translate( Distance, CargoDeployHeading )
|
||||
NearRadius = NearRadius or 25
|
||||
|
||||
local Points = {}
|
||||
local CargoCarrierPointVec2 = CargoCarrier:GetPointVec2()
|
||||
local CargoCarrierHeading = CargoCarrier:GetHeading() -- Get Heading of object in degrees.
|
||||
local CargoDeployHeading = ( ( CargoCarrierHeading + Angle ) >= 360 ) and ( CargoCarrierHeading + Angle - 360 ) or ( CargoCarrierHeading + Angle )
|
||||
local CargoDeployPointVec2 = CargoCarrierPointVec2:Translate( Distance, CargoDeployHeading )
|
||||
|
||||
local PointStartVec2 = self.CargoObject:GetPointVec2()
|
||||
local Points = {}
|
||||
|
||||
Points[#Points+1] = PointStartVec2:WaypointGround( Speed )
|
||||
Points[#Points+1] = CargoDeployPointVec2:WaypointGround( Speed )
|
||||
local PointStartVec2 = self.CargoObject:GetPointVec2()
|
||||
|
||||
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
||||
self.CargoObject:SetTask( TaskRoute, 2 )
|
||||
self:__Boarding( -1, CargoCarrier, NearRadius )
|
||||
self.RunCount = 0
|
||||
Points[#Points+1] = PointStartVec2:WaypointGround( Speed )
|
||||
Points[#Points+1] = CargoDeployPointVec2:WaypointGround( Speed )
|
||||
|
||||
local TaskRoute = self.CargoObject:TaskRoute( Points )
|
||||
self.CargoObject:SetTask( TaskRoute, 2 )
|
||||
self:__Boarding( -1, CargoCarrier, NearRadius )
|
||||
self.RunCount = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -4131,6 +4131,19 @@ function SET_CARGO:New() --R2.1
|
||||
return self
|
||||
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.
|
||||
-- @param Core.Set#SET_CARGO self
|
||||
-- @param #string AddCargoNames A single name or an array of CARGO names.
|
||||
|
||||
@ -1892,7 +1892,7 @@ end
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @return #CONTROLLABLE
|
||||
function CONTROLLABLE:RouteStop()
|
||||
self:F2()
|
||||
self:F("RouteStop")
|
||||
|
||||
local CommandStop = self:CommandStopRoute( true )
|
||||
self:SetCommand( CommandStop )
|
||||
@ -1903,7 +1903,7 @@ end
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @return #CONTROLLABLE
|
||||
function CONTROLLABLE:RouteResume()
|
||||
self:F2()
|
||||
self:F("RouteResume")
|
||||
|
||||
local CommandResume = self:CommandStopRoute( false )
|
||||
self:SetCommand( CommandResume )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user