comparison world.py @ 160:75c0b728ccf3

Further work on the scripting system.
author KarstenBock@gmx.net
date Sun, 13 Nov 2011 17:19:14 +0100
parents 79d6b17b80a3
children 2a12e2843984
comparison
equal deleted inserted replaced
159:1b66e1ce226b 160:75c0b728ccf3
1 from parpg.bGrease.world import * 1 from parpg.bGrease.world import *
2 from parpg.bGrease.component import Component 2 from parpg.bGrease.component import Component
3 3
4 from parpg.mode import FifeMode 4 from parpg.mode import FifeMode
5 from parpg import components 5 from parpg import components
6 from parpg.components.fifeagent import commands
6 from parpg.systems import ScriptingSystem 7 from parpg.systems import ScriptingSystem
8 from parpg.entities.action import ACTIONS
7 9
8 class World(FifeMode, BaseWorld): 10 class World(FifeMode, BaseWorld):
9 11
10 def __init__(self): 12 def __init__(self):
11 FifeMode.__init__(self) 13 FifeMode.__init__(self)
13 15
14 def configure(self): 16 def configure(self):
15 """Configure the game world's components, systems and renderers""" 17 """Configure the game world's components, systems and renderers"""
16 for name, component in components.components.iteritems(): 18 for name, component in components.components.iteritems():
17 setattr(self.components, name, component) 19 setattr(self.components, name, component)
18 self.systems.scripting = ScriptingSystem({}) 20 self.systems.scripting = ScriptingSystem(commands, ACTIONS)
19 21
20 def pump(self, dt): 22 def pump(self, dt):
21 for component in self.components: 23 for component in self.components:
22 if hasattr(component, "step"): 24 if hasattr(component, "step"):
23 component.step(dt) 25 component.step(dt)