diff gamelib/scenes/cryo.py @ 55:2e2f6ff54780

Part of the cryo door puzzle.
author Jeremy Thurgood <firxen@gmail.com>
date Mon, 23 Aug 2010 13:27:50 +0200
parents ad6f56bfa8b7
children 75bf3d3689e9
line wrap: on
line diff
--- a/gamelib/scenes/cryo.py	Mon Aug 23 13:23:38 2010 +0200
+++ b/gamelib/scenes/cryo.py	Mon Aug 23 13:27:50 2010 +0200
@@ -44,9 +44,19 @@
     FOLDER = "cryo"
     IMAGE = "cryo_door_closed"
 
+    INITIAL_DATA = {
+        'open': False,
+        }
+
+    def interact(self, item):
+        if self.get_data('open'):
+            print "Door open"
+            return
+        Thing.interact(self, item)
+
     def interact_with_titanium_leg(self, item):
         self.message("You wedge the titanium leg into the chain and twist. With a satisfying *snap*, the chain breaks and the door opens.")
-        self.scene.remove_thing(self)
+        self.open_door()
 
     def interact_without(self):
         self.message("It moves slightly and then stops. A chain on the other side is preventing it from opening completely.")
@@ -58,5 +68,9 @@
                     "The door resists. Try something else, perhaps?",
                     ]))
 
+    def open_door(self):
+        self.set_data('open', True)
+        self.state.scenes['bridge'].set_data('accessible', True)
+
 
 SCENES = [Cryo]