Mercurial > boomslang
annotate gamelib/scenes/map.py @ 408:308a433c4713
Initial map hookup
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 28 Aug 2010 22:05:50 +0200 |
parents | 41ee3fc71404 |
children | 4ce318029cd1 |
rev | line source |
---|---|
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
1 """Neurally implanted schematic for moving around on the ship. |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
2 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
3 It is illegal for prisoners in transit to activate such an |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
4 implant. Failure to comply carries a minimum sentence of |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
5 six months. |
51 | 6 |
7 Many parts of the ship are derelict and inaccessible. | |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
8 """ |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
9 |
263
3b4a78422201
Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents:
241
diff
changeset
|
10 from gamelib.state import Scene, Item, Thing, Result |
212
2b820b4ba3bf
Add constant for player id. Make IDs uppercase
Neil Muller <neil@dip.sun.ac.za>
parents:
210
diff
changeset
|
11 from gamelib.scenes.game_constants import PLAYER_ID |
263
3b4a78422201
Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents:
241
diff
changeset
|
12 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:
241
diff
changeset
|
13 InteractRectUnion, InteractImage, |
360
452230d78541
Use make_jim_dialog everywhere
Neil Muller <neil@dip.sun.ac.za>
parents:
355
diff
changeset
|
14 InteractAnimated, GenericDescThing, |
452230d78541
Use make_jim_dialog everywhere
Neil Muller <neil@dip.sun.ac.za>
parents:
355
diff
changeset
|
15 make_jim_dialog) |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
16 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
17 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
18 class Map(Scene): |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
19 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
20 FOLDER = "map" |
408 | 21 BACKGROUND = 'map.png' |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
22 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
23 INITIAL_DATA = { |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
24 'accessible': True, |
203 | 25 'implant': True, |
408 | 26 } |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
27 |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
28 def __init__(self, state): |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
29 super(Map, self).__init__(state) |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
30 self.add_thing(ToCryo()) |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
31 self.add_thing(ToBridge()) |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
32 self.add_thing(ToMess()) |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
33 self.add_thing(ToEngine()) |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
34 self.add_thing(ToMachine()) |
241
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
224
diff
changeset
|
35 self.add_thing(ToCrew()) |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
36 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
37 def enter(self): |
203 | 38 if self.get_data('implant'): |
39 self.set_data('implant', False) | |
360
452230d78541
Use make_jim_dialog everywhere
Neil Muller <neil@dip.sun.ac.za>
parents:
355
diff
changeset
|
40 ai1 = make_jim_dialog( |
452230d78541
Use make_jim_dialog everywhere
Neil Muller <neil@dip.sun.ac.za>
parents:
355
diff
changeset
|
41 "Under the terms of the emergency conscription " |
224
8d8aef45db4e
fixed some typos
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
212
diff
changeset
|
42 "act, I have downloaded the ship's schematics to your " |
376
41ee3fc71404
Tweaks to text and JIM background.
Jeremy Thurgood <firxen@gmail.com>
parents:
360
diff
changeset
|
43 "neural implant to help you navigate around the ship.", |
41ee3fc71404
Tweaks to text and JIM background.
Jeremy Thurgood <firxen@gmail.com>
parents:
360
diff
changeset
|
44 self.state) |
360
452230d78541
Use make_jim_dialog everywhere
Neil Muller <neil@dip.sun.ac.za>
parents:
355
diff
changeset
|
45 if ai1: |
376
41ee3fc71404
Tweaks to text and JIM background.
Jeremy Thurgood <firxen@gmail.com>
parents:
360
diff
changeset
|
46 return ai1, make_jim_dialog("Prisoner %s, you are classed " |
224
8d8aef45db4e
fixed some typos
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
212
diff
changeset
|
47 "as a class 1 felon. Obtaining access to the ship's schematics " |
8d8aef45db4e
fixed some typos
Adrianna Pińska <adrianna.pinska@gmail.com>
parents:
212
diff
changeset
|
48 "constitutes a level 2 offence and carries a minimal penalty " |
360
452230d78541
Use make_jim_dialog everywhere
Neil Muller <neil@dip.sun.ac.za>
parents:
355
diff
changeset
|
49 "of an additional 3 years on your sentence.'" % PLAYER_ID, self.state) |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
50 |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
51 |
131 | 52 class DoorThing(Thing): |
53 | |
54 # name of destination | |
55 DEST = None | |
56 | |
57 def interact_without(self): | |
58 """Go to destination.""" | |
59 if self.DEST in self.state.scenes: | |
133
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
60 if self.state.scenes[self.DEST].get_data('accessible'): |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
61 self.state.set_current_scene(self.DEST) |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
62 return Result() |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
63 else: |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
64 return Result("You can't go there right now.") |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
65 else: |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
66 return Result("You *could* go there, but it doesn't actually exist.") |
131 | 67 |
68 | |
69 class ToCryo(DoorThing): | |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
70 "Way to cryo room." |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
71 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
72 NAME = "map.tocryo" |
131 | 73 DEST = "cryo" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
74 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
75 INTERACTS = { |
408 | 76 'door': InteractRectUnion(( |
77 (515, 158, 56, 68), | |
78 (361, 519, 245, 29), | |
79 )) | |
80 } | |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
81 |
408 | 82 INITIAL = 'door' |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
83 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
84 |
131 | 85 class ToBridge(DoorThing): |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
86 "Way to bridge room." |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
87 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
88 NAME = "map.tobridge" |
131 | 89 DEST = "bridge" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
90 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
91 INTERACTS = { |
408 | 92 'door': InteractRectUnion(( |
93 (36, 260, 60, 83), | |
94 (26, 177, 71, 21), | |
95 )) | |
96 } | |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
97 |
408 | 98 INITIAL = 'door' |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
99 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
100 |
131 | 101 class ToMess(DoorThing): |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
102 "Way to cryo room." |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
103 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
104 NAME = "map.tomess" |
131 | 105 DEST = "mess" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
106 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
107 INTERACTS = { |
408 | 108 'door': InteractRectUnion(( |
109 (395, 262, 64, 80), | |
110 (341, 434, 110, 27), | |
111 )) | |
112 } | |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
113 |
408 | 114 INITIAL = 'door' |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
115 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
116 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
117 class ToEngine(DoorThing): |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
118 "Way to engine room." |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
119 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
120 NAME = "map.toengine" |
131 | 121 DEST = "engine" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
122 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
123 INTERACTS = { |
408 | 124 'door': InteractRectUnion(( |
125 (691, 279, 76, 54), | |
126 (662, 500, 128, 23), | |
127 )) | |
128 } | |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
129 |
408 | 130 INITIAL = 'door' |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
131 |
343
b3bc101171ea
Don't allow access to the engine room without helmet
Neil Muller <neil@dip.sun.ac.za>
parents:
263
diff
changeset
|
132 def interact_without(self): |
b3bc101171ea
Don't allow access to the engine room without helmet
Neil Muller <neil@dip.sun.ac.za>
parents:
263
diff
changeset
|
133 if not self.state.is_in_inventory('helmet'): |
345
782ff7e53928
Make airlock warning not JIM's
Neil Muller <neil@dip.sun.ac.za>
parents:
343
diff
changeset
|
134 return Result('The airlock refuses to open. The automated' |
782ff7e53928
Make airlock warning not JIM's
Neil Muller <neil@dip.sun.ac.za>
parents:
343
diff
changeset
|
135 ' voice says "Hull breach beyond this door. Personnel' |
782ff7e53928
Make airlock warning not JIM's
Neil Muller <neil@dip.sun.ac.za>
parents:
343
diff
changeset
|
136 ' must be equipped for vacuum before entry"') |
343
b3bc101171ea
Don't allow access to the engine room without helmet
Neil Muller <neil@dip.sun.ac.za>
parents:
263
diff
changeset
|
137 else: |
b3bc101171ea
Don't allow access to the engine room without helmet
Neil Muller <neil@dip.sun.ac.za>
parents:
263
diff
changeset
|
138 return super(ToEngine, self).interact_without() |
b3bc101171ea
Don't allow access to the engine room without helmet
Neil Muller <neil@dip.sun.ac.za>
parents:
263
diff
changeset
|
139 |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
140 |
131 | 141 class ToMachine(DoorThing): |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
142 "Way to machine room." |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
143 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
144 NAME = "map.tomachine" |
131 | 145 DEST = "machine" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
146 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
147 INTERACTS = { |
408 | 148 'door': InteractRectUnion(( |
149 (608, 156, 57, 72), | |
150 (578, 91, 140, 23), | |
151 )) | |
152 } | |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
153 |
408 | 154 INITIAL = 'door' |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
155 |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
156 |
241
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
224
diff
changeset
|
157 class ToCrew(DoorThing): |
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
224
diff
changeset
|
158 "Way to crew quarters." |
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
224
diff
changeset
|
159 |
355
bfb6c682b4fb
Updated walkthrough test as far as completed environmental puzzle.
Jeremy Thurgood <firxen@gmail.com>
parents:
345
diff
changeset
|
160 NAME = "map.tocrew_quarters" |
241
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
224
diff
changeset
|
161 DEST = "crew_quarters" |
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
224
diff
changeset
|
162 |
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
224
diff
changeset
|
163 INTERACTS = { |
408 | 164 'door': InteractRectUnion(( |
165 (210, 321, 37, 64), | |
166 (69, 469, 148, 26), | |
167 )) | |
168 } | |
241
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
224
diff
changeset
|
169 |
408 | 170 INITIAL = 'door' |
241
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
224
diff
changeset
|
171 |
b1451b0b906f
Link crew quarters to map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
224
diff
changeset
|
172 |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
173 SCENES = [Map] |