Fix for delayed __Event( DelaySeconds ) trigger

DelaySeconds must ALWAYS be given!
This commit is contained in:
FlightControl 2017-02-14 10:53:46 +01:00
parent 062d241c1c
commit a24717e30e
3 changed files with 35 additions and 23 deletions

View File

@ -617,16 +617,20 @@ do -- FSM
return function( self, DelaySeconds, ... )
self:T2( "Delayed Event: " .. EventName )
local CallID = 0
if DelaySeconds < 0 then -- Only call the event ONCE!
DelaySeconds = math.abs( DelaySeconds )
if not self._EventSchedules[EventName] then
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
self._EventSchedules[EventName] = CallID
if DelaySeconds ~= nil then
if DelaySeconds < 0 then -- Only call the event ONCE!
DelaySeconds = math.abs( DelaySeconds )
if not self._EventSchedules[EventName] then
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
self._EventSchedules[EventName] = CallID
else
-- reschedule
end
else
-- reschedule
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
end
else
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
error( "FSM: An asynchronous event trigger requires a DelaySeconds parameter!!! This can be positive or negative! Sorry, but will not process this." )
end
self:T2( { CallID = CallID } )
end

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170208_1506' )
env.info( 'Moose Generation Timestamp: 20170214_1049' )
local base = _G
Include = {}
@ -11566,16 +11566,20 @@ do -- FSM
return function( self, DelaySeconds, ... )
self:T2( "Delayed Event: " .. EventName )
local CallID = 0
if DelaySeconds < 0 then -- Only call the event ONCE!
DelaySeconds = math.abs( DelaySeconds )
if not self._EventSchedules[EventName] then
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
self._EventSchedules[EventName] = CallID
if DelaySeconds ~= nil then
if DelaySeconds < 0 then -- Only call the event ONCE!
DelaySeconds = math.abs( DelaySeconds )
if not self._EventSchedules[EventName] then
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
self._EventSchedules[EventName] = CallID
else
-- reschedule
end
else
-- reschedule
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
end
else
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
error( "FSM: An asynchronous event trigger requires a DelaySeconds parameter!!! This can be positive or negative! Sorry, but will not process this." )
end
self:T2( { CallID = CallID } )
end

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170208_1506' )
env.info( 'Moose Generation Timestamp: 20170214_1049' )
local base = _G
Include = {}
@ -11566,16 +11566,20 @@ do -- FSM
return function( self, DelaySeconds, ... )
self:T2( "Delayed Event: " .. EventName )
local CallID = 0
if DelaySeconds < 0 then -- Only call the event ONCE!
DelaySeconds = math.abs( DelaySeconds )
if not self._EventSchedules[EventName] then
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
self._EventSchedules[EventName] = CallID
if DelaySeconds ~= nil then
if DelaySeconds < 0 then -- Only call the event ONCE!
DelaySeconds = math.abs( DelaySeconds )
if not self._EventSchedules[EventName] then
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
self._EventSchedules[EventName] = CallID
else
-- reschedule
end
else
-- reschedule
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
end
else
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
error( "FSM: An asynchronous event trigger requires a DelaySeconds parameter!!! This can be positive or negative! Sorry, but will not process this." )
end
self:T2( { CallID = CallID } )
end