This commit is contained in:
FlightControl_Master
2018-04-11 23:24:13 +02:00
parent 9cea486fdc
commit dcc42b8e62
6 changed files with 29 additions and 26 deletions

View File

@@ -637,12 +637,12 @@ do -- CARGO
-- @param Core.Zone#ZONE_BASE Zone -- @param Core.Zone#ZONE_BASE Zone
-- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone. -- @return #boolean **true** if cargo is in the Zone, **false** if cargo is not in the Zone.
function CARGO:IsInZone( Zone ) function CARGO:IsInZone( Zone )
self:F( { Zone } ) --self:F( { Zone } )
if self:IsLoaded() then if self:IsLoaded() then
return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() ) return Zone:IsPointVec2InZone( self.CargoCarrier:GetPointVec2() )
else else
self:F( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } ) --self:F( { Size = self.CargoObject:GetSize(), Units = self.CargoObject:GetUnits() } )
if self.CargoObject:GetSize() ~= 0 then if self.CargoObject:GetSize() ~= 0 then
return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() ) return Zone:IsPointVec2InZone( self.CargoObject:GetPointVec2() )
else else

View File

@@ -150,7 +150,7 @@ do -- CARGO_GROUP
-- @param #string From -- @param #string From
-- @param #string To -- @param #string To
function CARGO_GROUP:onenterBoarding( From, Event, To, CargoCarrier, NearRadius, ... ) function CARGO_GROUP:onenterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
self:F( { CargoCarrier.UnitName, From, Event, To } ) --self:F( { CargoCarrier.UnitName, From, Event, To } )
local NearRadius = NearRadius or 25 local NearRadius = NearRadius or 25
@@ -175,7 +175,7 @@ do -- CARGO_GROUP
-- @param #string From -- @param #string From
-- @param #string To -- @param #string To
function CARGO_GROUP:onenterLoaded( From, Event, To, CargoCarrier, ... ) function CARGO_GROUP:onenterLoaded( From, Event, To, CargoCarrier, ... )
self:F( { From, Event, To, CargoCarrier, ...} ) --self:F( { From, Event, To, CargoCarrier, ...} )
if From == "UnLoaded" then if From == "UnLoaded" then
-- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier. -- For each Cargo object within the CARGO_GROUP, load each cargo to the CargoCarrier.
@@ -196,7 +196,7 @@ do -- CARGO_GROUP
-- @param #string From -- @param #string From
-- @param #string To -- @param #string To
function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... ) function CARGO_GROUP:onafterBoarding( From, Event, To, CargoCarrier, NearRadius, ... )
self:F( { CargoCarrier.UnitName, From, Event, To } ) --self:F( { CargoCarrier.UnitName, From, Event, To } )
local NearRadius = NearRadius or 100 local NearRadius = NearRadius or 100
@@ -259,7 +259,7 @@ do -- CARGO_GROUP
-- @param #string From -- @param #string From
-- @param #string To -- @param #string To
function CARGO_GROUP:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... ) function CARGO_GROUP:onenterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
self:F( {From, Event, To, ToPointVec2, NearRadius } ) --self:F( {From, Event, To, ToPointVec2, NearRadius } )
NearRadius = NearRadius or 25 NearRadius = NearRadius or 25
@@ -293,7 +293,7 @@ do -- CARGO_GROUP
-- @param #string From -- @param #string From
-- @param #string To -- @param #string To
function CARGO_GROUP:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... ) function CARGO_GROUP:onleaveUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
self:F( { From, Event, To, ToPointVec2, NearRadius } ) --self:F( { From, Event, To, ToPointVec2, NearRadius } )
--local NearRadius = NearRadius or 25 --local NearRadius = NearRadius or 25
@@ -330,7 +330,7 @@ do -- CARGO_GROUP
-- @param #string From -- @param #string From
-- @param #string To -- @param #string To
function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... ) function CARGO_GROUP:onafterUnBoarding( From, Event, To, ToPointVec2, NearRadius, ... )
self:F( { From, Event, To, ToPointVec2, NearRadius } ) --self:F( { From, Event, To, ToPointVec2, NearRadius } )
--local NearRadius = NearRadius or 25 --local NearRadius = NearRadius or 25
@@ -346,7 +346,7 @@ do -- CARGO_GROUP
-- @param #string From -- @param #string From
-- @param #string To -- @param #string To
function CARGO_GROUP:onenterUnLoaded( From, Event, To, ToPointVec2, ... ) function CARGO_GROUP:onenterUnLoaded( From, Event, To, ToPointVec2, ... )
self:F( { From, Event, To, ToPointVec2 } ) --self:F( { From, Event, To, ToPointVec2 } )
if From == "Loaded" then if From == "Loaded" then
@@ -410,7 +410,7 @@ do -- CARGO_GROUP
-- @param #CARGO_GROUP self -- @param #CARGO_GROUP self
-- @param Core.Point#COORDINATE Coordinate -- @param Core.Point#COORDINATE Coordinate
function CARGO_GROUP:RouteTo( Coordinate ) function CARGO_GROUP:RouteTo( Coordinate )
self:F( {Coordinate = Coordinate } ) --self:F( {Coordinate = Coordinate } )
-- For each Cargo within the CargoSet, route each object to the Coordinate -- For each Cargo within the CargoSet, route each object to the Coordinate
self.CargoSet:ForEach( self.CargoSet:ForEach(
@@ -429,7 +429,7 @@ do -- CARGO_GROUP
-- @return #boolean The Cargo is near to the Carrier. -- @return #boolean The Cargo is near to the Carrier.
-- @return #nil The Cargo is not near to the Carrier. -- @return #nil The Cargo is not near to the Carrier.
function CARGO_GROUP:IsNear( CargoCarrier, NearRadius ) function CARGO_GROUP:IsNear( CargoCarrier, NearRadius )
self:F( {NearRadius = NearRadius } ) --self:F( {NearRadius = NearRadius } )
local Cargo = self.CargoSet:GetFirst() -- #CARGO local Cargo = self.CargoSet:GetFirst() -- #CARGO
@@ -445,7 +445,7 @@ do -- CARGO_GROUP
-- @param Core.Point#Coordinate Coordinate -- @param Core.Point#Coordinate Coordinate
-- @return #boolean true if the Cargo Group is within the load radius. -- @return #boolean true if the Cargo Group is within the load radius.
function CARGO_GROUP:IsInLoadRadius( Coordinate ) function CARGO_GROUP:IsInLoadRadius( Coordinate )
self:F( { Coordinate } ) --self:F( { Coordinate } )
local Cargo = self.CargoSet:GetFirst() -- #CARGO local Cargo = self.CargoSet:GetFirst() -- #CARGO
@@ -456,7 +456,7 @@ do -- CARGO_GROUP
else else
Distance = Coordinate:DistanceFromPointVec2( Cargo.CargoObject:GetPointVec2() ) Distance = Coordinate:DistanceFromPointVec2( Cargo.CargoObject:GetPointVec2() )
end end
self:T( Distance ) --self:T( Distance )
if Distance <= self.LoadRadius then if Distance <= self.LoadRadius then
return true return true
@@ -475,7 +475,7 @@ do -- CARGO_GROUP
-- @param Core.Point#Coordinate Coordinate -- @param Core.Point#Coordinate Coordinate
-- @return #boolean true if the Cargo Group is within the report radius. -- @return #boolean true if the Cargo Group is within the report radius.
function CARGO_GROUP:IsInReportRadius( Coordinate ) function CARGO_GROUP:IsInReportRadius( Coordinate )
self:F( { Coordinate } ) --self:F( { Coordinate } )
local Cargo = self.CargoSet:GetFirst() -- #CARGO local Cargo = self.CargoSet:GetFirst() -- #CARGO
@@ -483,7 +483,7 @@ do -- CARGO_GROUP
local Distance = 0 local Distance = 0
if Cargo:IsUnLoaded() then if Cargo:IsUnLoaded() then
Distance = Coordinate:DistanceFromPointVec2( Cargo.CargoObject:GetPointVec2() ) Distance = Coordinate:DistanceFromPointVec2( Cargo.CargoObject:GetPointVec2() )
self:T( Distance ) --self:T( Distance )
if Distance <= self.LoadRadius then if Distance <= self.LoadRadius then
return true return true
end end
@@ -572,7 +572,7 @@ do -- CARGO_GROUP
-- @return #boolean **true** if the first element of the CargoGroup is in the Zone -- @return #boolean **true** if the first element of the CargoGroup is in the Zone
-- @return #boolean **false** if there is no element of the CargoGroup in the Zone. -- @return #boolean **false** if there is no element of the CargoGroup in the Zone.
function CARGO_GROUP:IsInZone( Zone ) function CARGO_GROUP:IsInZone( Zone )
self:F( { Zone } ) --self:F( { Zone } )
local Cargo = self.CargoSet:GetFirst() -- #CARGO local Cargo = self.CargoSet:GetFirst() -- #CARGO

View File

@@ -127,7 +127,7 @@ do -- CARGO_SLINGLOAD
local Distance = 0 local Distance = 0
if self:IsUnLoaded() then if self:IsUnLoaded() then
Distance = Coordinate:DistanceFromPointVec2( self.CargoObject:GetPointVec2() ) Distance = Coordinate:DistanceFromPointVec2( self.CargoObject:GetPointVec2() )
self:T( Distance ) --self:T( Distance )
if Distance <= self.LoadRadius then if Distance <= self.LoadRadius then
return true return true
end end

View File

@@ -934,7 +934,9 @@ do -- FSM_PROCESS
if self[handler] then if self[handler] then
self:F3( "Calling " .. handler ) self:F3( "Calling " .. handler )
self._EventSchedules[EventName] = nil self._EventSchedules[EventName] = nil
local Result, Value = xpcall( function() return self[handler]( self, self.Controllable, self.Task, unpack( params ) ) end, ErrorHandler ) if self.Controllable and self.Controllable:IsAlive() == true then
local Result, Value = xpcall( function() return self[handler]( self, self.Controllable, self.Task, unpack( params ) ) end, ErrorHandler )
end
return Value return Value
--return self[handler]( self, self.Controllable, unpack( params ) ) --return self[handler]( self, self.Controllable, unpack( params ) )
end end

View File

@@ -688,7 +688,8 @@ function TASK:SetMenu( MenuTime ) --R2.1 Mission Reports and Task Reports added.
self:F( { self:GetName(), MenuTime } ) self:F( { self:GetName(), MenuTime } )
--self.SetGroup:Flush() --self.SetGroup:Flush()
for TaskGroupID, TaskGroupData in pairs( self.SetGroup:GetAliveSet() ) do --for TaskGroupID, TaskGroupData in pairs( self.SetGroup:GetAliveSet() ) do
for TaskGroupID, TaskGroupData in pairs( self.SetGroup:GetSet() ) do
local TaskGroup = TaskGroupData -- Wrapper.Group#GROUP local TaskGroup = TaskGroupData -- Wrapper.Group#GROUP
if TaskGroup:IsAlive() == true and TaskGroup:GetPlayerNames() then if TaskGroup:IsAlive() == true and TaskGroup:GetPlayerNames() then
@@ -1444,11 +1445,13 @@ function TASK:GetPlayerCount() --R2.1 Get a count of the players.
local PlayerCount = 0 local PlayerCount = 0
-- Loop each Unit active in the Task, and find Player Names. -- Loop each Unit active in the Task, and find Player Names.
for TaskGroupID, PlayerGroup in pairs( self:GetGroups():GetAliveSet() ) do for TaskGroupID, PlayerGroup in pairs( self:GetGroups():GetSet() ) do
local PlayerGroup = PlayerGroup -- Wrapper.Group#GROUP local PlayerGroup = PlayerGroup -- Wrapper.Group#GROUP
if self:IsGroupAssigned( PlayerGroup ) then if PlayerGroup:IsAlive() == true then
local PlayerNames = PlayerGroup:GetPlayerNames() if self:IsGroupAssigned( PlayerGroup ) then
PlayerCount = PlayerCount + #PlayerNames local PlayerNames = PlayerGroup:GetPlayerNames()
PlayerCount = PlayerCount + #PlayerNames
end
end end
end end

View File

@@ -291,8 +291,7 @@ do -- TASK_CARGO
-- ):SetTime(MenuTime) -- ):SetTime(MenuTime)
-- end -- end
self:F( { CargoUnloaded = Cargo:IsUnLoaded(), CargoLoaded = Cargo:IsLoaded(), CargoItemCount = CargoItemCount } ) --self:F( { CargoUnloaded = Cargo:IsUnLoaded(), CargoLoaded = Cargo:IsLoaded(), CargoItemCount = CargoItemCount } )
Task:E( { TaskDeployZones = Task.DeployZones, TaskName = Task:GetName() } )
local TaskGroup = TaskUnit:GetGroup() local TaskGroup = TaskUnit:GetGroup()
@@ -349,7 +348,6 @@ do -- TASK_CARGO
-- Cargo in deployzones are flagged as deployed. -- Cargo in deployzones are flagged as deployed.
for DeployZoneName, DeployZone in pairs( Task.DeployZones ) do for DeployZoneName, DeployZone in pairs( Task.DeployZones ) do
Task:E( { DeployZone = DeployZone } )
if Cargo:IsInZone( DeployZone ) then if Cargo:IsInZone( DeployZone ) then
Task:E( { CargoIsDeployed = Task.CargoDeployed and "true" or "false" } ) Task:E( { CargoIsDeployed = Task.CargoDeployed and "true" or "false" } )
if Cargo:IsDeployed() == false then if Cargo:IsDeployed() == false then