Mercurial > parpg-source
diff systems/scriptingsystem.py @ 161:d224bbce512a
Implemented loading scripts from files.
author | KarstenBock@gmx.net |
---|---|
date | Thu, 17 Nov 2011 20:36:08 +0100 |
parents | 75c0b728ccf3 |
children | ed24962cdf5e |
line wrap: on
line diff
--- a/systems/scriptingsystem.py Sun Nov 13 17:19:14 2011 +0100 +++ b/systems/scriptingsystem.py Thu Nov 17 20:36:08 2011 +0100 @@ -82,12 +82,17 @@ """Constructor""" self.funcs = {} self.vals = {} - self.scripts = {} self.commands = commands - self.conditions = [] self.actions = actions self.game_state = None + self.reset() + def reset(self): + """Resets the script and condition collections""" + self.scripts = {} + self.conditions = [] + + def step(self, dt): """Execute a time step for the system. Must be defined by all system classes. @@ -121,7 +126,10 @@ """Sets a script. @param name: The name of the script @param actions: What the script does + @type actions: deque or iterable """ + if not(isinstance(actions, deque)): + actions = deque(actions) self.scripts[name] = Script(actions, self )