changeset 233:7399b52f196f

Add a partial crew quarters (eighths?) implementation.
author Jeremy Thurgood <firxen@gmail.com>
date Fri, 27 Aug 2010 00:09:01 +0200
parents ca490aecbe0e
children 017ee5c31ba0
files gamelib/scenes/crew_quarters.py
diffstat 1 files changed, 87 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gamelib/scenes/crew_quarters.py	Fri Aug 27 00:09:01 2010 +0200
@@ -0,0 +1,87 @@
+"""Crew quarters."""
+
+from gamelib.cursor import CursorSprite
+from gamelib.state import Scene, Item, Thing, Result, InteractText
+
+class CrewQuarters(Scene):
+
+    FOLDER = "crew_quarters"
+    BACKGROUND = None # TODO
+
+    INITIAL_DATA = {
+        'accessible': True,
+        }
+
+    def __init__(self, state):
+        super(CrewQuarters, self).__init__(state)
+
+    def enter(self):
+        return Result("The crew were a messy bunch. Or maybe that's just the intervening centuries.")
+
+
+class ToMap(Thing):
+    "Way to map."
+
+    NAME = "crew.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")
+
+
+class Safe(Thing):
+    "A safe, for keeping things safe."
+
+    NAME = 'crew.safe'
+
+    INTERACTS = {
+        'safe': InteractText(200, 200, 'Safe'),
+    }
+
+    INITIAL = 'safe'
+
+    INITIAL_DATA = {
+        'is_cracked': False,
+        }
+
+    def interact_without(self):
+        if self.get_data('is_cracked'):
+            return Result(detail_view='safe_detail')
+        return Result("The safe is locked. This might be an interesting"
+                      " challenge, if suitable equipment can be found.")
+
+    def interact_with_stethoscope(self, item):
+        if self.get_data('is_cracked'):
+            return Result("It's already unlocked. There's no more challenge.")
+        # TODO: Add years to the sentence for safecracking.
+        # TODO: Wax lyrical some more about safecracking.
+        return Result("Even after centuries of neglect, the tumblers slide"
+                      " almost silently into place. Turns out the combination"
+                      " was '1 2 3 4 5'. An idiot must keep his luggage in"
+                      " here.")
+
+    def get_description(self):
+        return "Ah, a vintage Knoxx & Co. model QR3. Quaint, but reasonably secure."
+
+
+class SafeDetail(Scene):
+
+    FOLDER = 'crew_quarters'
+    BACKGROUND = 'triangle.png'
+    NAME = 'safe_detail'
+
+    SIZE = (300, 300)
+
+    def __init__(self, state):
+        super(SafeDetail, self).__init__(state)
+
+
+SCENES = [Bridge]
+DETAIL_VIEWS = [ChairDetail]