annotate gamelib/scenes/crew_quarters.py @ 283:3ac2e025478f

Fishbowl and laser lights that don't make the universe go away.
author Jeremy Thurgood <firxen@gmail.com>
date Fri, 27 Aug 2010 23:12:34 +0200
parents d78ce15bccc8
children 2a11709cb427
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
233
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
1 """Crew quarters."""
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
2
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
3 from gamelib.cursor import CursorSprite
263
3b4a78422201 Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents: 252
diff changeset
4 from gamelib.state import Scene, Item, Thing, Result
3b4a78422201 Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents: 252
diff changeset
5 from gamelib.scenes.scene_widgets import (Door, InteractText, InteractNoImage,
3b4a78422201 Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents: 252
diff changeset
6 InteractRectUnion, InteractImage,
3b4a78422201 Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents: 252
diff changeset
7 InteractAnimated, GenericDescThing)
233
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
8
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
9 class CrewQuarters(Scene):
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
10
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
11 FOLDER = "crew_quarters"
275
d78ce15bccc8 Crew quarters background and toolbar on the rect tool.
Jeremy Thurgood <firxen@gmail.com>
parents: 263
diff changeset
12 BACKGROUND = "crew_quarters.png"
233
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
13
283
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
14 OFFSET = (0, -50)
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
15
233
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
16 INITIAL_DATA = {
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
17 'accessible': True,
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
18 }
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
19
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
20 def __init__(self, state):
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
21 super(CrewQuarters, self).__init__(state)
242
12c4f87ea424 Unify doors a bit
Neil Muller <neil@dip.sun.ac.za>
parents: 241
diff changeset
22 self.add_thing(ToMap())
283
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
23 self.add_thing(FishbowlThing())
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
24 self.add_item(Fishbowl('fishbowl'))
233
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
25
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
26 def enter(self):
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
27 return Result("The crew were a messy bunch. Or maybe that's just the intervening centuries.")
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
28
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
29
242
12c4f87ea424 Unify doors a bit
Neil Muller <neil@dip.sun.ac.za>
parents: 241
diff changeset
30 class ToMap(Door):
233
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
31
252
dfc89bc64fdb Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents: 242
diff changeset
32 SCENE = "crew"
233
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
33
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
34 INTERACTS = {
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
35 "door": InteractText(100, 200, "To Map"),
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
36 }
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
37
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
38 INITIAL = "door"
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
39
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
40
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
41 class Safe(Thing):
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
42 "A safe, for keeping things safe."
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
43
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
44 NAME = 'crew.safe'
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
45
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
46 INTERACTS = {
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
47 'safe': InteractText(200, 200, 'Safe'),
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
48 }
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
49
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
50 INITIAL = 'safe'
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
51
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
52 INITIAL_DATA = {
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
53 'is_cracked': False,
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
54 }
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
55
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
56 def interact_without(self):
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
57 if self.get_data('is_cracked'):
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
58 return Result(detail_view='safe_detail')
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
59 return Result("The safe is locked. This might be an interesting"
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
60 " challenge, if suitable equipment can be found.")
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
61
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
62 def interact_with_stethoscope(self, item):
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
63 if self.get_data('is_cracked'):
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
64 return Result("It's already unlocked. There's no more challenge.")
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
65 # TODO: Add years to the sentence for safecracking.
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
66 # TODO: Wax lyrical some more about safecracking.
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
67 return Result("Even after centuries of neglect, the tumblers slide"
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
68 " almost silently into place. Turns out the combination"
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
69 " was '1 2 3 4 5'. An idiot must keep his luggage in"
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
70 " here.")
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
71
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
72 def get_description(self):
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
73 return "Ah, a vintage Knoxx & Co. model QR3. Quaint, but reasonably secure."
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
74
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
75
283
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
76 class FishbowlThing(Thing):
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
77 "A safe, for keeping things safe."
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
78
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
79 NAME = 'crew.fishbowl'
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
80
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
81 INTERACTS = {
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
82 'fishbowl': InteractImage(356, 495, 'fishbowl_on_table.png'),
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
83 'fish_no_bowl': InteractImage(372, 517, 'fish_minus_bowl.png'),
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
84 }
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
85
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
86 INITIAL = 'fishbowl'
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
87
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
88 INITIAL_DATA = {
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
89 'has_bowl': True,
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
90 }
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
91
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
92 def interact_without(self):
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
93 if not self.get_data('has_bowl'):
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
94 return Result("What's the point of lugging around a very dead fish "
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
95 "and a kilogram or so of sand?")
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
96 self.set_interact('fish_no_bowl')
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
97 self.set_data('has_bowl', False)
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
98 self.state.add_inventory_item('fishbowl')
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
99 return Result("The fishbowl is useful, but its contents aren't.")
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
100
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
101 def get_description(self):
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
102 return "This fishbowl looks exactly like an old science fiction space helmet."
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
103
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
104
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
105 class Fishbowl(Item):
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
106 "A bowl. Sans fish."
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
107
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
108 INVENTORY_IMAGE = 'fishbowl.png'
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
109 CURSOR = CursorSprite('fishbowl.png', 29, 27)
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
110
3ac2e025478f Fishbowl and laser lights that don't make the universe go away.
Jeremy Thurgood <firxen@gmail.com>
parents: 275
diff changeset
111
233
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
112 class SafeDetail(Scene):
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
113
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
114 FOLDER = 'crew_quarters'
241
b1451b0b906f Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 233
diff changeset
115 BACKGROUND = None # TODO
233
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
116 NAME = 'safe_detail'
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
117
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
118 SIZE = (300, 300)
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
119
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
120 def __init__(self, state):
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
121 super(SafeDetail, self).__init__(state)
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
122
7399b52f196f Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
123
241
b1451b0b906f Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 233
diff changeset
124 SCENES = [CrewQuarters]
b1451b0b906f Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents: 233
diff changeset
125 DETAIL_VIEWS = [SafeDetail]