Mercurial > parpg-core
annotate src/parpg/world.py @ 116:9b5498e3bda0
Move the identifier field from the FifeAgent component to the new General component.
Added General Entity.
author | KarstenBock@gmx.net |
---|---|
date | Sat, 24 Sep 2011 15:48:24 +0200 |
parents | 915190c0cbc8 |
children | b10de0310771 |
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 |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
6 |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
7 class World(FifeMode, BaseWorld): |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
8 |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
9 def __init__(self): |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
10 FifeMode.__init__(self) |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
11 BaseWorld.__init__(self) |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
12 |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
13 def configure(self): |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
14 """Configure the game world's components, systems and renderers""" |
116
9b5498e3bda0
Move the identifier field from the FifeAgent component to the new General component.
KarstenBock@gmx.net
parents:
97
diff
changeset
|
15 self.components.general = components.General() |
92
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
16 self.components.characterstats = components.CharacterStatistics() |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
17 self.components.containable = components.Containable() |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
18 self.components.container = components.Container() |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
19 self.components.description = components.Description() |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
20 self.components.dialogue = components.Dialogue() |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
21 self.components.fifeagent = components.FifeAgent() |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
22 self.components.lockable = components.Lockable() |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
23 self.components.usable = components.Usable() |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
24 self.components.change_map = components.ChangeMap() |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
25 self.components.equipable = components.Equipable() |
97
915190c0cbc8
Added equip to the usable components of the World class.
KarstenBock@gmx.net
parents:
92
diff
changeset
|
26 self.components.equip = components.Equip() |
92
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
27 |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
28 def pump(self, dt): |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
29 for component in self.components: |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
30 if hasattr(component, "step"): |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
31 component.step(dt) |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
32 for system in self.systems: |
0f659c7675f6
Changed "import bGrease" to "import parpg.bGrease".
KarstenBock@gmx.net
parents:
90
diff
changeset
|
33 if hasattr(system, "step"): |
30
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
34 system.step(dt) |