annotate src/parpg/world.py @ 91:1bd609af9329

Added equip function.
author KarstenBock@gmx.net
date Wed, 21 Sep 2011 15:43:12 +0200
parents 0319dcc47603
children 0f659c7675f6
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 *
78
c25c734bd2a7 Modifications to make talking with npcs possible again. Special actions won't work yet though.
KarstenBock@gmx.net
parents: 76
diff changeset
2 from bGrease.component import Component
63
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
3
30
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
4 from parpg.mode import FifeMode
63
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
5 from parpg import components
27
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
6
30
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
7 class World(FifeMode, BaseWorld):
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
8
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
9 def __init__(self):
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
10 FifeMode.__init__(self)
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
11 BaseWorld.__init__(self)
63
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
12
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
13 def configure(self):
b15cf999216a Added components to the World class
KarstenBock@gmx.net
parents: 30
diff changeset
14 """Configure the game world's components, systems and renderers"""
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()
67
2265d69ba57c Renamed dialog to dialogue
KarstenBock@gmx.net
parents: 66
diff changeset
19 self.components.dialogue = components.Dialogue()
63
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()
87
b764229a0fad Added ChangeMap component.
KarstenBock@gmx.net
parents: 78
diff changeset
23 self.components.change_map = components.ChangeMap()
90
0319dcc47603 Added equipable component.
KarstenBock@gmx.net
parents: 87
diff changeset
24 self.components.equipable = components.Equipable()
27
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
25
09b581087d68 Added base files for grease
KarstenBock@gmx.net
parents:
diff changeset
26 def pump(self, dt):
30
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
27 for component in self.components:
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
28 if hasattr(component, "step"):
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
29 component.step(dt)
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
30 for system in self.systems:
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
31 if hasattr(system, "step"):
94cb5843dcbb Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents: 27
diff changeset
32 system.step(dt)