Mercurial > pyntnclick
annotate gamelib/scenes/crew_quarters.py @ 280:d9b19449436f
The flying fish fix (take 1)
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Fri, 27 Aug 2010 22:35:09 +0200 |
parents | d78ce15bccc8 |
children | 3ac2e025478f |
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 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
14 INITIAL_DATA = { |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
15 'accessible': True, |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
16 } |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
17 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
18 def __init__(self, state): |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
19 super(CrewQuarters, self).__init__(state) |
242 | 20 self.add_thing(ToMap()) |
233
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
21 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
22 def enter(self): |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
23 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
|
24 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
25 |
242 | 26 class ToMap(Door): |
233
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
27 |
252
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
242
diff
changeset
|
28 SCENE = "crew" |
233
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
29 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
30 INTERACTS = { |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
31 "door": InteractText(100, 200, "To Map"), |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
32 } |
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 INITIAL = "door" |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
35 |
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 class Safe(Thing): |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
38 "A safe, for keeping things safe." |
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 NAME = 'crew.safe' |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
41 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
42 INTERACTS = { |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
43 'safe': InteractText(200, 200, 'Safe'), |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
44 } |
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 INITIAL = 'safe' |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
47 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
48 INITIAL_DATA = { |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
49 'is_cracked': False, |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
50 } |
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 def interact_without(self): |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
53 if self.get_data('is_cracked'): |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
54 return Result(detail_view='safe_detail') |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
55 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
|
56 " challenge, if suitable equipment can be found.") |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
57 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
58 def interact_with_stethoscope(self, item): |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
59 if self.get_data('is_cracked'): |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
60 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
|
61 # TODO: Add years to the sentence for safecracking. |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
62 # TODO: Wax lyrical some more about safecracking. |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
63 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
|
64 " almost silently into place. Turns out the combination" |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
65 " 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
|
66 " here.") |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
67 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
68 def get_description(self): |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
69 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
|
70 |
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 class SafeDetail(Scene): |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
73 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
74 FOLDER = 'crew_quarters' |
241
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
233
diff
changeset
|
75 BACKGROUND = None # TODO |
233
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
76 NAME = 'safe_detail' |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
77 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
78 SIZE = (300, 300) |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
79 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
80 def __init__(self, state): |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
81 super(SafeDetail, self).__init__(state) |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
82 |
7399b52f196f
Add a partial crew quarters (eighths?) implementation.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff
changeset
|
83 |
241
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
233
diff
changeset
|
84 SCENES = [CrewQuarters] |
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
233
diff
changeset
|
85 DETAIL_VIEWS = [SafeDetail] |