Mercurial > parpg-core
annotate src/parpg/world.py @ 196:7e51bae477f7
Added "None" to the action dict which calls an "no-op" action.
author | KarstenBock@gmx.net |
---|---|
date | Sat, 19 Nov 2011 16:12:56 +0100 |
parents | 191f89a22303 |
children |
rev | line source |
---|---|
92
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
1 from parpg.bGrease.world import * |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
2 from parpg.bGrease.component import Component |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
3 |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
4 from parpg.mode import FifeMode |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
5 from parpg import components |
192 | 6 from parpg.components.fifeagent import commands |
189 | 7 from parpg.systems import ScriptingSystem |
192 | 8 from parpg.entities.action import ACTIONS |
92
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
9 |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
10 class World(FifeMode, BaseWorld): |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
11 |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
12 def __init__(self): |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
13 FifeMode.__init__(self) |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
14 BaseWorld.__init__(self) |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
15 |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
16 def configure(self): |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
17 """Configure the game world's components, systems and renderers""" |
117
b10de0310771
Changed way of setting the possible components of the world.
KarstenBock@gmx.net
parents:
116
diff
changeset
|
18 for name, component in components.components.iteritems(): |
b10de0310771
Changed way of setting the possible components of the world.
KarstenBock@gmx.net
parents:
116
diff
changeset
|
19 setattr(self.components, name, component) |
192 | 20 self.systems.scripting = ScriptingSystem(commands, ACTIONS) |
92
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
21 |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
22 def pump(self, dt): |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
23 for component in self.components: |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
24 if hasattr(component, "step"): |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
25 component.step(dt) |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
26 for system in self.systems: |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
27 if hasattr(system, "step"): |
30
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
28 system.step(dt) |