Chained events can now be called without delay

This commit is contained in:
Vincent Le Goff 2017-03-26 16:06:26 -07:00 committed by Griatch
parent d483726d54
commit 44a73acd94

View file

@ -75,10 +75,12 @@ def call(obj, event_name, seconds=0):
to be called from inside another event. to be called from inside another event.
""" """
try: script = type(obj.events).script
script = ScriptDB.objects.get(db_key="event_handler") if script:
except ScriptDB.DoesNotExist: # If seconds is 0, call the event immediately
return if seconds == 0:
locals = dict(script.ndb.current_locals)
# Schedule the task obj.events.call(event_name, locals=locals)
script.set_task(seconds, obj, event_name) else:
# Schedule the task
script.set_task(seconds, obj, event_name)