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, ... ) return function( self, DelaySeconds, ... )
self:T2( "Delayed Event: " .. EventName ) self:T2( "Delayed Event: " .. EventName )
local CallID = 0 local CallID = 0
if DelaySeconds < 0 then -- Only call the event ONCE! if DelaySeconds ~= nil then
DelaySeconds = math.abs( DelaySeconds ) if DelaySeconds < 0 then -- Only call the event ONCE!
if not self._EventSchedules[EventName] then DelaySeconds = math.abs( DelaySeconds )
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 ) if not self._EventSchedules[EventName] then
self._EventSchedules[EventName] = CallID CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
self._EventSchedules[EventName] = CallID
else
-- reschedule
end
else else
-- reschedule CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
end end
else 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 end
self:T2( { CallID = CallID } ) self:T2( { CallID = CallID } )
end end

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' ) env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170208_1506' ) env.info( 'Moose Generation Timestamp: 20170214_1049' )
local base = _G local base = _G
Include = {} Include = {}
@ -11566,16 +11566,20 @@ do -- FSM
return function( self, DelaySeconds, ... ) return function( self, DelaySeconds, ... )
self:T2( "Delayed Event: " .. EventName ) self:T2( "Delayed Event: " .. EventName )
local CallID = 0 local CallID = 0
if DelaySeconds < 0 then -- Only call the event ONCE! if DelaySeconds ~= nil then
DelaySeconds = math.abs( DelaySeconds ) if DelaySeconds < 0 then -- Only call the event ONCE!
if not self._EventSchedules[EventName] then DelaySeconds = math.abs( DelaySeconds )
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 ) if not self._EventSchedules[EventName] then
self._EventSchedules[EventName] = CallID CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
self._EventSchedules[EventName] = CallID
else
-- reschedule
end
else else
-- reschedule CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
end end
else 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 end
self:T2( { CallID = CallID } ) self:T2( { CallID = CallID } )
end end

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' ) env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170208_1506' ) env.info( 'Moose Generation Timestamp: 20170214_1049' )
local base = _G local base = _G
Include = {} Include = {}
@ -11566,16 +11566,20 @@ do -- FSM
return function( self, DelaySeconds, ... ) return function( self, DelaySeconds, ... )
self:T2( "Delayed Event: " .. EventName ) self:T2( "Delayed Event: " .. EventName )
local CallID = 0 local CallID = 0
if DelaySeconds < 0 then -- Only call the event ONCE! if DelaySeconds ~= nil then
DelaySeconds = math.abs( DelaySeconds ) if DelaySeconds < 0 then -- Only call the event ONCE!
if not self._EventSchedules[EventName] then DelaySeconds = math.abs( DelaySeconds )
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 ) if not self._EventSchedules[EventName] then
self._EventSchedules[EventName] = CallID CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
self._EventSchedules[EventName] = CallID
else
-- reschedule
end
else else
-- reschedule CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
end end
else 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 end
self:T2( { CallID = CallID } ) self:T2( { CallID = CallID } )
end end