Mercurial > parpg-source
annotate world.py @ 179:90b2545f7459
This fixes the director exception when running a command in the console.
author | Beliar <KarstenBock@gmx.net> |
---|---|
date | Wed, 07 Mar 2012 20:04:48 +0100 |
parents | 75c0b728ccf3 |
children | 2a12e2843984 |
rev | line source |
---|---|
65
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
1 from parpg.bGrease.world import * |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
2 from parpg.bGrease.component import Component |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
3 |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
4 from parpg.mode import FifeMode |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
5 from parpg import components |
160 | 6 from parpg.components.fifeagent import commands |
157 | 7 from parpg.systems import ScriptingSystem |
160 | 8 from parpg.entities.action import ACTIONS |
65
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
9 |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
10 class World(FifeMode, BaseWorld): |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
11 |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
12 def __init__(self): |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
13 FifeMode.__init__(self) |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
14 BaseWorld.__init__(self) |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
15 |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
16 def configure(self): |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
17 """Configure the game world's components, systems and renderers""" |
87
aed2e094e0c7
Changed way of setting the possible components of the world.
KarstenBock@gmx.net
parents:
86
diff
changeset
|
18 for name, component in components.components.iteritems(): |
aed2e094e0c7
Changed way of setting the possible components of the world.
KarstenBock@gmx.net
parents:
86
diff
changeset
|
19 setattr(self.components, name, component) |
160 | 20 self.systems.scripting = ScriptingSystem(commands, ACTIONS) |
65
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
21 |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
22 def pump(self, dt): |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
23 for component in self.components: |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
24 if hasattr(component, "step"): |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
25 component.step(dt) |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
26 for system in self.systems: |
e856b604b650
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
63
diff
changeset
|
27 if hasattr(system, "step"): |
8
708a6f651c31
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
5
diff
changeset
|
28 system.step(dt) |