Mercurial > parpg-core
annotate src/parpg/world.py @ 74:47e1345fbac2
Fixed NPC behaviour. NPCs are wandering around again.
author | KarstenBock@gmx.net |
---|---|
date | Wed, 07 Sep 2011 14:48:08 +0200 |
parents | 2265d69ba57c |
children | 4934b62e0e48 |
rev | line source |
---|---|
66
96af64cf3b81
Renamed grease to bGrease (Basic Grease) to get rid of conflicts with an already installed grease.
KarstenBock@gmx.net
parents:
63
diff
changeset
|
1 from bGrease.world import * |
63 | 2 |
30
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
3 from parpg.mode import FifeMode |
63 | 4 from parpg import components |
27 | 5 |
30
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
6 class World(FifeMode, BaseWorld): |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
7 |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
8 def __init__(self): |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
9 FifeMode.__init__(self) |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
10 BaseWorld.__init__(self) |
63 | 11 |
12 def configure(self): | |
13 """Configure the game world's components, systems and renderers""" | |
14 self.components.behaviour = components.Behavior() | |
15 self.components.characterstats = components.CharacterStatistics() | |
16 self.components.containable = components.Containable() | |
17 self.components.container = components.Container() | |
18 self.components.description = components.Description() | |
67 | 19 self.components.dialogue = components.Dialogue() |
63 | 20 self.components.fifeagent = components.FifeAgent() |
21 self.components.lockable = components.Lockable() | |
22 self.components.usable = components.Usable() | |
27 | 23 |
24 def pump(self, dt): | |
30
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
25 for component in self.components: |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
26 if hasattr(component, "step"): |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
27 component.step(dt) |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
28 for system in self.systems: |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
29 if hasattr(system, "step"): |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
30 system.step(dt) |