changeset 151:d00aa26941c4

Add machine and engine rooms to map. Fix typo in name of mess hall doorway thing.
author Simon Cross <hodgestar+bzr@gmail.com>
date Tue, 24 Aug 2010 23:38:04 +0200
parents 5e5d71e40e54
children 296b188a0b73
files gamelib/scenes/engine.py gamelib/scenes/machine.py gamelib/scenes/mess.py
diffstat 3 files changed, 53 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/scenes/engine.py	Tue Aug 24 23:32:05 2010 +0200
+++ b/gamelib/scenes/engine.py	Tue Aug 24 23:38:04 2010 +0200
@@ -1,6 +1,6 @@
 """Engine room where things need to be repaired."""
 
-from gamelib.state import Scene, Item, Thing
+from gamelib.state import Scene, Item, Thing, InteractText, Result
 
 
 class Engine(Scene):
@@ -9,8 +9,32 @@
     BACKGROUND = None # TODO
 
     INITIAL_DATA = {
-        'accessible': False,
+        'accessible': True,
         }
 
+    def __init__(self, state):
+        super(Engine, self).__init__(state)
+        self.add_thing(ToMap())
+
+    def enter(self):
+        return Result("Somewhere in the darkness the engine waits and bides its time.")
+
+
+class ToMap(Thing):
+    "Way to map."
+
+    NAME = "engine.tomap"
+    DEST = "map"
+
+    INTERACTS = {
+        "door": InteractText(100, 200, "To Map"),
+        }
+
+    INITIAL = "door"
+
+    def interact_without(self):
+        """Go to map."""
+        self.state.set_current_scene("map")
+
 
 SCENES = [Engine]
--- a/gamelib/scenes/machine.py	Tue Aug 24 23:32:05 2010 +0200
+++ b/gamelib/scenes/machine.py	Tue Aug 24 23:38:04 2010 +0200
@@ -1,6 +1,6 @@
 """Machine room where tools and machines are found."""
 
-from gamelib.state import Scene, Item, Thing
+from gamelib.state import Scene, Item, Thing, InteractText, Result
 
 
 class Machine(Scene):
@@ -9,8 +9,32 @@
     BACKGROUND = None # TODO
 
     INITIAL_DATA = {
-        'accessible': False,
+        'accessible': True,
         }
 
+    def __init__(self, state):
+        super(Machine, self).__init__(state)
+        self.add_thing(ToMap())
+
+    def enter(self):
+        return Result("The machine room is dark and forbidding.")
+
+
+class ToMap(Thing):
+    "Way to map."
+
+    NAME = "machine.tomap"
+    DEST = "map"
+
+    INTERACTS = {
+        "door": InteractText(100, 200, "To Map"),
+        }
+
+    INITIAL = "door"
+
+    def interact_without(self):
+        """Go to map."""
+        self.state.set_current_scene("map")
+
 
 SCENES = [Machine]
--- a/gamelib/scenes/mess.py	Tue Aug 24 23:32:05 2010 +0200
+++ b/gamelib/scenes/mess.py	Tue Aug 24 23:38:04 2010 +0200
@@ -97,7 +97,7 @@
 class ToMap(Thing):
     "Way to map."
 
-    NAME = "bridge.tomap"
+    NAME = "mess.tomap"
     DEST = "map"
 
     INTERACTS = {