# HG changeset patch # User KarstenBock@gmx.net # Date 1321187844 -3600 # Node ID 1b66e1ce226b65e7d0514dd8a051b76eb628d357 # Parent 04854cf6e1ac81c6acc635bf3404fa0721c78160 script commands are stored in the System now instead of the the script object. diff -r 04854cf6e1ac -r 1b66e1ce226b systems/scriptingsystem.py --- a/systems/scriptingsystem.py Sat Nov 12 20:54:25 2011 +0100 +++ b/systems/scriptingsystem.py Sun Nov 13 13:37:24 2011 +0100 @@ -17,12 +17,12 @@ class Script(object): """Script object""" - def __init__(self, condition, actions, commands): + def __init__(self, condition, actions, system): """Constructor""" assert(isinstance(actions, deque)) self.condition = condition self.actions = actions - self.commands = commands + self.system = system self.running = False self.finished = False self.time = 0 @@ -45,7 +45,10 @@ if len(action) >= 3: vals = action[3:] if len(action) > 3 else () command = action[2] - self.commands[command](*vals, action=self.cur_action) + self.system.commands[command]( + *vals, + action=self.cur_action + ) else: self.cur_action.execute() except IndexError: @@ -59,11 +62,12 @@ their behavior. """ - def __init__(self, funcs): + def __init__(self, funcs, commands): """Constructor""" self.funcs = funcs self.vals = {} self.scripts = [] + self.commands = commands def step(self, dt): """Execute a time step for the system. Must be defined