changeset 117:b10de0310771

Changed way of setting the possible components of the world.
author KarstenBock@gmx.net
date Sat, 24 Sep 2011 16:48:06 +0200
parents 9b5498e3bda0
children 29869273f9e1
files src/parpg/components/__init__.py src/parpg/world.py
diffstat 2 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/parpg/components/__init__.py	Sat Sep 24 15:48:24 2011 +0200
+++ b/src/parpg/components/__init__.py	Sat Sep 24 16:48:06 2011 +0200
@@ -9,4 +9,19 @@
 from change_map import ChangeMap
 from equipable import Equipable
 from equip import Equip
-from general import General
\ No newline at end of file
+from general import General
+
+components = {
+        "general": General(),
+        "characterstats": CharacterStatistics(),
+        "containable": Containable(),
+        "container": Container(),
+        "description": Description(),
+        "dialogue": Dialogue(),
+        "fifeagent": FifeAgent(),
+        "lockable": Lockable(),
+        "usable": Usable(),
+        "change_map": ChangeMap(),
+        "equipable": Equipable(),
+        "equip": Equip(),
+    }
\ No newline at end of file
--- a/src/parpg/world.py	Sat Sep 24 15:48:24 2011 +0200
+++ b/src/parpg/world.py	Sat Sep 24 16:48:06 2011 +0200
@@ -12,18 +12,8 @@
         
     def configure(self):
         """Configure the game world's components, systems and renderers"""
-        self.components.general = components.General()
-        self.components.characterstats = components.CharacterStatistics()
-        self.components.containable = components.Containable()
-        self.components.container = components.Container()
-        self.components.description = components.Description()
-        self.components.dialogue = components.Dialogue()
-        self.components.fifeagent = components.FifeAgent()
-        self.components.lockable = components.Lockable()
-        self.components.usable = components.Usable()
-        self.components.change_map = components.ChangeMap()
-        self.components.equipable = components.Equipable()
-        self.components.equip = components.Equip()
+        for name, component in components.components.iteritems():
+            setattr(self.components, name, component)
     
     def pump(self, dt):
         for component in self.components: