This commit is contained in:
Frank 2018-09-24 10:00:43 +02:00
parent 954ca31c79
commit 483c5deddd
2 changed files with 6 additions and 6 deletions

View File

@ -272,7 +272,7 @@ function AI_CARGO_AIRPLANE:onafterPickup( Airplane, From, Event, To, Coordinate,
-- Get closest airbase of current position. -- Get closest airbase of current position.
local ClosestAirbase, DistToAirbase=Airplane:GetCoordinate():GetClosestAirbase() local ClosestAirbase, DistToAirbase=Airplane:GetCoordinate():GetClosestAirbase()
--env.info("FF onafterpickup closest airbase "..ClosestAirbase:GetName()) --env.info("FF onafterpickup closest airbase "..ClosestAirbase:GetName())
-- Two cases. Aircraft spawned in air or at an airbase. -- Two cases. Aircraft spawned in air or at an airbase.

View File

@ -112,6 +112,8 @@
--- @type AI_CARGO_DISPATCHER --- @type AI_CARGO_DISPATCHER
-- @field Core.Set#SET_ZONE PickupZoneSet
-- @field Core.Set#SET_ZONE DeployZoneSet
-- @extends Core.Fsm#FSM -- @extends Core.Fsm#FSM
@ -557,6 +559,7 @@
AI_CARGO_DISPATCHER = { AI_CARGO_DISPATCHER = {
ClassName = "AI_CARGO_DISPATCHER", ClassName = "AI_CARGO_DISPATCHER",
SetCarrier = nil, SetCarrier = nil,
PickupZoneSet = nil,
DeployZoneSet = nil, DeployZoneSet = nil,
AI_Cargo = {}, AI_Cargo = {},
PickupCargo = {} PickupCargo = {}
@ -1097,10 +1100,8 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
local CargoCoordinate = Cargo:GetCoordinate() local CargoCoordinate = Cargo:GetCoordinate()
local CoordinateFree = true local CoordinateFree = true
--self.PickupZoneSet:Flush() --self.PickupZoneSet:Flush()
env.info("FF pickupzoneset") PickupZone = self.PickupZoneSet:GetRandomZone()
self:E(self.PickupZoneSet) --PickupZone = self.PickupZoneSet and self.PickupZoneSet:IsCoordinateInZone( CargoCoordinate )
PickupZone = self.PickupZoneSet and self.PickupZoneSet:GetRandomZone():IsCoordinateInZone( CargoCoordinate )
self:E(PickupZone)
if not self.PickupZoneSet or PickupZone then if not self.PickupZoneSet or PickupZone then
for CarrierPickup, Coordinate in pairs( self.PickupCargo ) do for CarrierPickup, Coordinate in pairs( self.PickupCargo ) do
if CarrierPickup:IsAlive() == true then if CarrierPickup:IsAlive() == true then
@ -1139,7 +1140,6 @@ function AI_CARGO_DISPATCHER:onafterMonitor()
if PickupCargo then if PickupCargo then
self.CarrierHome[Carrier] = nil self.CarrierHome[Carrier] = nil
local PickupCoordinate = PickupCargo:GetCoordinate():GetRandomCoordinateInRadius( self.PickupOuterRadius, self.PickupInnerRadius ) local PickupCoordinate = PickupCargo:GetCoordinate():GetRandomCoordinateInRadius( self.PickupOuterRadius, self.PickupInnerRadius )
env.info("FF pickup zone = "..tostring(PickupZone:GetName()))
AI_Cargo:Pickup( PickupCoordinate, math.random( self.PickupMinSpeed, self.PickupMaxSpeed ), math.random( self.PickupMinHeight, self.PickupMaxHeight ), PickupZone ) AI_Cargo:Pickup( PickupCoordinate, math.random( self.PickupMinSpeed, self.PickupMaxSpeed ), math.random( self.PickupMinHeight, self.PickupMaxHeight ), PickupZone )
break break
else else