annotate src/parpg/world.py @ 63:b15cf999216a

Added components to the World class
author KarstenBock@gmx.net
date Mon, 05 Sep 2011 14:46:43 +0200
parents 94cb5843dcbb
children 96af64cf3b81
rev   line source
30
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
1 from parpg.grease.world import *
63
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
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
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
4 from parpg import components
27
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
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
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
11
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
12 def configure(self):
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
13 """Configure the game world's components, systems and renderers"""
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
14 self.components.behaviour = components.Behavior()
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
15 self.components.characterstats = components.CharacterStatistics()
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
16 self.components.containable = components.Containable()
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
17 self.components.container = components.Container()
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
18 self.components.description = components.Description()
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
19 self.components.dialog = components.Dialog()
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
20 self.components.fifeagent = components.FifeAgent()
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
21 self.components.lockable = components.Lockable()
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
22 self.components.usable = components.Usable()
27
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
23
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
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)