mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #962 from FlightControl-Master/FF/Develop
AI_CARGO_DISPATCHER
This commit is contained in:
commit
79cfe13035
@ -596,15 +596,18 @@ end
|
|||||||
-- @param From
|
-- @param From
|
||||||
-- @param Event
|
-- @param Event
|
||||||
-- @param To
|
-- @param To
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate of the pickup point.
|
||||||
function AI_CARGO_APC:onafterPickup( APC, From, Event, To, Coordinate )
|
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
|
||||||
|
function AI_CARGO_APC:onafterPickup( APC, From, Event, To, Coordinate, Speed )
|
||||||
|
|
||||||
if APC and APC:IsAlive() then
|
if APC and APC:IsAlive() then
|
||||||
|
|
||||||
if Coordinate then
|
if Coordinate then
|
||||||
self.RoutePickup = true
|
self.RoutePickup = true
|
||||||
|
|
||||||
local Waypoints = APC:TaskGroundOnRoad( Coordinate, APC:GetSpeedMax()*0.5, "Line abreast", true )
|
local _speed=Speed or APC:GetSpeedMax()*0.5
|
||||||
|
|
||||||
|
local Waypoints = APC:TaskGroundOnRoad( Coordinate, _speed, "Line abreast", true )
|
||||||
|
|
||||||
local TaskFunction = APC:TaskFunction( "AI_CARGO_APC._Pickup", self )
|
local TaskFunction = APC:TaskFunction( "AI_CARGO_APC._Pickup", self )
|
||||||
|
|
||||||
@ -629,13 +632,16 @@ end
|
|||||||
-- @param Event
|
-- @param Event
|
||||||
-- @param To
|
-- @param To
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
function AI_CARGO_APC:onafterDeploy( APC, From, Event, To, Coordinate )
|
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
|
||||||
|
function AI_CARGO_APC:onafterDeploy( APC, From, Event, To, Coordinate, Speed )
|
||||||
|
|
||||||
if APC and APC:IsAlive() then
|
if APC and APC:IsAlive() then
|
||||||
|
|
||||||
self.RouteDeploy = true
|
self.RouteDeploy = true
|
||||||
|
|
||||||
|
local _speed=Speed or APC:GetSpeedMax()*0.5
|
||||||
|
|
||||||
local Waypoints = APC:TaskGroundOnRoad( Coordinate, APC:GetSpeedMax()*0.5, "Line abreast", true )
|
local Waypoints = APC:TaskGroundOnRoad( Coordinate, _speed, "Line abreast", true )
|
||||||
|
|
||||||
local TaskFunction = APC:TaskFunction( "AI_CARGO_APC._Deploy", self )
|
local TaskFunction = APC:TaskFunction( "AI_CARGO_APC._Deploy", self )
|
||||||
|
|
||||||
@ -655,13 +661,16 @@ end
|
|||||||
-- @param Event
|
-- @param Event
|
||||||
-- @param To
|
-- @param To
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
function AI_CARGO_APC:onafterHome( APC, From, Event, To, Coordinate )
|
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
|
||||||
|
function AI_CARGO_APC:onafterHome( APC, From, Event, To, Coordinate, Speed )
|
||||||
|
|
||||||
if APC and APC:IsAlive() ~= nil then
|
if APC and APC:IsAlive() ~= nil then
|
||||||
|
|
||||||
self.RouteHome = true
|
self.RouteHome = true
|
||||||
|
|
||||||
local Waypoints = APC:TaskGroundOnRoad( Coordinate, APC:GetSpeedMax()*0.5, "Line abreast", true )
|
local _speed=Speed or APC:GetSpeedMax()*0.5
|
||||||
|
|
||||||
|
local Waypoints = APC:TaskGroundOnRoad( Coordinate, _speed, "Line abreast", true )
|
||||||
|
|
||||||
self:F({Waypoints = Waypoints})
|
self:F({Waypoints = Waypoints})
|
||||||
local Waypoint = Waypoints[#Waypoints]
|
local Waypoint = Waypoints[#Waypoints]
|
||||||
|
|||||||
@ -25,7 +25,6 @@ AI_CARGO_AIRPLANE = {
|
|||||||
-- @param #AI_CARGO_AIRPLANE self
|
-- @param #AI_CARGO_AIRPLANE self
|
||||||
-- @param Wrapper.Group#GROUP Airplane
|
-- @param Wrapper.Group#GROUP Airplane
|
||||||
-- @param Core.Set#SET_CARGO CargoSet
|
-- @param Core.Set#SET_CARGO CargoSet
|
||||||
-- @param #number CombatRadius
|
|
||||||
-- @return #AI_CARGO_AIRPLANE
|
-- @return #AI_CARGO_AIRPLANE
|
||||||
function AI_CARGO_AIRPLANE:New( Airplane, CargoSet )
|
function AI_CARGO_AIRPLANE:New( Airplane, CargoSet )
|
||||||
|
|
||||||
|
|||||||
@ -90,7 +90,7 @@ AI_CARGO_DISPATCHER_HELICOPTER = {
|
|||||||
-- @param #AI_CARGO_DISPATCHER_HELICOPTER self
|
-- @param #AI_CARGO_DISPATCHER_HELICOPTER self
|
||||||
-- @param Core.Set#SET_GROUP SetHelicopter The collection of Helicopter @{Wrapper.Group}s.
|
-- @param Core.Set#SET_GROUP SetHelicopter The collection of Helicopter @{Wrapper.Group}s.
|
||||||
-- @param Core.Set#SET_CARGO SetCargo The collection of @{Cargo} derived objects.
|
-- @param Core.Set#SET_CARGO SetCargo The collection of @{Cargo} derived objects.
|
||||||
-- @param Core.Set#SET_ZONE SetDeployZone The collection of deploy @{Zone}s, which are used to where the cargo will be deployed by the Helicopters.
|
-- @param Core.Set#SET_ZONE SetDeployZones The collection of deploy @{Zone}s, which are used to where the cargo will be deployed by the Helicopters.
|
||||||
-- @return #AI_CARGO_DISPATCHER_HELICOPTER
|
-- @return #AI_CARGO_DISPATCHER_HELICOPTER
|
||||||
-- @usage
|
-- @usage
|
||||||
--
|
--
|
||||||
|
|||||||
@ -29,7 +29,6 @@ AI_CARGO_QUEUE = {}
|
|||||||
-- @param #AI_CARGO_HELICOPTER self
|
-- @param #AI_CARGO_HELICOPTER self
|
||||||
-- @param Wrapper.Group#GROUP Helicopter
|
-- @param Wrapper.Group#GROUP Helicopter
|
||||||
-- @param Core.Set#SET_CARGO CargoSet
|
-- @param Core.Set#SET_CARGO CargoSet
|
||||||
-- @param #number CombatRadius
|
|
||||||
-- @return #AI_CARGO_HELICOPTER
|
-- @return #AI_CARGO_HELICOPTER
|
||||||
function AI_CARGO_HELICOPTER:New( Helicopter, CargoSet )
|
function AI_CARGO_HELICOPTER:New( Helicopter, CargoSet )
|
||||||
|
|
||||||
@ -530,15 +529,17 @@ end
|
|||||||
-- @param Event
|
-- @param Event
|
||||||
-- @param To
|
-- @param To
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @param #number Speed
|
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
|
||||||
function AI_CARGO_HELICOPTER:onafterPickup( Helicopter, From, Event, To, Coordinate )
|
function AI_CARGO_HELICOPTER:onafterPickup( Helicopter, From, Event, To, Coordinate, Speed )
|
||||||
|
|
||||||
if Helicopter and Helicopter:IsAlive() ~= nil then
|
if Helicopter and Helicopter:IsAlive() ~= nil then
|
||||||
|
|
||||||
Helicopter:Activate()
|
Helicopter:Activate()
|
||||||
|
|
||||||
self.RoutePickup = true
|
self.RoutePickup = true
|
||||||
Coordinate.y = math.random( 50, 200 )
|
Coordinate.y = math.random( 50, 200 )
|
||||||
|
|
||||||
|
local _speed=Speed or Helicopter:GetSpeedMax()*0.5
|
||||||
|
|
||||||
local Route = {}
|
local Route = {}
|
||||||
|
|
||||||
@ -551,7 +552,7 @@ function AI_CARGO_HELICOPTER:onafterPickup( Helicopter, From, Event, To, Coordin
|
|||||||
"RADIO",
|
"RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
150,
|
_speed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -560,7 +561,7 @@ function AI_CARGO_HELICOPTER:onafterPickup( Helicopter, From, Event, To, Coordin
|
|||||||
"RADIO",
|
"RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
150,
|
_speed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -596,8 +597,8 @@ end
|
|||||||
-- @param Event
|
-- @param Event
|
||||||
-- @param To
|
-- @param To
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @param #number Speed
|
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
|
||||||
function AI_CARGO_HELICOPTER:onafterDeploy( Helicopter, From, Event, To, Coordinate )
|
function AI_CARGO_HELICOPTER:onafterDeploy( Helicopter, From, Event, To, Coordinate, Speed )
|
||||||
|
|
||||||
if Helicopter and Helicopter:IsAlive() ~= nil then
|
if Helicopter and Helicopter:IsAlive() ~= nil then
|
||||||
|
|
||||||
@ -608,7 +609,9 @@ function AI_CARGO_HELICOPTER:onafterDeploy( Helicopter, From, Event, To, Coordin
|
|||||||
|
|
||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
Coordinate.y = math.random( 50, 200 )
|
Coordinate.y = math.random( 50, 200 )
|
||||||
|
|
||||||
|
local _speed=Speed or Helicopter:GetSpeedMax()*0.5
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local CoordinateFrom = Helicopter:GetCoordinate()
|
local CoordinateFrom = Helicopter:GetCoordinate()
|
||||||
@ -616,7 +619,7 @@ function AI_CARGO_HELICOPTER:onafterDeploy( Helicopter, From, Event, To, Coordin
|
|||||||
"RADIO",
|
"RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
150,
|
_speed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
Route[#Route+1] = WaypointFrom
|
Route[#Route+1] = WaypointFrom
|
||||||
@ -628,7 +631,7 @@ function AI_CARGO_HELICOPTER:onafterDeploy( Helicopter, From, Event, To, Coordin
|
|||||||
"RADIO",
|
"RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
150,
|
_speed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -641,7 +644,7 @@ function AI_CARGO_HELICOPTER:onafterDeploy( Helicopter, From, Event, To, Coordin
|
|||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
|
|
||||||
Tasks[#Tasks+1] = Helicopter:TaskFunction( "AI_CARGO_HELICOPTER._Deploy", self, Coordinate )
|
Tasks[#Tasks+1] = Helicopter:TaskFunction( "AI_CARGO_HELICOPTER._Deploy", self, Coordinate )
|
||||||
Tasks[#Tasks+1] = Helicopter:TaskOrbitCircle( math.random( 30, 100 ), 150, CoordinateTo:GetRandomCoordinateInRadius( 800, 500 ) )
|
Tasks[#Tasks+1] = Helicopter:TaskOrbitCircle( math.random( 30, 100 ), _speed, CoordinateTo:GetRandomCoordinateInRadius( 800, 500 ) )
|
||||||
|
|
||||||
--Tasks[#Tasks+1] = Helicopter:TaskLandAtVec2( CoordinateTo:GetVec2() )
|
--Tasks[#Tasks+1] = Helicopter:TaskLandAtVec2( CoordinateTo:GetVec2() )
|
||||||
Route[#Route].task = Helicopter:TaskCombo( Tasks )
|
Route[#Route].task = Helicopter:TaskCombo( Tasks )
|
||||||
@ -662,8 +665,8 @@ end
|
|||||||
-- @param Event
|
-- @param Event
|
||||||
-- @param To
|
-- @param To
|
||||||
-- @param Core.Point#COORDINATE Coordinate
|
-- @param Core.Point#COORDINATE Coordinate
|
||||||
-- @param #number Speed
|
-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go.
|
||||||
function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinate )
|
function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinate, Speed )
|
||||||
|
|
||||||
if Helicopter and Helicopter:IsAlive() ~= nil then
|
if Helicopter and Helicopter:IsAlive() ~= nil then
|
||||||
|
|
||||||
@ -673,7 +676,9 @@ function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinat
|
|||||||
|
|
||||||
--- Calculate the target route point.
|
--- Calculate the target route point.
|
||||||
|
|
||||||
Coordinate.y = math.random( 50, 200 )
|
Coordinate.y = math.random( 50, 200 )
|
||||||
|
|
||||||
|
local _speed=Speed or Helicopter:GetSpeedMax()*0.5
|
||||||
|
|
||||||
--- Create a route point of type air.
|
--- Create a route point of type air.
|
||||||
local CoordinateFrom = Helicopter:GetCoordinate()
|
local CoordinateFrom = Helicopter:GetCoordinate()
|
||||||
@ -681,7 +686,7 @@ function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinat
|
|||||||
"RADIO",
|
"RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
150,
|
_speed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
Route[#Route+1] = WaypointFrom
|
Route[#Route+1] = WaypointFrom
|
||||||
@ -692,7 +697,7 @@ function AI_CARGO_HELICOPTER:onafterHome( Helicopter, From, Event, To, Coordinat
|
|||||||
"RADIO",
|
"RADIO",
|
||||||
POINT_VEC3.RoutePointType.TurningPoint,
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
150,
|
_speed,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user