comparison gamelib/scenes/crew_quarters.py @ 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
children b1451b0b906f
comparison
equal deleted inserted replaced
232:ca490aecbe0e 233:7399b52f196f
1 """Crew quarters."""
2
3 from gamelib.cursor import CursorSprite
4 from gamelib.state import Scene, Item, Thing, Result, InteractText
5
6 class CrewQuarters(Scene):
7
8 FOLDER = "crew_quarters"
9 BACKGROUND = None # TODO
10
11 INITIAL_DATA = {
12 'accessible': True,
13 }
14
15 def __init__(self, state):
16 super(CrewQuarters, self).__init__(state)
17
18 def enter(self):
19 return Result("The crew were a messy bunch. Or maybe that's just the intervening centuries.")
20
21
22 class ToMap(Thing):
23 "Way to map."
24
25 NAME = "crew.tomap"
26 DEST = "map"
27
28 INTERACTS = {
29 "door": InteractText(100, 200, "To Map"),
30 }
31
32 INITIAL = "door"
33
34 def interact_without(self):
35 """Go to map."""
36 self.state.set_current_scene("map")
37
38
39 class Safe(Thing):
40 "A safe, for keeping things safe."
41
42 NAME = 'crew.safe'
43
44 INTERACTS = {
45 'safe': InteractText(200, 200, 'Safe'),
46 }
47
48 INITIAL = 'safe'
49
50 INITIAL_DATA = {
51 'is_cracked': False,
52 }
53
54 def interact_without(self):
55 if self.get_data('is_cracked'):
56 return Result(detail_view='safe_detail')
57 return Result("The safe is locked. This might be an interesting"
58 " challenge, if suitable equipment can be found.")
59
60 def interact_with_stethoscope(self, item):
61 if self.get_data('is_cracked'):
62 return Result("It's already unlocked. There's no more challenge.")
63 # TODO: Add years to the sentence for safecracking.
64 # TODO: Wax lyrical some more about safecracking.
65 return Result("Even after centuries of neglect, the tumblers slide"
66 " almost silently into place. Turns out the combination"
67 " was '1 2 3 4 5'. An idiot must keep his luggage in"
68 " here.")
69
70 def get_description(self):
71 return "Ah, a vintage Knoxx & Co. model QR3. Quaint, but reasonably secure."
72
73
74 class SafeDetail(Scene):
75
76 FOLDER = 'crew_quarters'
77 BACKGROUND = 'triangle.png'
78 NAME = 'safe_detail'
79
80 SIZE = (300, 300)
81
82 def __init__(self, state):
83 super(SafeDetail, self).__init__(state)
84
85
86 SCENES = [Bridge]
87 DETAIL_VIEWS = [ChairDetail]