Mercurial > parpg-core
annotate src/parpg/world.py @ 80:84d03dc70904
Added code that checks if the object is the player so certain actions (talk, attack) will not appear in the menu.
author | KarstenBock@gmx.net |
---|---|
date | Thu, 08 Sep 2011 18:36:40 +0200 |
parents | c25c734bd2a7 |
children | b764229a0fad |
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 | 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 | 5 from parpg import components |
27 | 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 | 12 |
13 def configure(self): | |
14 """Configure the game world's components, systems and renderers""" | |
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() | |
78
c25c734bd2a7
Modifications to make talking with npcs possible again. Special actions won't work yet though.
KarstenBock@gmx.net
parents:
76
diff
changeset
|
23 |
c25c734bd2a7
Modifications to make talking with npcs possible again. Special actions won't work yet though.
KarstenBock@gmx.net
parents:
76
diff
changeset
|
24 #WORKAROUND: To get rid of exception in gamescenecontroller |
c25c734bd2a7
Modifications to make talking with npcs possible again. Special actions won't work yet though.
KarstenBock@gmx.net
parents:
76
diff
changeset
|
25 self.components.change_map = Component() |
27 | 26 |
27 def pump(self, dt): | |
30
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
28 for component in self.components: |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
29 if hasattr(component, "step"): |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
30 component.step(dt) |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
31 for system in self.systems: |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
32 if hasattr(system, "step"): |
94cb5843dcbb
Modifications to use the grease manager and modes
KarstenBock@gmx.net
parents:
27
diff
changeset
|
33 system.step(dt) |