mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fixed bug in Scheduler (a real nasty one) and SET_UNIT
This commit is contained in:
parent
906045a027
commit
c10e293ff7
@ -739,7 +739,7 @@ function DETECTION_AREAS:GetChangeText( DetectedArea )
|
|||||||
end
|
end
|
||||||
|
|
||||||
if ChangeCode == "RAU" then
|
if ChangeCode == "RAU" then
|
||||||
MT[#MT+1] = "Changed area " .. ChangeData.AreaID .. ". Removed the center target " .. ChangeData.AreaUnitType "."
|
MT[#MT+1] = "Changed area " .. ChangeData.AreaID .. ". Removed the center target."
|
||||||
end
|
end
|
||||||
|
|
||||||
if ChangeCode == "AAU" then
|
if ChangeCode == "AAU" then
|
||||||
@ -824,7 +824,7 @@ function DETECTION_AREAS:CreateDetectionSets()
|
|||||||
-- First remove the center unit from the set.
|
-- First remove the center unit from the set.
|
||||||
DetectedSet:RemoveUnitsByName( DetectedArea.Zone.ZoneUNIT.UnitName )
|
DetectedSet:RemoveUnitsByName( DetectedArea.Zone.ZoneUNIT.UnitName )
|
||||||
|
|
||||||
self:AddChangeArea( DetectedArea, 'RAU', DetectedArea.Zone.ZoneUNIT:GetTypeName() )
|
self:AddChangeArea( DetectedArea, 'RAU', "Dummy" )
|
||||||
|
|
||||||
-- Then search for a new center area unit within the set. Note that the new area unit candidate must be within the area range.
|
-- Then search for a new center area unit within the set. Note that the new area unit candidate must be within the area range.
|
||||||
for DetectedUnitName, DetectedUnitData in pairs( DetectedSet:GetSet() ) do
|
for DetectedUnitName, DetectedUnitData in pairs( DetectedSet:GetSet() ) do
|
||||||
|
|||||||
@ -33,14 +33,15 @@ function PROCESS:New( ProcessName, Task, ProcessUnit )
|
|||||||
self.Task = Task
|
self.Task = Task
|
||||||
self.ProcessName = ProcessName
|
self.ProcessName = ProcessName
|
||||||
|
|
||||||
self.ProcessScheduler = SCHEDULER:New( self.Fsm, self.NextEvent )
|
self.ProcessScheduler = SCHEDULER:New()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #PROCESS self
|
--- @param #PROCESS self
|
||||||
function PROCESS:NextEvent( NextEvent, ... )
|
function PROCESS:NextEvent( NextEvent, ... )
|
||||||
self.ProcessScheduler:Schedule( arg, 1 ) -- This schedules the next event, but only if scheduling is activated.
|
self:F(self.ProcessName)
|
||||||
|
self.ProcessScheduler:Schedule( self.Fsm, NextEvent, arg, 1 ) -- This schedules the next event, but only if scheduling is activated.
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #PROCESS self
|
--- @param #PROCESS self
|
||||||
|
|||||||
@ -25,7 +25,7 @@ function PROCESS_DESTROY:New( Task, ProcessName, ProcessUnit, TargetSetUnit )
|
|||||||
|
|
||||||
self.TargetSetUnit = TargetSetUnit
|
self.TargetSetUnit = TargetSetUnit
|
||||||
|
|
||||||
self.DisplayInterval = 60
|
self.DisplayInterval = 30
|
||||||
self.DisplayCount = 30
|
self.DisplayCount = 30
|
||||||
self.DisplayMessage = true
|
self.DisplayMessage = true
|
||||||
self.DisplayTime = 10 -- 10 seconds is the default
|
self.DisplayTime = 10 -- 10 seconds is the default
|
||||||
@ -109,7 +109,7 @@ function PROCESS_DESTROY:OnHitTarget( Fsm, Event, From, To, Event )
|
|||||||
if self.TargetSetUnit:FindUnit( Event.IniUnitName ) then
|
if self.TargetSetUnit:FindUnit( Event.IniUnitName ) then
|
||||||
self.TargetSetUnit:RemoveUnitsByName( Event.IniUnitName )
|
self.TargetSetUnit:RemoveUnitsByName( Event.IniUnitName )
|
||||||
local TaskGroup = self.ProcessUnit:GetGroup()
|
local TaskGroup = self.ProcessUnit:GetGroup()
|
||||||
MESSAGE:New( "You hit a target. Your group with assigned " .. self.Task:GetName() .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed.", 15, "HQ" ):ToGroup( TaskGroup )
|
MESSAGE:New( "You hit a target. Your group with assigned " .. self.Task:GetName() .. " task has " .. self.TargetSetUnit:Count() .. " targets ( " .. self.TargetSetUnit:GetUnitTypesText() .. " ) left to be destroyed.", 15, "HQ" ):ToGroup( TaskGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -58,27 +58,27 @@ function SCHEDULER:New( TimeEventObject, TimeEventFunction, TimeEventFunctionArg
|
|||||||
local self = BASE:Inherit( self, BASE:New() )
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
self:F2( { TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
self:F2( { TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
||||||
|
|
||||||
self.TimeEventObject = TimeEventObject
|
|
||||||
self.TimeEventFunction = TimeEventFunction
|
|
||||||
|
|
||||||
self:Schedule( TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
self:Schedule( TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
||||||
|
|
||||||
self:Start()
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Schedule a new time event. Note that the schedule will only take place if the scheduler is *started*. Even for a single schedule event, the scheduler needs to be started also.
|
--- Schedule a new time event. Note that the schedule will only take place if the scheduler is *started*. Even for a single schedule event, the scheduler needs to be started also.
|
||||||
-- @param #SCHEDULER self
|
-- @param #SCHEDULER self
|
||||||
|
-- @param #table TimeEventObject Specified for which Moose object the timer is setup. If a value of nil is provided, a scheduler will be setup without an object reference.
|
||||||
|
-- @param #function TimeEventFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in TimeEventFunctionArguments.
|
||||||
-- @param #table TimeEventFunctionArguments Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
|
-- @param #table TimeEventFunctionArguments Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
|
||||||
-- @param #number StartSeconds Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
|
-- @param #number StartSeconds Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
|
||||||
-- @param #number RepeatSecondsInterval Specifies the interval in seconds when the scheduler will call the event function.
|
-- @param #number RepeatSecondsInterval Specifies the interval in seconds when the scheduler will call the event function.
|
||||||
-- @param #number RandomizationFactor Specifies a randomization factor between 0 and 1 to randomize the RepeatSecondsInterval.
|
-- @param #number RandomizationFactor Specifies a randomization factor between 0 and 1 to randomize the RepeatSecondsInterval.
|
||||||
-- @param #number StopSeconds Specifies the amount of seconds when the scheduler will be stopped.
|
-- @param #number StopSeconds Specifies the amount of seconds when the scheduler will be stopped.
|
||||||
-- @return #SCHEDULER self
|
-- @return #SCHEDULER self
|
||||||
function SCHEDULER:Schedule( TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
function SCHEDULER:Schedule( TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
||||||
self:F2( { TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
self:F2( { TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
||||||
|
|
||||||
|
self.TimeEventObject = TimeEventObject
|
||||||
|
self.TimeEventFunction = TimeEventFunction
|
||||||
self.TimeEventFunctionArguments = TimeEventFunctionArguments
|
self.TimeEventFunctionArguments = TimeEventFunctionArguments
|
||||||
self.StartSeconds = StartSeconds
|
self.StartSeconds = StartSeconds
|
||||||
self.Repeat = false
|
self.Repeat = false
|
||||||
@ -88,6 +88,8 @@ function SCHEDULER:Schedule( TimeEventFunctionArguments, StartSeconds, RepeatSec
|
|||||||
|
|
||||||
self.StartTime = timer.getTime()
|
self.StartTime = timer.getTime()
|
||||||
|
|
||||||
|
self:Start()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -102,6 +104,9 @@ function SCHEDULER:Start()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.StartSeconds then
|
if self.StartSeconds then
|
||||||
|
if self.ScheduleID then
|
||||||
|
timer.removeFunction( self.ScheduleID )
|
||||||
|
end
|
||||||
self.ScheduleID = timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
|
self.ScheduleID = timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -140,6 +145,13 @@ function SCHEDULER:_Scheduler()
|
|||||||
return errmsg
|
return errmsg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local StartTime = self.StartTime
|
||||||
|
local StopSeconds = self.StopSeconds
|
||||||
|
local Repeat = self.Repeat
|
||||||
|
local RandomizationFactor = self.RandomizationFactor
|
||||||
|
local RepeatSecondsInterval = self.RepeatSecondsInterval
|
||||||
|
local ScheduleID = self.ScheduleID
|
||||||
|
|
||||||
local Status, Result
|
local Status, Result
|
||||||
if self.TimeEventObject then
|
if self.TimeEventObject then
|
||||||
Status, Result = xpcall( function() return self.TimeEventFunction( self.TimeEventObject, unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
Status, Result = xpcall( function() return self.TimeEventFunction( self.TimeEventObject, unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
||||||
@ -147,26 +159,26 @@ function SCHEDULER:_Scheduler()
|
|||||||
Status, Result = xpcall( function() return self.TimeEventFunction( unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
Status, Result = xpcall( function() return self.TimeEventFunction( unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
||||||
end
|
end
|
||||||
|
|
||||||
self:T( { self.TimeEventFunctionArguments, Status, Result, self.StartTime, self.RepeatSecondsInterval, self.RandomizationFactor, self.StopSeconds } )
|
self:T( { "Timer Event2 .. " .. self.ScheduleID, Status, Result, StartTime, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
||||||
|
|
||||||
if Status and ( ( Result == nil ) or ( Result and Result ~= false ) ) then
|
if Status and ( ( Result == nil ) or ( Result and Result ~= false ) ) then
|
||||||
if self.Repeat and ( not self.StopSeconds or ( self.StopSeconds and timer.getTime() <= self.StartTime + self.StopSeconds ) ) then
|
if Repeat and ( not StopSeconds or ( StopSeconds and timer.getTime() <= StartTime + StopSeconds ) ) then
|
||||||
local ScheduleTime =
|
local ScheduleTime =
|
||||||
timer.getTime() +
|
timer.getTime() +
|
||||||
self.RepeatSecondsInterval +
|
self.RepeatSecondsInterval +
|
||||||
math.random(
|
math.random(
|
||||||
- ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ),
|
- ( RandomizationFactor * RepeatSecondsInterval / 2 ),
|
||||||
( self.RandomizationFactor * self.RepeatSecondsInterval / 2 )
|
( RandomizationFactor * RepeatSecondsInterval / 2 )
|
||||||
) +
|
) +
|
||||||
0.01
|
0.01
|
||||||
self:T( { self.TimeEventFunctionArguments, "Repeat:", timer.getTime(), ScheduleTime } )
|
self:T( { self.TimeEventFunctionArguments, "Repeat:", timer.getTime(), ScheduleTime } )
|
||||||
return ScheduleTime -- returns the next time the function needs to be called.
|
return ScheduleTime -- returns the next time the function needs to be called.
|
||||||
else
|
else
|
||||||
timer.removeFunction( self.ScheduleID )
|
timer.removeFunction( ScheduleID )
|
||||||
self.ScheduleID = nil
|
self.ScheduleID = nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
timer.removeFunction( self.ScheduleID )
|
timer.removeFunction( ScheduleID )
|
||||||
self.ScheduleID = nil
|
self.ScheduleID = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -319,6 +319,8 @@ function SET_BASE:Remove( ObjectName )
|
|||||||
|
|
||||||
local t = self.Set[ObjectName]
|
local t = self.Set[ObjectName]
|
||||||
|
|
||||||
|
self:E( { ObjectName, t } )
|
||||||
|
|
||||||
if t then
|
if t then
|
||||||
if t._next then
|
if t._next then
|
||||||
if t._prev then
|
if t._prev then
|
||||||
@ -1132,7 +1134,7 @@ function SET_UNIT:RemoveUnitsByName( RemoveUnitNames )
|
|||||||
local RemoveUnitNamesArray = ( type( RemoveUnitNames ) == "table" ) and RemoveUnitNames or { RemoveUnitNames }
|
local RemoveUnitNamesArray = ( type( RemoveUnitNames ) == "table" ) and RemoveUnitNames or { RemoveUnitNames }
|
||||||
|
|
||||||
for RemoveUnitID, RemoveUnitName in pairs( RemoveUnitNamesArray ) do
|
for RemoveUnitID, RemoveUnitName in pairs( RemoveUnitNamesArray ) do
|
||||||
self:Remove( RemoveUnitName.UnitName )
|
self:Remove( RemoveUnitName )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20160723_1722' )
|
env.info( 'Moose Generation Timestamp: 20160723_2025' )
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
Include = {}
|
Include = {}
|
||||||
@ -6328,27 +6328,27 @@ function SCHEDULER:New( TimeEventObject, TimeEventFunction, TimeEventFunctionArg
|
|||||||
local self = BASE:Inherit( self, BASE:New() )
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
self:F2( { TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
self:F2( { TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
||||||
|
|
||||||
self.TimeEventObject = TimeEventObject
|
|
||||||
self.TimeEventFunction = TimeEventFunction
|
|
||||||
|
|
||||||
self:Schedule( TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
self:Schedule( TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
||||||
|
|
||||||
self:Start()
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Schedule a new time event. Note that the schedule will only take place if the scheduler is *started*. Even for a single schedule event, the scheduler needs to be started also.
|
--- Schedule a new time event. Note that the schedule will only take place if the scheduler is *started*. Even for a single schedule event, the scheduler needs to be started also.
|
||||||
-- @param #SCHEDULER self
|
-- @param #SCHEDULER self
|
||||||
|
-- @param #table TimeEventObject Specified for which Moose object the timer is setup. If a value of nil is provided, a scheduler will be setup without an object reference.
|
||||||
|
-- @param #function TimeEventFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in TimeEventFunctionArguments.
|
||||||
-- @param #table TimeEventFunctionArguments Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
|
-- @param #table TimeEventFunctionArguments Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
|
||||||
-- @param #number StartSeconds Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
|
-- @param #number StartSeconds Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
|
||||||
-- @param #number RepeatSecondsInterval Specifies the interval in seconds when the scheduler will call the event function.
|
-- @param #number RepeatSecondsInterval Specifies the interval in seconds when the scheduler will call the event function.
|
||||||
-- @param #number RandomizationFactor Specifies a randomization factor between 0 and 1 to randomize the RepeatSecondsInterval.
|
-- @param #number RandomizationFactor Specifies a randomization factor between 0 and 1 to randomize the RepeatSecondsInterval.
|
||||||
-- @param #number StopSeconds Specifies the amount of seconds when the scheduler will be stopped.
|
-- @param #number StopSeconds Specifies the amount of seconds when the scheduler will be stopped.
|
||||||
-- @return #SCHEDULER self
|
-- @return #SCHEDULER self
|
||||||
function SCHEDULER:Schedule( TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
function SCHEDULER:Schedule( TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
||||||
self:F2( { TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
self:F2( { TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
||||||
|
|
||||||
|
self.TimeEventObject = TimeEventObject
|
||||||
|
self.TimeEventFunction = TimeEventFunction
|
||||||
self.TimeEventFunctionArguments = TimeEventFunctionArguments
|
self.TimeEventFunctionArguments = TimeEventFunctionArguments
|
||||||
self.StartSeconds = StartSeconds
|
self.StartSeconds = StartSeconds
|
||||||
self.Repeat = false
|
self.Repeat = false
|
||||||
@ -6358,6 +6358,8 @@ function SCHEDULER:Schedule( TimeEventFunctionArguments, StartSeconds, RepeatSec
|
|||||||
|
|
||||||
self.StartTime = timer.getTime()
|
self.StartTime = timer.getTime()
|
||||||
|
|
||||||
|
self:Start()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -6372,6 +6374,9 @@ function SCHEDULER:Start()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.StartSeconds then
|
if self.StartSeconds then
|
||||||
|
if self.ScheduleID then
|
||||||
|
timer.removeFunction( self.ScheduleID )
|
||||||
|
end
|
||||||
self.ScheduleID = timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
|
self.ScheduleID = timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -6410,6 +6415,13 @@ function SCHEDULER:_Scheduler()
|
|||||||
return errmsg
|
return errmsg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local StartTime = self.StartTime
|
||||||
|
local StopSeconds = self.StopSeconds
|
||||||
|
local Repeat = self.Repeat
|
||||||
|
local RandomizationFactor = self.RandomizationFactor
|
||||||
|
local RepeatSecondsInterval = self.RepeatSecondsInterval
|
||||||
|
local ScheduleID = self.ScheduleID
|
||||||
|
|
||||||
local Status, Result
|
local Status, Result
|
||||||
if self.TimeEventObject then
|
if self.TimeEventObject then
|
||||||
Status, Result = xpcall( function() return self.TimeEventFunction( self.TimeEventObject, unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
Status, Result = xpcall( function() return self.TimeEventFunction( self.TimeEventObject, unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
||||||
@ -6417,26 +6429,26 @@ function SCHEDULER:_Scheduler()
|
|||||||
Status, Result = xpcall( function() return self.TimeEventFunction( unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
Status, Result = xpcall( function() return self.TimeEventFunction( unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
||||||
end
|
end
|
||||||
|
|
||||||
self:T( { self.TimeEventFunctionArguments, Status, Result, self.StartTime, self.RepeatSecondsInterval, self.RandomizationFactor, self.StopSeconds } )
|
self:T( { "Timer Event2 .. " .. self.ScheduleID, Status, Result, StartTime, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
||||||
|
|
||||||
if Status and ( ( Result == nil ) or ( Result and Result ~= false ) ) then
|
if Status and ( ( Result == nil ) or ( Result and Result ~= false ) ) then
|
||||||
if self.Repeat and ( not self.StopSeconds or ( self.StopSeconds and timer.getTime() <= self.StartTime + self.StopSeconds ) ) then
|
if Repeat and ( not StopSeconds or ( StopSeconds and timer.getTime() <= StartTime + StopSeconds ) ) then
|
||||||
local ScheduleTime =
|
local ScheduleTime =
|
||||||
timer.getTime() +
|
timer.getTime() +
|
||||||
self.RepeatSecondsInterval +
|
self.RepeatSecondsInterval +
|
||||||
math.random(
|
math.random(
|
||||||
- ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ),
|
- ( RandomizationFactor * RepeatSecondsInterval / 2 ),
|
||||||
( self.RandomizationFactor * self.RepeatSecondsInterval / 2 )
|
( RandomizationFactor * RepeatSecondsInterval / 2 )
|
||||||
) +
|
) +
|
||||||
0.01
|
0.01
|
||||||
self:T( { self.TimeEventFunctionArguments, "Repeat:", timer.getTime(), ScheduleTime } )
|
self:T( { self.TimeEventFunctionArguments, "Repeat:", timer.getTime(), ScheduleTime } )
|
||||||
return ScheduleTime -- returns the next time the function needs to be called.
|
return ScheduleTime -- returns the next time the function needs to be called.
|
||||||
else
|
else
|
||||||
timer.removeFunction( self.ScheduleID )
|
timer.removeFunction( ScheduleID )
|
||||||
self.ScheduleID = nil
|
self.ScheduleID = nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
timer.removeFunction( self.ScheduleID )
|
timer.removeFunction( ScheduleID )
|
||||||
self.ScheduleID = nil
|
self.ScheduleID = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -7693,7 +7705,6 @@ do -- MENU_CLIENT
|
|||||||
--
|
--
|
||||||
-- --- @param Client#CLIENT MenuClient
|
-- --- @param Client#CLIENT MenuClient
|
||||||
-- local function AddStatusMenu( MenuClient )
|
-- local function AddStatusMenu( MenuClient )
|
||||||
-- env.info(MenuClient.ClientName)
|
|
||||||
-- local MenuClientName = MenuClient:GetName()
|
-- local MenuClientName = MenuClient:GetName()
|
||||||
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
||||||
-- MenuStatus[MenuClientName] = MENU_CLIENT:New( MenuClient, "Status for Planes" )
|
-- MenuStatus[MenuClientName] = MENU_CLIENT:New( MenuClient, "Status for Planes" )
|
||||||
@ -7920,7 +7931,6 @@ do
|
|||||||
--
|
--
|
||||||
-- --- @param Group#GROUP MenuGroup
|
-- --- @param Group#GROUP MenuGroup
|
||||||
-- local function AddStatusMenu( MenuGroup )
|
-- local function AddStatusMenu( MenuGroup )
|
||||||
-- env.info(MenuGroup.GroupName)
|
|
||||||
-- local MenuGroupName = MenuGroup:GetName()
|
-- local MenuGroupName = MenuGroup:GetName()
|
||||||
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
||||||
-- MenuStatus[MenuGroupName] = MENU_GROUP:New( MenuGroup, "Status for Planes" )
|
-- MenuStatus[MenuGroupName] = MENU_GROUP:New( MenuGroup, "Status for Planes" )
|
||||||
@ -12189,6 +12199,8 @@ function SET_BASE:Remove( ObjectName )
|
|||||||
|
|
||||||
local t = self.Set[ObjectName]
|
local t = self.Set[ObjectName]
|
||||||
|
|
||||||
|
self:E( { ObjectName, t } )
|
||||||
|
|
||||||
if t then
|
if t then
|
||||||
if t._next then
|
if t._next then
|
||||||
if t._prev then
|
if t._prev then
|
||||||
@ -13002,7 +13014,7 @@ function SET_UNIT:RemoveUnitsByName( RemoveUnitNames )
|
|||||||
local RemoveUnitNamesArray = ( type( RemoveUnitNames ) == "table" ) and RemoveUnitNames or { RemoveUnitNames }
|
local RemoveUnitNamesArray = ( type( RemoveUnitNames ) == "table" ) and RemoveUnitNames or { RemoveUnitNames }
|
||||||
|
|
||||||
for RemoveUnitID, RemoveUnitName in pairs( RemoveUnitNamesArray ) do
|
for RemoveUnitID, RemoveUnitName in pairs( RemoveUnitNamesArray ) do
|
||||||
self:Remove( RemoveUnitName.UnitName )
|
self:Remove( RemoveUnitName )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@ -26372,7 +26384,7 @@ function DETECTION_AREAS:GetChangeText( DetectedArea )
|
|||||||
end
|
end
|
||||||
|
|
||||||
if ChangeCode == "RAU" then
|
if ChangeCode == "RAU" then
|
||||||
MT[#MT+1] = "Changed area " .. ChangeData.AreaID .. ". Removed the center target " .. ChangeData.AreaUnitType "."
|
MT[#MT+1] = "Changed area " .. ChangeData.AreaID .. ". Removed the center target."
|
||||||
end
|
end
|
||||||
|
|
||||||
if ChangeCode == "AAU" then
|
if ChangeCode == "AAU" then
|
||||||
@ -26457,7 +26469,7 @@ function DETECTION_AREAS:CreateDetectionSets()
|
|||||||
-- First remove the center unit from the set.
|
-- First remove the center unit from the set.
|
||||||
DetectedSet:RemoveUnitsByName( DetectedArea.Zone.ZoneUNIT.UnitName )
|
DetectedSet:RemoveUnitsByName( DetectedArea.Zone.ZoneUNIT.UnitName )
|
||||||
|
|
||||||
self:AddChangeArea( DetectedArea, 'RAU', DetectedArea.Zone.ZoneUNIT:GetTypeName() )
|
self:AddChangeArea( DetectedArea, 'RAU', "Dummy" )
|
||||||
|
|
||||||
-- Then search for a new center area unit within the set. Note that the new area unit candidate must be within the area range.
|
-- Then search for a new center area unit within the set. Note that the new area unit candidate must be within the area range.
|
||||||
for DetectedUnitName, DetectedUnitData in pairs( DetectedSet:GetSet() ) do
|
for DetectedUnitName, DetectedUnitData in pairs( DetectedSet:GetSet() ) do
|
||||||
@ -27437,14 +27449,15 @@ function PROCESS:New( ProcessName, Task, ProcessUnit )
|
|||||||
self.Task = Task
|
self.Task = Task
|
||||||
self.ProcessName = ProcessName
|
self.ProcessName = ProcessName
|
||||||
|
|
||||||
self.ProcessScheduler = SCHEDULER:New( self.Fsm, self.NextEvent )
|
self.ProcessScheduler = SCHEDULER:New()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #PROCESS self
|
--- @param #PROCESS self
|
||||||
function PROCESS:NextEvent( NextEvent, ... )
|
function PROCESS:NextEvent( NextEvent, ... )
|
||||||
self.ProcessScheduler:Schedule( arg, 1 ) -- This schedules the next event, but only if scheduling is activated.
|
self:F(self.ProcessName)
|
||||||
|
self.ProcessScheduler:Schedule( self.Fsm, NextEvent, arg, 1 ) -- This schedules the next event, but only if scheduling is activated.
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #PROCESS self
|
--- @param #PROCESS self
|
||||||
@ -27896,7 +27909,7 @@ function PROCESS_DESTROY:New( Task, ProcessName, ProcessUnit, TargetSetUnit )
|
|||||||
|
|
||||||
self.TargetSetUnit = TargetSetUnit
|
self.TargetSetUnit = TargetSetUnit
|
||||||
|
|
||||||
self.DisplayInterval = 60
|
self.DisplayInterval = 30
|
||||||
self.DisplayCount = 30
|
self.DisplayCount = 30
|
||||||
self.DisplayMessage = true
|
self.DisplayMessage = true
|
||||||
self.DisplayTime = 10 -- 10 seconds is the default
|
self.DisplayTime = 10 -- 10 seconds is the default
|
||||||
@ -27980,7 +27993,7 @@ function PROCESS_DESTROY:OnHitTarget( Fsm, Event, From, To, Event )
|
|||||||
if self.TargetSetUnit:FindUnit( Event.IniUnitName ) then
|
if self.TargetSetUnit:FindUnit( Event.IniUnitName ) then
|
||||||
self.TargetSetUnit:RemoveUnitsByName( Event.IniUnitName )
|
self.TargetSetUnit:RemoveUnitsByName( Event.IniUnitName )
|
||||||
local TaskGroup = self.ProcessUnit:GetGroup()
|
local TaskGroup = self.ProcessUnit:GetGroup()
|
||||||
MESSAGE:New( "You hit a target. Your group with assigned " .. self.Task:GetName() .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed.", 15, "HQ" ):ToGroup( TaskGroup )
|
MESSAGE:New( "You hit a target. Your group with assigned " .. self.Task:GetName() .. " task has " .. self.TargetSetUnit:Count() .. " targets ( " .. self.TargetSetUnit:GetUnitTypesText() .. " ) left to be destroyed.", 15, "HQ" ):ToGroup( TaskGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20160723_1722' )
|
env.info( 'Moose Generation Timestamp: 20160723_2025' )
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
Include = {}
|
Include = {}
|
||||||
@ -6328,27 +6328,27 @@ function SCHEDULER:New( TimeEventObject, TimeEventFunction, TimeEventFunctionArg
|
|||||||
local self = BASE:Inherit( self, BASE:New() )
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
self:F2( { TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
self:F2( { TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
||||||
|
|
||||||
self.TimeEventObject = TimeEventObject
|
|
||||||
self.TimeEventFunction = TimeEventFunction
|
|
||||||
|
|
||||||
self:Schedule( TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
self:Schedule( TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
||||||
|
|
||||||
self:Start()
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Schedule a new time event. Note that the schedule will only take place if the scheduler is *started*. Even for a single schedule event, the scheduler needs to be started also.
|
--- Schedule a new time event. Note that the schedule will only take place if the scheduler is *started*. Even for a single schedule event, the scheduler needs to be started also.
|
||||||
-- @param #SCHEDULER self
|
-- @param #SCHEDULER self
|
||||||
|
-- @param #table TimeEventObject Specified for which Moose object the timer is setup. If a value of nil is provided, a scheduler will be setup without an object reference.
|
||||||
|
-- @param #function TimeEventFunction The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in TimeEventFunctionArguments.
|
||||||
-- @param #table TimeEventFunctionArguments Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
|
-- @param #table TimeEventFunctionArguments Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.
|
||||||
-- @param #number StartSeconds Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
|
-- @param #number StartSeconds Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.
|
||||||
-- @param #number RepeatSecondsInterval Specifies the interval in seconds when the scheduler will call the event function.
|
-- @param #number RepeatSecondsInterval Specifies the interval in seconds when the scheduler will call the event function.
|
||||||
-- @param #number RandomizationFactor Specifies a randomization factor between 0 and 1 to randomize the RepeatSecondsInterval.
|
-- @param #number RandomizationFactor Specifies a randomization factor between 0 and 1 to randomize the RepeatSecondsInterval.
|
||||||
-- @param #number StopSeconds Specifies the amount of seconds when the scheduler will be stopped.
|
-- @param #number StopSeconds Specifies the amount of seconds when the scheduler will be stopped.
|
||||||
-- @return #SCHEDULER self
|
-- @return #SCHEDULER self
|
||||||
function SCHEDULER:Schedule( TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
function SCHEDULER:Schedule( TimeEventObject, TimeEventFunction, TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds )
|
||||||
self:F2( { TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
self:F2( { TimeEventFunctionArguments, StartSeconds, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
||||||
|
|
||||||
|
self.TimeEventObject = TimeEventObject
|
||||||
|
self.TimeEventFunction = TimeEventFunction
|
||||||
self.TimeEventFunctionArguments = TimeEventFunctionArguments
|
self.TimeEventFunctionArguments = TimeEventFunctionArguments
|
||||||
self.StartSeconds = StartSeconds
|
self.StartSeconds = StartSeconds
|
||||||
self.Repeat = false
|
self.Repeat = false
|
||||||
@ -6358,6 +6358,8 @@ function SCHEDULER:Schedule( TimeEventFunctionArguments, StartSeconds, RepeatSec
|
|||||||
|
|
||||||
self.StartTime = timer.getTime()
|
self.StartTime = timer.getTime()
|
||||||
|
|
||||||
|
self:Start()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -6372,6 +6374,9 @@ function SCHEDULER:Start()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.StartSeconds then
|
if self.StartSeconds then
|
||||||
|
if self.ScheduleID then
|
||||||
|
timer.removeFunction( self.ScheduleID )
|
||||||
|
end
|
||||||
self.ScheduleID = timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
|
self.ScheduleID = timer.scheduleFunction( self._Scheduler, self, timer.getTime() + self.StartSeconds + .01 )
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -6410,6 +6415,13 @@ function SCHEDULER:_Scheduler()
|
|||||||
return errmsg
|
return errmsg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local StartTime = self.StartTime
|
||||||
|
local StopSeconds = self.StopSeconds
|
||||||
|
local Repeat = self.Repeat
|
||||||
|
local RandomizationFactor = self.RandomizationFactor
|
||||||
|
local RepeatSecondsInterval = self.RepeatSecondsInterval
|
||||||
|
local ScheduleID = self.ScheduleID
|
||||||
|
|
||||||
local Status, Result
|
local Status, Result
|
||||||
if self.TimeEventObject then
|
if self.TimeEventObject then
|
||||||
Status, Result = xpcall( function() return self.TimeEventFunction( self.TimeEventObject, unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
Status, Result = xpcall( function() return self.TimeEventFunction( self.TimeEventObject, unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
||||||
@ -6417,26 +6429,26 @@ function SCHEDULER:_Scheduler()
|
|||||||
Status, Result = xpcall( function() return self.TimeEventFunction( unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
Status, Result = xpcall( function() return self.TimeEventFunction( unpack( self.TimeEventFunctionArguments ) ) end, ErrorHandler )
|
||||||
end
|
end
|
||||||
|
|
||||||
self:T( { self.TimeEventFunctionArguments, Status, Result, self.StartTime, self.RepeatSecondsInterval, self.RandomizationFactor, self.StopSeconds } )
|
self:T( { "Timer Event2 .. " .. self.ScheduleID, Status, Result, StartTime, RepeatSecondsInterval, RandomizationFactor, StopSeconds } )
|
||||||
|
|
||||||
if Status and ( ( Result == nil ) or ( Result and Result ~= false ) ) then
|
if Status and ( ( Result == nil ) or ( Result and Result ~= false ) ) then
|
||||||
if self.Repeat and ( not self.StopSeconds or ( self.StopSeconds and timer.getTime() <= self.StartTime + self.StopSeconds ) ) then
|
if Repeat and ( not StopSeconds or ( StopSeconds and timer.getTime() <= StartTime + StopSeconds ) ) then
|
||||||
local ScheduleTime =
|
local ScheduleTime =
|
||||||
timer.getTime() +
|
timer.getTime() +
|
||||||
self.RepeatSecondsInterval +
|
self.RepeatSecondsInterval +
|
||||||
math.random(
|
math.random(
|
||||||
- ( self.RandomizationFactor * self.RepeatSecondsInterval / 2 ),
|
- ( RandomizationFactor * RepeatSecondsInterval / 2 ),
|
||||||
( self.RandomizationFactor * self.RepeatSecondsInterval / 2 )
|
( RandomizationFactor * RepeatSecondsInterval / 2 )
|
||||||
) +
|
) +
|
||||||
0.01
|
0.01
|
||||||
self:T( { self.TimeEventFunctionArguments, "Repeat:", timer.getTime(), ScheduleTime } )
|
self:T( { self.TimeEventFunctionArguments, "Repeat:", timer.getTime(), ScheduleTime } )
|
||||||
return ScheduleTime -- returns the next time the function needs to be called.
|
return ScheduleTime -- returns the next time the function needs to be called.
|
||||||
else
|
else
|
||||||
timer.removeFunction( self.ScheduleID )
|
timer.removeFunction( ScheduleID )
|
||||||
self.ScheduleID = nil
|
self.ScheduleID = nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
timer.removeFunction( self.ScheduleID )
|
timer.removeFunction( ScheduleID )
|
||||||
self.ScheduleID = nil
|
self.ScheduleID = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -7693,7 +7705,6 @@ do -- MENU_CLIENT
|
|||||||
--
|
--
|
||||||
-- --- @param Client#CLIENT MenuClient
|
-- --- @param Client#CLIENT MenuClient
|
||||||
-- local function AddStatusMenu( MenuClient )
|
-- local function AddStatusMenu( MenuClient )
|
||||||
-- env.info(MenuClient.ClientName)
|
|
||||||
-- local MenuClientName = MenuClient:GetName()
|
-- local MenuClientName = MenuClient:GetName()
|
||||||
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
||||||
-- MenuStatus[MenuClientName] = MENU_CLIENT:New( MenuClient, "Status for Planes" )
|
-- MenuStatus[MenuClientName] = MENU_CLIENT:New( MenuClient, "Status for Planes" )
|
||||||
@ -7920,7 +7931,6 @@ do
|
|||||||
--
|
--
|
||||||
-- --- @param Group#GROUP MenuGroup
|
-- --- @param Group#GROUP MenuGroup
|
||||||
-- local function AddStatusMenu( MenuGroup )
|
-- local function AddStatusMenu( MenuGroup )
|
||||||
-- env.info(MenuGroup.GroupName)
|
|
||||||
-- local MenuGroupName = MenuGroup:GetName()
|
-- local MenuGroupName = MenuGroup:GetName()
|
||||||
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
-- -- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
||||||
-- MenuStatus[MenuGroupName] = MENU_GROUP:New( MenuGroup, "Status for Planes" )
|
-- MenuStatus[MenuGroupName] = MENU_GROUP:New( MenuGroup, "Status for Planes" )
|
||||||
@ -12189,6 +12199,8 @@ function SET_BASE:Remove( ObjectName )
|
|||||||
|
|
||||||
local t = self.Set[ObjectName]
|
local t = self.Set[ObjectName]
|
||||||
|
|
||||||
|
self:E( { ObjectName, t } )
|
||||||
|
|
||||||
if t then
|
if t then
|
||||||
if t._next then
|
if t._next then
|
||||||
if t._prev then
|
if t._prev then
|
||||||
@ -13002,7 +13014,7 @@ function SET_UNIT:RemoveUnitsByName( RemoveUnitNames )
|
|||||||
local RemoveUnitNamesArray = ( type( RemoveUnitNames ) == "table" ) and RemoveUnitNames or { RemoveUnitNames }
|
local RemoveUnitNamesArray = ( type( RemoveUnitNames ) == "table" ) and RemoveUnitNames or { RemoveUnitNames }
|
||||||
|
|
||||||
for RemoveUnitID, RemoveUnitName in pairs( RemoveUnitNamesArray ) do
|
for RemoveUnitID, RemoveUnitName in pairs( RemoveUnitNamesArray ) do
|
||||||
self:Remove( RemoveUnitName.UnitName )
|
self:Remove( RemoveUnitName )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@ -26372,7 +26384,7 @@ function DETECTION_AREAS:GetChangeText( DetectedArea )
|
|||||||
end
|
end
|
||||||
|
|
||||||
if ChangeCode == "RAU" then
|
if ChangeCode == "RAU" then
|
||||||
MT[#MT+1] = "Changed area " .. ChangeData.AreaID .. ". Removed the center target " .. ChangeData.AreaUnitType "."
|
MT[#MT+1] = "Changed area " .. ChangeData.AreaID .. ". Removed the center target."
|
||||||
end
|
end
|
||||||
|
|
||||||
if ChangeCode == "AAU" then
|
if ChangeCode == "AAU" then
|
||||||
@ -26457,7 +26469,7 @@ function DETECTION_AREAS:CreateDetectionSets()
|
|||||||
-- First remove the center unit from the set.
|
-- First remove the center unit from the set.
|
||||||
DetectedSet:RemoveUnitsByName( DetectedArea.Zone.ZoneUNIT.UnitName )
|
DetectedSet:RemoveUnitsByName( DetectedArea.Zone.ZoneUNIT.UnitName )
|
||||||
|
|
||||||
self:AddChangeArea( DetectedArea, 'RAU', DetectedArea.Zone.ZoneUNIT:GetTypeName() )
|
self:AddChangeArea( DetectedArea, 'RAU', "Dummy" )
|
||||||
|
|
||||||
-- Then search for a new center area unit within the set. Note that the new area unit candidate must be within the area range.
|
-- Then search for a new center area unit within the set. Note that the new area unit candidate must be within the area range.
|
||||||
for DetectedUnitName, DetectedUnitData in pairs( DetectedSet:GetSet() ) do
|
for DetectedUnitName, DetectedUnitData in pairs( DetectedSet:GetSet() ) do
|
||||||
@ -27437,14 +27449,15 @@ function PROCESS:New( ProcessName, Task, ProcessUnit )
|
|||||||
self.Task = Task
|
self.Task = Task
|
||||||
self.ProcessName = ProcessName
|
self.ProcessName = ProcessName
|
||||||
|
|
||||||
self.ProcessScheduler = SCHEDULER:New( self.Fsm, self.NextEvent )
|
self.ProcessScheduler = SCHEDULER:New()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #PROCESS self
|
--- @param #PROCESS self
|
||||||
function PROCESS:NextEvent( NextEvent, ... )
|
function PROCESS:NextEvent( NextEvent, ... )
|
||||||
self.ProcessScheduler:Schedule( arg, 1 ) -- This schedules the next event, but only if scheduling is activated.
|
self:F(self.ProcessName)
|
||||||
|
self.ProcessScheduler:Schedule( self.Fsm, NextEvent, arg, 1 ) -- This schedules the next event, but only if scheduling is activated.
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param #PROCESS self
|
--- @param #PROCESS self
|
||||||
@ -27896,7 +27909,7 @@ function PROCESS_DESTROY:New( Task, ProcessName, ProcessUnit, TargetSetUnit )
|
|||||||
|
|
||||||
self.TargetSetUnit = TargetSetUnit
|
self.TargetSetUnit = TargetSetUnit
|
||||||
|
|
||||||
self.DisplayInterval = 60
|
self.DisplayInterval = 30
|
||||||
self.DisplayCount = 30
|
self.DisplayCount = 30
|
||||||
self.DisplayMessage = true
|
self.DisplayMessage = true
|
||||||
self.DisplayTime = 10 -- 10 seconds is the default
|
self.DisplayTime = 10 -- 10 seconds is the default
|
||||||
@ -27980,7 +27993,7 @@ function PROCESS_DESTROY:OnHitTarget( Fsm, Event, From, To, Event )
|
|||||||
if self.TargetSetUnit:FindUnit( Event.IniUnitName ) then
|
if self.TargetSetUnit:FindUnit( Event.IniUnitName ) then
|
||||||
self.TargetSetUnit:RemoveUnitsByName( Event.IniUnitName )
|
self.TargetSetUnit:RemoveUnitsByName( Event.IniUnitName )
|
||||||
local TaskGroup = self.ProcessUnit:GetGroup()
|
local TaskGroup = self.ProcessUnit:GetGroup()
|
||||||
MESSAGE:New( "You hit a target. Your group with assigned " .. self.Task:GetName() .. " task has " .. self.TargetSetUnit:GetUnitTypesText() .. " targets left to be destroyed.", 15, "HQ" ):ToGroup( TaskGroup )
|
MESSAGE:New( "You hit a target. Your group with assigned " .. self.Task:GetName() .. " task has " .. self.TargetSetUnit:Count() .. " targets ( " .. self.TargetSetUnit:GetUnitTypesText() .. " ) left to be destroyed.", 15, "HQ" ):ToGroup( TaskGroup )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user