Mercurial > boomslang
annotate gamelib/scenes/bridge.py @ 844:6a345dcbb209 pyntnclick
Complete textification of the bridge computer
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Wed, 30 Jan 2013 17:33:23 +0200 |
parents | 985e5fbb61f1 |
children |
rev | line source |
---|---|
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
1 """Bridge where the final showdown with the AI occurs.""" |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
2 |
251 | 3 import random |
4 | |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
5 from pygame.colordict import THECOLORS |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
6 from pygame.color import Color |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
7 from pygame.rect import Rect |
248 | 8 |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
9 from pyntnclick.i18n import _ |
840 | 10 from pyntnclick.utils import render_text |
549 | 11 from pyntnclick.cursor import CursorSprite |
12 from pyntnclick.state import Scene, Item, Thing, Result | |
764
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
13 from pyntnclick.scenewidgets import ( |
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
14 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated, |
828 | 15 GenericDescThing, TakeableThing, InteractText) |
263
3b4a78422201
Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents:
259
diff
changeset
|
16 |
352
88c1a59b0544
Add sentence for bridge. Have poster break AI
Neil Muller <neil@dip.sun.ac.za>
parents:
350
diff
changeset
|
17 from gamelib.scenes.game_constants import PLAYER_ID |
525
821b322e903b
Separate "scene widgets" from "game-specific widgets".
Jeremy Thurgood <firxen@gmail.com>
parents:
519
diff
changeset
|
18 from gamelib.scenes.game_widgets import Door, BaseCamera, make_jim_dialog |
263
3b4a78422201
Shuffled a bunch of stuff into more appropriate places.
Jeremy Thurgood <firxen@gmail.com>
parents:
259
diff
changeset
|
19 |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
20 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
21 class Bridge(Scene): |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
22 |
150
5e5d71e40e54
Add bridge and mess to map and ways back.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
120
diff
changeset
|
23 FOLDER = "bridge" |
235 | 24 BACKGROUND = 'bridge.png' |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
25 |
278 | 26 OFFSET = (0, -50) |
27 | |
248 | 28 MUSIC = [ |
256 | 29 'beep1.ogg', |
30 'beep2.ogg', | |
31 'beep880.ogg', | |
248 | 32 'beep660.ogg', |
256 | 33 'beep3.ogg', |
248 | 34 'silent.ogg', |
35 'creaking.ogg', | |
36 'silent.ogg', | |
37 ] | |
38 | |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
39 INITIAL_DATA = { |
543 | 40 'ai status': 'online', # online, looping, dead |
41 'ai panel': 'closed', # closed, open, broken | |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
42 } |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
43 |
592
4e9178215e75
Introduce .setup() for GameDeveloperGizmos.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
578
diff
changeset
|
44 def setup(self): |
315
7b07ffc37ec0
Suspend background sound for bridge computer detail
Neil Muller <neil@dip.sun.ac.za>
parents:
302
diff
changeset
|
45 self.background_playlist = None |
816 | 46 self.add_item_factory(Superconductor) |
47 self.add_item_factory(TapedSuperconductor) | |
48 self.add_item_factory(Stethoscope) | |
150
5e5d71e40e54
Add bridge and mess to map and ways back.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
120
diff
changeset
|
49 self.add_thing(ToMap()) |
350
125cb389ab90
Hook up poster. Add cameras to crew_quarters and bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
341
diff
changeset
|
50 self.add_thing(MonitorCamera()) |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
51 self.add_thing(MassageChair()) |
316
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
52 self.add_thing(MassageChairBase()) |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
53 self.add_thing(StethoscopeThing()) |
237
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
54 self.add_thing(BridgeComputer()) |
251 | 55 self.add_thing(LeftLights()) |
56 self.add_thing(RightLights()) | |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
57 self.add_thing(JimPanel()) |
424
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
58 self.add_thing(StarField()) |
277 | 59 self.add_thing(GenericDescThing('bridge.wires', 1, |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
60 _("The brightly coloured wires contrast with the drab walls."), |
277 | 61 ((46, 4, 711, 143),))) |
62 self.add_thing(GenericDescThing('bridge.note', 2, | |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
63 _("\"Dammit JIM, I'm a doctor, not an engineer!\""), |
277 | 64 ( |
65 (491, 494, 194, 105), | |
66 (422, 533, 71, 66), | |
67 ))) | |
291 | 68 self.doctor = GenericDescThing('bridge.skel', 3, |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
69 _("A skeleton hangs improbably from the wires."), |
291 | 70 ( |
71 (632, 148, 40, 29), | |
72 (683, 176, 30, 101), | |
73 (652, 274, 45, 96), | |
74 (639, 180, 11, 95), | |
75 )) | |
76 self.add_thing(self.doctor) | |
77 | |
120 | 78 def enter(self): |
629 | 79 pieces = [self.sound.get_music(x) for x in self.MUSIC] |
566
ea9dd2b9186a
Hook up sound in gamelib/scenes.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
549
diff
changeset
|
80 self.background_playlist = self.sound.get_playlist(pieces, random=True, |
ea9dd2b9186a
Hook up sound in gamelib/scenes.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
549
diff
changeset
|
81 repeat=True) |
ea9dd2b9186a
Hook up sound in gamelib/scenes.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
549
diff
changeset
|
82 self.sound.change_playlist(self.background_playlist) |
120 | 83 |
248 | 84 def leave(self): |
566
ea9dd2b9186a
Hook up sound in gamelib/scenes.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
549
diff
changeset
|
85 self.sound.change_playlist(None) |
248 | 86 |
120 | 87 |
242 | 88 class ToMap(Door): |
150
5e5d71e40e54
Add bridge and mess to map and ways back.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
120
diff
changeset
|
89 |
252
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
251
diff
changeset
|
90 SCENE = "bridge" |
150
5e5d71e40e54
Add bridge and mess to map and ways back.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
120
diff
changeset
|
91 |
5e5d71e40e54
Add bridge and mess to map and ways back.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
120
diff
changeset
|
92 INTERACTS = { |
235 | 93 "door": InteractNoImage(707, 344, 84, 245), |
150
5e5d71e40e54
Add bridge and mess to map and ways back.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
120
diff
changeset
|
94 } |
5e5d71e40e54
Add bridge and mess to map and ways back.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
120
diff
changeset
|
95 |
5e5d71e40e54
Add bridge and mess to map and ways back.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
120
diff
changeset
|
96 INITIAL = "door" |
5e5d71e40e54
Add bridge and mess to map and ways back.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
120
diff
changeset
|
97 |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
98 |
237
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
99 class BridgeComputer(Thing): |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
100 """The bridge computer. Gives status updates""" |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
101 |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
102 NAME = "bridge.comp" |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
103 |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
104 INTERACTS = { |
543 | 105 'screen': InteractNoImage(338, 296, 123, 74), |
237
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
106 } |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
107 |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
108 INITIAL = 'screen' |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
109 |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
110 def interact_without(self): |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
111 return Result(detail_view='bridge_comp_detail') |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
112 |
474
4060e2dd4757
Add missing item parameter to bridge interact_with_foos
Stefano Rivera <stefano@rivera.za.net>
parents:
472
diff
changeset
|
113 def interact_with_titanium_leg(self, item): |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
114 return Result(_("You can't break the duraplastic screen.")) |
237
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
115 |
474
4060e2dd4757
Add missing item parameter to bridge interact_with_foos
Stefano Rivera <stefano@rivera.za.net>
parents:
472
diff
changeset
|
116 def interact_with_machete(self, item): |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
117 return Result(_("Scratching the screen won't help you.")) |
237
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
118 |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
119 def get_description(self): |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
120 return _("The main bridge computer screen.") |
237
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
121 |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
122 |
330
8f85902f4cb6
Massage chair and base where swapped
Stefano Rivera <stefano@rivera.za.net>
parents:
327
diff
changeset
|
123 class MassageChairBase(Thing): |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
124 "The captain's massage chair, contains superconductor" |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
125 |
330
8f85902f4cb6
Massage chair and base where swapped
Stefano Rivera <stefano@rivera.za.net>
parents:
327
diff
changeset
|
126 NAME = 'bridge.massagechair_base' |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
127 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
128 INTERACTS = { |
316
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
129 'chair': InteractNoImage(127, 518, 69, 64), |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
130 } |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
131 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
132 INITIAL = 'chair' |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
133 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
134 INITIAL_DATA = { |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
135 'contains_superconductor': True, |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
136 } |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
137 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
138 def interact_without(self): |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
139 return Result(detail_view='chair_detail') |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
140 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
141 def get_description(self): |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
142 if self.get_data('contains_superconductor'): |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
143 return _("A top of the line Massage-o-Matic Captain's Executive" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
144 " Command Chair. It's massaging a skeleton.") |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
145 return _("The chair won't work any more, it has no power.") |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
146 |
327
67e8a547970b
More engine room descs
Stefano Rivera <stefano@rivera.za.net>
parents:
316
diff
changeset
|
147 |
330
8f85902f4cb6
Massage chair and base where swapped
Stefano Rivera <stefano@rivera.za.net>
parents:
327
diff
changeset
|
148 class MassageChair(Thing): |
316
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
149 "The captain's massage chair, contains superconductor" |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
150 |
330
8f85902f4cb6
Massage chair and base where swapped
Stefano Rivera <stefano@rivera.za.net>
parents:
327
diff
changeset
|
151 NAME = 'bridge.massagechair' |
316
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
152 |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
153 INTERACTS = { |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
154 'chair': InteractRectUnion(( |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
155 (148, 418, 77, 68), |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
156 (69, 363, 80, 156), |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
157 (104, 514, 18, 40), |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
158 (147, 487, 106, 32), |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
159 (220, 518, 83, 49), |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
160 (196, 502, 75, 34), |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
161 (207, 534, 69, 51), |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
162 )), |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
163 } |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
164 |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
165 INITIAL = 'chair' |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
166 |
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
167 def get_description(self): |
792
bdaffaa8b6bf
Loading and saving! (Plus a bunch of other stuff to make it possible.)
Jeremy Thurgood <firxen@gmail.com>
parents:
774
diff
changeset
|
168 base = self.game.get_current_scene().things['bridge.massagechair_base'] |
bdaffaa8b6bf
Loading and saving! (Plus a bunch of other stuff to make it possible.)
Jeremy Thurgood <firxen@gmail.com>
parents:
774
diff
changeset
|
169 return base.get_description() |
316
4a7aa7fcd191
Only the base of the massage chair brings up the subscene
Stefano Rivera <stefano@rivera.za.net>
parents:
315
diff
changeset
|
170 |
519
8f3c82c685a4
Fix is_interactive() by adding tool param.
Jeremy Thurgood <firxen@gmail.com>
parents:
518
diff
changeset
|
171 def is_interactive(self, tool=None): |
330
8f85902f4cb6
Massage chair and base where swapped
Stefano Rivera <stefano@rivera.za.net>
parents:
327
diff
changeset
|
172 return False |
8f85902f4cb6
Massage chair and base where swapped
Stefano Rivera <stefano@rivera.za.net>
parents:
327
diff
changeset
|
173 |
8f85902f4cb6
Massage chair and base where swapped
Stefano Rivera <stefano@rivera.za.net>
parents:
327
diff
changeset
|
174 |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
175 class Stethoscope(Item): |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
176 "Used for cracking safes. Found on the doctor on the chair" |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
177 |
816 | 178 NAME = 'stethoscope' |
269 | 179 INVENTORY_IMAGE = 'stethoscope.png' |
302
6d93e04036c9
CursorSprite: Default pointer-position to the centre of the cursor
Stefano Rivera <stefano@rivera.za.net>
parents:
293
diff
changeset
|
180 CURSOR = CursorSprite('stethoscope.png') |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
181 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
182 |
764
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
183 class StethoscopeThing(TakeableThing): |
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
184 "Stethoscope on the doctor" |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
185 |
476
c72946d3a59a
Some minor pylint driven style fixes
Neil Muller <neil@dip.sun.ac.za>
parents:
474
diff
changeset
|
186 NAME = 'bridge.stethoscope' |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
187 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
188 INTERACTS = { |
269 | 189 'stethoscope': InteractImage(650, 178, 'hanging_stethoscope.png'), |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
190 } |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
191 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
192 INITIAL = 'stethoscope' |
764
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
193 ITEM = 'stethoscope' |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
194 |
291 | 195 def get_description(self): |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
196 return _("A stethoscope hangs from the neck of the skeleton.") |
291 | 197 |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
198 def interact_without(self): |
764
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
199 self.take() |
291 | 200 # Fill in the doctor's rect |
201 self.scene.doctor.rect.append(self.rect) | |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
202 return Result(_("You pick up the stethoscope and verify that the" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
203 " doctor's heart has stopped. Probably a while ago.")) |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
204 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
205 |
399
1cfcd82519b6
You have to duct tape the superconductor
Stefano Rivera <stefano@rivera.za.net>
parents:
393
diff
changeset
|
206 class TapedSuperconductor(Item): |
1cfcd82519b6
You have to duct tape the superconductor
Stefano Rivera <stefano@rivera.za.net>
parents:
393
diff
changeset
|
207 "Used for connecting high-powered parts of the ship up" |
1cfcd82519b6
You have to duct tape the superconductor
Stefano Rivera <stefano@rivera.za.net>
parents:
393
diff
changeset
|
208 |
816 | 209 NAME = 'taped_superconductor' |
399
1cfcd82519b6
You have to duct tape the superconductor
Stefano Rivera <stefano@rivera.za.net>
parents:
393
diff
changeset
|
210 INVENTORY_IMAGE = 'superconductor_taped.png' |
1cfcd82519b6
You have to duct tape the superconductor
Stefano Rivera <stefano@rivera.za.net>
parents:
393
diff
changeset
|
211 CURSOR = CursorSprite('superconductor_taped_cursor.png') |
1cfcd82519b6
You have to duct tape the superconductor
Stefano Rivera <stefano@rivera.za.net>
parents:
393
diff
changeset
|
212 |
1cfcd82519b6
You have to duct tape the superconductor
Stefano Rivera <stefano@rivera.za.net>
parents:
393
diff
changeset
|
213 |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
214 class Superconductor(Item): |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
215 "Used for connecting high-powered parts of the ship up" |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
216 |
816 | 217 NAME = 'superconductor' |
285
2ec328aeeaf8
Engine room mostly hooked up
Stefano Rivera <stefano@rivera.za.net>
parents:
278
diff
changeset
|
218 INVENTORY_IMAGE = 'superconductor_fixed.png' |
302
6d93e04036c9
CursorSprite: Default pointer-position to the centre of the cursor
Stefano Rivera <stefano@rivera.za.net>
parents:
293
diff
changeset
|
219 CURSOR = CursorSprite('superconductor_fixed.png') |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
220 |
491
9f488671c02e
No more state in Item interacts.
Jeremy Thurgood <firxen@gmail.com>
parents:
476
diff
changeset
|
221 def interact_with_duct_tape(self, item): |
816 | 222 self.game.replace_inventory_item(self.name, 'taped_superconductor') |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
223 return Result(_("You rip off a piece of duct tape and stick it on the" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
224 " superconductor. It almost sticks to itself, but you" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
225 " successfully avoid disaster.")) |
399
1cfcd82519b6
You have to duct tape the superconductor
Stefano Rivera <stefano@rivera.za.net>
parents:
393
diff
changeset
|
226 |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
227 |
764
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
228 class SuperconductorThing(TakeableThing): |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
229 "Superconductor from the massage chair." |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
230 |
476
c72946d3a59a
Some minor pylint driven style fixes
Neil Muller <neil@dip.sun.ac.za>
parents:
474
diff
changeset
|
231 NAME = 'bridge.superconductor' |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
232 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
233 INTERACTS = { |
259
b6e1c4e4e59d
Superconductor Thing now works.
Jeremy Thurgood <firxen@gmail.com>
parents:
257
diff
changeset
|
234 'superconductor': InteractImage(158, 138, 'superconductor.png'), |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
235 } |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
236 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
237 INITIAL = 'superconductor' |
764
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
238 ITEM = 'superconductor' |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
239 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
240 def interact_without(self): |
745
b9504e6ecde1
Make a couple of interactions less dependent on current_scene, so the 'mad clicker' test works
Neil Muller <neil@dip.sun.ac.za>
parents:
655
diff
changeset
|
241 self.game.scenes['bridge'].things['bridge.massagechair_base'] \ |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
242 .set_data('contains_superconductor', False) |
764
a8510f4e2ea1
Conditionally add things based on state.
Jeremy Thurgood <firxen@gmail.com>
parents:
759
diff
changeset
|
243 self.take() |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
244 return (Result(_("The superconductor module unclips easily.")), |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
245 make_jim_dialog(_("Prisoner %s. That chair you've destroyed" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
246 " was property of the ship's captain. " |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
247 "You will surely be punished.") |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
248 % PLAYER_ID, self.game)) |
543 | 249 |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
250 |
424
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
251 class StarField(Thing): |
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
252 |
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
253 NAME = 'bridge.stars' |
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
254 |
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
255 INTERACTS = { |
427 | 256 #'stars' : InteractImage(190, 145, 'stars_3.png'), |
543 | 257 'stars': InteractAnimated(190, 145, |
258 ['stars_%d.png' % (i + 1) for i | |
259 in range(3) + range(1, 0, -1)], 30), | |
424
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
260 } |
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
261 |
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
262 INITIAL = 'stars' |
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
263 |
519
8f3c82c685a4
Fix is_interactive() by adding tool param.
Jeremy Thurgood <firxen@gmail.com>
parents:
518
diff
changeset
|
264 def is_interactive(self, tool=None): |
424
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
265 return False |
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
266 |
8d8ccae862ee
Animated starfield for bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
412
diff
changeset
|
267 |
251 | 268 class BlinkingLights(Thing): |
269 | |
592
4e9178215e75
Introduce .setup() for GameDeveloperGizmos.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
578
diff
changeset
|
270 def setup(self): |
370
8936c043d7a1
Fix bliken lights description
Neil Muller <neil@dip.sun.ac.za>
parents:
369
diff
changeset
|
271 self.description = None |
8936c043d7a1
Fix bliken lights description
Neil Muller <neil@dip.sun.ac.za>
parents:
369
diff
changeset
|
272 |
519
8f3c82c685a4
Fix is_interactive() by adding tool param.
Jeremy Thurgood <firxen@gmail.com>
parents:
518
diff
changeset
|
273 def is_interactive(self, tool=None): |
270
d4f08abc58fb
Interactivity status tweaks
Neil Muller <neil@dip.sun.ac.za>
parents:
269
diff
changeset
|
274 return False |
d4f08abc58fb
Interactivity status tweaks
Neil Muller <neil@dip.sun.ac.za>
parents:
269
diff
changeset
|
275 |
370
8936c043d7a1
Fix bliken lights description
Neil Muller <neil@dip.sun.ac.za>
parents:
369
diff
changeset
|
276 def leave(self): |
8936c043d7a1
Fix bliken lights description
Neil Muller <neil@dip.sun.ac.za>
parents:
369
diff
changeset
|
277 self.description = random.choice([ |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
278 _("The lights flash in interesting patterns."), |
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
279 _("The flashing lights don't mean anything to you."), |
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
280 _("The console lights flash and flicker."), |
251 | 281 ]) |
282 | |
370
8936c043d7a1
Fix bliken lights description
Neil Muller <neil@dip.sun.ac.za>
parents:
369
diff
changeset
|
283 def get_description(self): |
8936c043d7a1
Fix bliken lights description
Neil Muller <neil@dip.sun.ac.za>
parents:
369
diff
changeset
|
284 if not self.description: |
8936c043d7a1
Fix bliken lights description
Neil Muller <neil@dip.sun.ac.za>
parents:
369
diff
changeset
|
285 self.leave() |
8936c043d7a1
Fix bliken lights description
Neil Muller <neil@dip.sun.ac.za>
parents:
369
diff
changeset
|
286 return self.description |
8936c043d7a1
Fix bliken lights description
Neil Muller <neil@dip.sun.ac.za>
parents:
369
diff
changeset
|
287 |
543 | 288 |
251 | 289 class LeftLights(BlinkingLights): |
290 | |
476
c72946d3a59a
Some minor pylint driven style fixes
Neil Muller <neil@dip.sun.ac.za>
parents:
474
diff
changeset
|
291 NAME = 'bridge.lights.1' |
251 | 292 |
293 INTERACTS = { | |
543 | 294 "lights": InteractAnimated(176, 337, |
295 ["bridge_lights_1_1.png", | |
296 "bridge_lights_1_2.png", | |
297 "bridge_lights_1_3.png", | |
298 "bridge_lights_1_2.png"], 5), | |
251 | 299 } |
300 | |
301 INITIAL = 'lights' | |
302 | |
543 | 303 |
251 | 304 class RightLights(BlinkingLights): |
305 | |
476
c72946d3a59a
Some minor pylint driven style fixes
Neil Muller <neil@dip.sun.ac.za>
parents:
474
diff
changeset
|
306 NAME = 'bridge.lights.2' |
251 | 307 |
308 INTERACTS = { | |
543 | 309 "lights": InteractAnimated(559, 332, |
310 ["bridge_lights_2_1.png", | |
311 "bridge_lights_2_2.png", | |
312 "bridge_lights_2_3.png", | |
313 "bridge_lights_2_2.png"], 5), | |
251 | 314 } |
315 | |
316 INITIAL = 'lights' | |
317 | |
543 | 318 |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
319 class JimPanel(Thing): |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
320 "The panel to JIM's internals'" |
251 | 321 |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
322 NAME = "jim_panel" |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
323 |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
324 INTERACTS = { |
543 | 325 'closed': InteractNoImage(506, 430, 137, 47), |
326 'open': InteractImage(500, 427, 'jim_panel_open.png'), | |
327 'broken': InteractImage(488, 412, 'jim_panel_destroyed.png'), | |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
328 } |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
329 |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
330 INITIAL = 'closed' |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
331 |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
332 def get_description(self): |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
333 if self.scene.get_data('ai panel') == 'closed': |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
334 return _("The sign reads 'Warning: Authorized Techinicians Only'.") |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
335 |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
745
diff
changeset
|
336 def select_interact(self): |
774
b0bd36c2c840
The data is actually on the scene (now we can finish the game)
Stefano Rivera <stefano@rivera.za.net>
parents:
770
diff
changeset
|
337 status = self.scene.get_data('ai panel') |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
745
diff
changeset
|
338 return status or self.INITIAL |
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
745
diff
changeset
|
339 |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
340 def interact_without(self): |
655
c77d6aa29bee
Some code to kinda demonstrate the ever so cunning state handling plan
Neil Muller <neil@dip.sun.ac.za>
parents:
629
diff
changeset
|
341 ai_status = self.state.get_jim_state() |
c77d6aa29bee
Some code to kinda demonstrate the ever so cunning state handling plan
Neil Muller <neil@dip.sun.ac.za>
parents:
629
diff
changeset
|
342 if ai_status == 'online': |
472
cab67fd696b9
Fix crash bug on the bridge. (JIM's panel really doesn't like items.)
Jeremy Thurgood <firxen@gmail.com>
parents:
469
diff
changeset
|
343 return self.interact_default(None) |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
344 elif self.scene.get_data('ai panel') == 'closed': |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
345 return Result(_("You are unable to open the panel with your" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
346 " bare hands.")) |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
347 elif self.scene.get_data('ai panel') == 'open': |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
348 self.scene.set_data('ai panel', 'broken') |
655
c77d6aa29bee
Some code to kinda demonstrate the ever so cunning state handling plan
Neil Muller <neil@dip.sun.ac.za>
parents:
629
diff
changeset
|
349 self.state.break_ai() |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
745
diff
changeset
|
350 self.set_interact() |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
351 return Result(_("You unplug various important-looking wires.")) |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
352 |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
353 def interact_with_machete(self, item): |
655
c77d6aa29bee
Some code to kinda demonstrate the ever so cunning state handling plan
Neil Muller <neil@dip.sun.ac.za>
parents:
629
diff
changeset
|
354 ai_status = self.state.get_jim_state() |
c77d6aa29bee
Some code to kinda demonstrate the ever so cunning state handling plan
Neil Muller <neil@dip.sun.ac.za>
parents:
629
diff
changeset
|
355 if ai_status == 'online': |
472
cab67fd696b9
Fix crash bug on the bridge. (JIM's panel really doesn't like items.)
Jeremy Thurgood <firxen@gmail.com>
parents:
469
diff
changeset
|
356 return self.interact_default(item) |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
357 elif self.scene.get_data('ai panel') == 'closed': |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
358 self.scene.set_data('ai panel', 'open') |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
745
diff
changeset
|
359 self.set_interact() |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
360 return Result(_("Using the machete, you lever the panel off.")) |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
361 elif self.scene.get_data('ai panel') == 'open': |
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
362 self.scene.set_data('ai panel', 'broken') |
655
c77d6aa29bee
Some code to kinda demonstrate the ever so cunning state handling plan
Neil Muller <neil@dip.sun.ac.za>
parents:
629
diff
changeset
|
363 self.state.break_ai() |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
745
diff
changeset
|
364 self.set_interact() |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
365 return Result(_("You smash various delicate components with" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
366 " the machete.")) |
354
09efb8b7c132
Hook up panel part of AI puzzle
Neil Muller <neil@dip.sun.ac.za>
parents:
352
diff
changeset
|
367 |
472
cab67fd696b9
Fix crash bug on the bridge. (JIM's panel really doesn't like items.)
Jeremy Thurgood <firxen@gmail.com>
parents:
469
diff
changeset
|
368 def interact_default(self, item): |
655
c77d6aa29bee
Some code to kinda demonstrate the ever so cunning state handling plan
Neil Muller <neil@dip.sun.ac.za>
parents:
629
diff
changeset
|
369 if self.state.get_jim_state() == 'online': |
478
a9925aaf5f61
i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
476
diff
changeset
|
370 return (Result(_('You feel a shock from the panel.')), |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
371 make_jim_dialog(_("Prisoner %s. Please step away from the" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
372 " panel. You are not an authorized" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
373 " technician.") % PLAYER_ID, self.game)) |
543 | 374 |
251 | 375 |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
376 class ChairDetail(Scene): |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
377 |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
378 FOLDER = 'bridge' |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
379 BACKGROUND = 'chair_detail.png' |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
380 NAME = 'chair_detail' |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
381 |
592
4e9178215e75
Introduce .setup() for GameDeveloperGizmos.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
578
diff
changeset
|
382 def setup(self): |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
383 self.add_thing(SuperconductorThing()) |
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
384 |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
385 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
386 # classes related the computer detail |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
387 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
388 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
389 class LogTab(Thing): |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
390 """Tab for log screen""" |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
391 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
392 NAME = 'bridge_comp.screen' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
393 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
394 INTERACTS = { |
840 | 395 'log tab': InteractText(100, 53, 94, 37, _("Logs"), |
396 'lightgreen', 20, 'DejaVuSans-Bold.ttf', True), | |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
397 } |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
398 INITIAL = 'log tab' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
399 COMPUTER = 'bridge_comp_detail' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
400 |
519
8f3c82c685a4
Fix is_interactive() by adding tool param.
Jeremy Thurgood <firxen@gmail.com>
parents:
518
diff
changeset
|
401 def is_interactive(self, tool=None): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
402 return self.game.detail_views[self.COMPUTER].get_data('tab') != 'log' |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
403 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
404 def interact_without(self): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
405 self.game.detail_views[self.COMPUTER].set_data('tab', 'log') |
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
406 self.game.detail_views[self.COMPUTER].set_background() |
257 | 407 return Result(soundfile='beep550.ogg') |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
408 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
409 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
410 class AlertTab(Thing): |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
411 """Tab for alert screen""" |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
412 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
413 NAME = 'bridge_comp.alert_tab' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
414 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
415 INTERACTS = { |
840 | 416 'alert tab': InteractText(12, 53, 88, 37, _("Alerts"), |
417 'orange', 20, 'DejaVuSans-Bold.ttf', True), | |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
418 } |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
419 INITIAL = 'alert tab' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
420 COMPUTER = 'bridge_comp_detail' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
421 |
519
8f3c82c685a4
Fix is_interactive() by adding tool param.
Jeremy Thurgood <firxen@gmail.com>
parents:
518
diff
changeset
|
422 def is_interactive(self, tool=None): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
423 return (self.game.detail_views[self.COMPUTER].get_data('tab') |
543 | 424 != 'alert') |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
425 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
426 def interact_without(self): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
427 self.game.detail_views[self.COMPUTER].set_data('tab', 'alert') |
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
428 self.game.detail_views[self.COMPUTER].set_background() |
257 | 429 return Result(soundfile='beep550.ogg') |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
430 |
543 | 431 |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
432 class NavTab(Thing): |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
433 """Tab for the Navigation screen""" |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
434 |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
435 NAME = 'bridge_comp.nav_tab' |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
436 |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
437 INTERACTS = { |
840 | 438 'nav tab': InteractText(197, 53, 126, 37, _("Navigation"), |
439 'darkblue', 20, 'DejaVuSans-Bold.ttf', True), | |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
440 } |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
441 INITIAL = 'nav tab' |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
442 COMPUTER = 'bridge_comp_detail' |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
443 |
519
8f3c82c685a4
Fix is_interactive() by adding tool param.
Jeremy Thurgood <firxen@gmail.com>
parents:
518
diff
changeset
|
444 def is_interactive(self, tool=None): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
445 return self.game.detail_views[self.COMPUTER].get_data('tab') != 'nav' |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
446 |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
447 def interact_without(self): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
448 self.game.detail_views[self.COMPUTER].set_data('tab', 'nav') |
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
449 self.game.detail_views[self.COMPUTER].set_background() |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
450 return Result(soundfile='beep550.ogg') |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
451 |
543 | 452 |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
453 class DestNavPageLine(Thing): |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
454 """The destination navigation lines.""" |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
455 |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
456 INITIAL = 'line' |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
457 COMPUTER = 'bridge_comp_detail' |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
458 |
828 | 459 def __init__(self, number, rect, ai_blocked, dest): |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
460 super(DestNavPageLine, self).__init__() |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
461 self.name = 'bridge_comp.nav_line%s' % number |
578
356795038b87
Remove a couple of uses os DEBUG.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
576
diff
changeset
|
462 # set debugging higlight color for when DEBUG is on. |
356795038b87
Remove a couple of uses os DEBUG.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
576
diff
changeset
|
463 self._interact_hilight_color = Color(THECOLORS.keys()[number]) |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
464 r = Rect(rect) |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
745
diff
changeset
|
465 # We dynamically generate the interact rect here. |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
466 self.interacts = {} |
828 | 467 self.interacts['line'] = InteractText(r.x, r.y, r.w, r.h, |
468 dest, 'darkblue', 16, 'DejaVuSans-Bold.ttf', False) | |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
469 # Whether JIM blocks this |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
470 self.ai_blocked = ai_blocked |
759
386475464202
Inspect game state for Thing.set_interact() instead of setting it manually everywhere.
Jeremy Thurgood <firxen@gmail.com>
parents:
745
diff
changeset
|
471 self.set_interact() |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
472 |
519
8f3c82c685a4
Fix is_interactive() by adding tool param.
Jeremy Thurgood <firxen@gmail.com>
parents:
518
diff
changeset
|
473 def is_interactive(self, tool=None): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
474 return self.game.detail_views[self.COMPUTER].get_data('tab') == 'nav' |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
475 |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
476 def interact_without(self): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
477 if self.game.scenes['bridge'].get_data('ai status') == 'online': |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
478 return make_jim_dialog(_("You are not authorized to change the" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
479 " destination."), self.game) |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
480 if not self.ai_blocked: |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
481 return Result(_("There's no good reason to choose to go to the" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
482 " penal colony.")) |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
483 if self.game.scenes['bridge'].get_data('ai status') == 'looping': |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
484 return Result(_("You could change the destination, but when JIM" |
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
485 " recovers, it'll just get reset.")) |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
486 if self.game.scenes['bridge'].get_data('ai status') == 'dead': |
769
43b49f1de828
Merge i18n for before the pyntnclick split
Stefano Rivera <stefano@rivera.za.net>
diff
changeset
|
487 return Result(_("You change the destination."), |
543 | 488 soundfile="beep550.ogg", end_game=True) |
489 | |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
490 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
491 class CompUpButton(Thing): |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
492 """Up button on log screen""" |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
493 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
494 NAME = 'bridge_comp.up_button' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
495 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
496 INTERACTS = { |
543 | 497 'up': InteractNoImage(594, 82, 30, 58), |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
498 } |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
499 INITIAL = 'up' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
500 COMPUTER = 'bridge_comp_detail' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
501 |
519
8f3c82c685a4
Fix is_interactive() by adding tool param.
Jeremy Thurgood <firxen@gmail.com>
parents:
518
diff
changeset
|
502 def is_interactive(self, tool=None): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
503 tab = self.game.detail_views[self.COMPUTER].get_data('tab') |
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
504 page = self.game.detail_views[self.COMPUTER].get_data('log page') |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
505 return tab == 'log' and page > 0 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
506 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
507 def interact_without(self): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
508 page = self.game.detail_views[self.COMPUTER].get_data('log page') |
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
509 self.game.detail_views[self.COMPUTER].set_data('log page', page - 1) |
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
510 self.game.detail_views[self.COMPUTER].set_background() |
257 | 511 return Result(soundfile='beep550.ogg') |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
512 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
513 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
514 class CompDownButton(Thing): |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
515 """Down button on log screen""" |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
516 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
517 NAME = 'bridge_comp.down_button' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
518 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
519 INTERACTS = { |
543 | 520 'down': InteractNoImage(594, 293, 30, 58), |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
521 } |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
522 INITIAL = 'down' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
523 COMPUTER = 'bridge_comp_detail' |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
524 |
519
8f3c82c685a4
Fix is_interactive() by adding tool param.
Jeremy Thurgood <firxen@gmail.com>
parents:
518
diff
changeset
|
525 def is_interactive(self, tool=None): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
526 tab = self.game.detail_views[self.COMPUTER].get_data('tab') |
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
527 page = self.game.detail_views[self.COMPUTER].get_data('log page') |
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
528 max_page = self.game.detail_views[self.COMPUTER].get_data('max page') |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
529 return tab == 'log' and (page + 1) < max_page |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
530 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
531 def interact_without(self): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
532 page = self.game.detail_views[self.COMPUTER].get_data('log page') |
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
533 self.game.detail_views[self.COMPUTER].set_data('log page', page + 1) |
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
534 self.game.detail_views[self.COMPUTER].set_background() |
257 | 535 return Result(soundfile='beep550.ogg') |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
536 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
537 |
350
125cb389ab90
Hook up poster. Add cameras to crew_quarters and bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
341
diff
changeset
|
538 class MonitorCamera(BaseCamera): |
125cb389ab90
Hook up poster. Add cameras to crew_quarters and bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
341
diff
changeset
|
539 "A camera on the bridge" |
125cb389ab90
Hook up poster. Add cameras to crew_quarters and bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
341
diff
changeset
|
540 |
125cb389ab90
Hook up poster. Add cameras to crew_quarters and bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
341
diff
changeset
|
541 NAME = "bridge.camera" |
125cb389ab90
Hook up poster. Add cameras to crew_quarters and bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
341
diff
changeset
|
542 |
125cb389ab90
Hook up poster. Add cameras to crew_quarters and bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
341
diff
changeset
|
543 INTERACTS = { |
464 | 544 'online': InteractImage(33, 192, 'camera_small.png'), |
545 'dead': InteractImage(33, 192, 'camera_small_gray.png'), | |
546 'looping': InteractAnimated(33, 192, ('camera_small.png', | |
547 'camera_small_gray.png'), | |
548 15), | |
549 } | |
350
125cb389ab90
Hook up poster. Add cameras to crew_quarters and bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
341
diff
changeset
|
550 |
125cb389ab90
Hook up poster. Add cameras to crew_quarters and bridge
Neil Muller <neil@dip.sun.ac.za>
parents:
341
diff
changeset
|
551 |
237
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
552 class BridgeCompDetail(Scene): |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
553 |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
554 FOLDER = 'bridge' |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
555 NAME = 'bridge_comp_detail' |
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
556 |
389
eef2fca1aa11
Hook up updated alert screens
Neil Muller <neil@dip.sun.ac.za>
parents:
370
diff
changeset
|
557 ALERT_BASE = 'comp_alert_base.png' |
eef2fca1aa11
Hook up updated alert screens
Neil Muller <neil@dip.sun.ac.za>
parents:
370
diff
changeset
|
558 ALERTS = { |
840 | 559 'hull breach': _("Hull breach detected: Engine Room"), |
560 'ai looping': _("AI Status: 3D scene reconstruction failed." | |
561 " Recovery in progress"), | |
562 'ai offline': _("AI System Offline"), | |
563 'engine offline': _("Engine Offline"), | |
564 'life support': _("Life Support System: 20% operational"), | |
565 'life support partial': _("Life Support System: 40% operational"), | |
389
eef2fca1aa11
Hook up updated alert screens
Neil Muller <neil@dip.sun.ac.za>
parents:
370
diff
changeset
|
566 } |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
567 |
389
eef2fca1aa11
Hook up updated alert screens
Neil Muller <neil@dip.sun.ac.za>
parents:
370
diff
changeset
|
568 # Point to start drawing changeable alerts |
840 | 569 ALERT_OFFSET = (16, 100) |
389
eef2fca1aa11
Hook up updated alert screens
Neil Muller <neil@dip.sun.ac.za>
parents:
370
diff
changeset
|
570 ALERT_SPACING = 4 |
eef2fca1aa11
Hook up updated alert screens
Neil Muller <neil@dip.sun.ac.za>
parents:
370
diff
changeset
|
571 |
841 | 572 LOG_BACKGROUND = 'comp_log_start.png' |
573 | |
574 LOGS = [_("<Error: Log corrupted. Unable to open Log>")] | |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
575 |
840 | 576 NAVIGATION = 'bridge_nav_base.png' |
577 | |
578 NAV_MESSAGES = { | |
844
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
579 'engine offline': [ |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
580 _("Engine Offline: Navigation Disabled")], |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
581 'life support': [ |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
582 _("Life Support Marginal."), |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
583 _("Emergency Navigation Protocol Engaged."), |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
584 '', |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
585 _("Destination locked to:"), |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
586 _("Bounty Penal Colony Space Port, New South Australia")], |
389
eef2fca1aa11
Hook up updated alert screens
Neil Muller <neil@dip.sun.ac.za>
parents:
370
diff
changeset
|
587 } |
eef2fca1aa11
Hook up updated alert screens
Neil Muller <neil@dip.sun.ac.za>
parents:
370
diff
changeset
|
588 |
eef2fca1aa11
Hook up updated alert screens
Neil Muller <neil@dip.sun.ac.za>
parents:
370
diff
changeset
|
589 BACKGROUND = ALERT_BASE |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
590 |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
591 INITIAL_DATA = { |
543 | 592 'tab': 'alert', |
593 'log page': 0, | |
594 'max page': len(LOGS), | |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
595 } |
237
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
596 |
592
4e9178215e75
Introduce .setup() for GameDeveloperGizmos.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
578
diff
changeset
|
597 def setup(self): |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
598 self.add_thing(LogTab()) |
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
599 self.add_thing(AlertTab()) |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
600 self.add_thing(NavTab()) |
412 | 601 #self.add_thing(CompUpButton()) |
602 #self.add_thing(CompDownButton()) | |
315
7b07ffc37ec0
Suspend background sound for bridge computer detail
Neil Muller <neil@dip.sun.ac.za>
parents:
302
diff
changeset
|
603 self._scene_playlist = None |
623
cab77cf07822
Undo fix get_image calls
Stefano Rivera <stefano@rivera.za.net>
parents:
621
diff
changeset
|
604 self._alert = self.get_image(self.FOLDER, self.ALERT_BASE) |
389
eef2fca1aa11
Hook up updated alert screens
Neil Muller <neil@dip.sun.ac.za>
parents:
370
diff
changeset
|
605 self._alert_messages = {} |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
606 self._nav_messages = {} |
840 | 607 for key, text in self.ALERTS.iteritems(): |
841 | 608 self._alert_messages[key] = render_text(text, |
609 'DejaVuSans-Bold.ttf', 18, 'orange', (0, 0, 0, 0), | |
610 self.resource, (600, 25), False) | |
840 | 611 self._nav_background = self.get_image(self.FOLDER, self.NAVIGATION) |
612 #for key, name in self.NAVIGATION.iteritems(): | |
613 # self._nav_messages[key] = self.get_image(self.FOLDER, name) | |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
614 self._nav_lines = [] |
828 | 615 self._nav_lines.append(DestNavPageLine(1, (12, 99, 610, 25), False, |
616 _("1. Bounty Penal Colony Space Port, New South Australia" | |
617 " (397 days)"))) | |
618 self._nav_lines.append(DestNavPageLine(2, (12, 135, 610, 25), True, | |
619 _("2. Hedonia Space Station (782 days)"))) | |
620 self._nav_lines.append(DestNavPageLine(3, (12, 167, 610, 25), True, | |
621 _("3. Spinosa Health Resort, Prunus Secundus (1231 days)"))) | |
622 self._nav_lines.append(DestNavPageLine(4, (12, 203, 610, 25), True, | |
623 _("4. Achene Space Port, Indica Prspinosame (1621 days)"))) | |
624 self._nav_lines.append(DestNavPageLine(5, (12, 239, 610, 25), True, | |
625 _("5. Opioid Space Port, Gelatinosa Prime (1963 days)"))) | |
841 | 626 self._log_background = self.get_image(self.FOLDER, self.LOG_BACKGROUND) |
627 self._logs = [] | |
628 for text in self.LOGS: | |
629 log_page = self._log_background.copy() | |
630 log_page.blit(render_text(text, 'DejaVuSans-Bold.ttf', 18, | |
631 'lightgreen', (0, 0, 0, 0), self.resource, (600, 25), False), | |
632 self.ALERT_OFFSET) | |
633 self._logs.append(log_page) | |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
634 |
315
7b07ffc37ec0
Suspend background sound for bridge computer detail
Neil Muller <neil@dip.sun.ac.za>
parents:
302
diff
changeset
|
635 def enter(self): |
566
ea9dd2b9186a
Hook up sound in gamelib/scenes.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
549
diff
changeset
|
636 self._scene_playlist = self.sound.get_current_playlist() |
ea9dd2b9186a
Hook up sound in gamelib/scenes.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
549
diff
changeset
|
637 self.sound.change_playlist(None) |
453
ab628938b95c
Move background setting. Set end_game flag
Neil Muller <neil@dip.sun.ac.za>
parents:
439
diff
changeset
|
638 self.set_background() |
315
7b07ffc37ec0
Suspend background sound for bridge computer detail
Neil Muller <neil@dip.sun.ac.za>
parents:
302
diff
changeset
|
639 |
7b07ffc37ec0
Suspend background sound for bridge computer detail
Neil Muller <neil@dip.sun.ac.za>
parents:
302
diff
changeset
|
640 def leave(self): |
566
ea9dd2b9186a
Hook up sound in gamelib/scenes.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
549
diff
changeset
|
641 self.sound.change_playlist(self._scene_playlist) |
315
7b07ffc37ec0
Suspend background sound for bridge computer detail
Neil Muller <neil@dip.sun.ac.za>
parents:
302
diff
changeset
|
642 |
453
ab628938b95c
Move background setting. Set end_game flag
Neil Muller <neil@dip.sun.ac.za>
parents:
439
diff
changeset
|
643 def set_background(self): |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
644 if self.get_data('tab') == 'alert': |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
645 self._clear_navigation() |
840 | 646 self._background = self._alert.copy() |
647 self._draw_alerts() | |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
648 elif self.get_data('tab') == 'log': |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
649 self._clear_navigation() |
840 | 650 self._background = self._logs[self.get_data('log page')].copy() |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
651 elif self.get_data('tab') == 'nav': |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
652 self._background = self._get_nav_page() |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
653 |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
654 def _clear_navigation(self): |
435 | 655 "Remove navigation things if necessary" |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
656 for thing in self._nav_lines: |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
657 if thing.name in self.things.keys(): |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
658 # Much fiddling to do the right thing when we reinsert it |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
659 del self.things[thing.name] |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
660 thing.scene = None |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
661 |
844
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
662 def _draw_nav_text(self, key): |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
663 surface = self._nav_background.copy() |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
664 xpos, ypos = self.ALERT_OFFSET |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
665 for line in self.NAV_MESSAGES[key]: |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
666 text = render_text(line, 'DejaVuSans-Bold.ttf', 18, |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
667 'darkblue', (0, 0, 0, 0), self.resource, (600, 25), False) |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
668 surface.blit(text, (xpos, ypos)) |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
669 ypos = ypos + text.get_height() + self.ALERT_SPACING |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
670 return surface |
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
671 |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
672 def _get_nav_page(self): |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
673 if not self.game.scenes['engine'].get_data('engine online'): |
844
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
674 return self._draw_nav_text('engine offline') |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
675 elif (not self.game.scenes['mess'].get_data('life support status') |
543 | 676 == 'fixed'): |
844
6a345dcbb209
Complete textification of the bridge computer
Neil Muller <neil@dip.sun.ac.za>
parents:
841
diff
changeset
|
677 return self._draw_nav_text('life support') |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
678 else: |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
679 for thing in self._nav_lines: |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
680 if thing.name not in self.things: |
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
681 self.add_thing(thing) |
840 | 682 return self._nav_background.copy() |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
683 |
840 | 684 def _draw_alerts(self): |
403
df3216b369b1
Hook up navigation tab, Add won condition
Neil Muller <neil@dip.sun.ac.za>
parents:
399
diff
changeset
|
685 xpos, ypos = self.ALERT_OFFSET |
840 | 686 self._background.blit(self._alert_messages['hull breach'], |
687 (xpos, ypos)) | |
688 ypos += (self._alert_messages['hull breach'].get_size()[1] | |
689 + self.ALERT_SPACING) | |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
690 if self.game.scenes['bridge'].get_data('ai status') == 'looping': |
840 | 691 self._background.blit(self._alert_messages['ai looping'], |
692 (xpos, ypos)) | |
543 | 693 ypos += (self._alert_messages['ai looping'].get_size()[1] |
694 + self.ALERT_SPACING) | |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
695 if self.game.scenes['bridge'].get_data('ai status') == 'dead': |
840 | 696 self._background.blit(self._alert_messages['ai offline'], |
697 (xpos, ypos)) | |
543 | 698 ypos += (self._alert_messages['ai offline'].get_size()[1] |
699 + self.ALERT_SPACING) | |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
700 if not self.game.scenes['engine'].get_data('engine online'): |
841 | 701 self._background.blit(self._alert_messages['engine offline'], |
702 (xpos, ypos)) | |
543 | 703 ypos += (self._alert_messages['engine offline'].get_size()[1] |
704 + self.ALERT_SPACING) | |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
705 if (self.game.scenes['mess'].get_data('life support status') |
800 | 706 == 'broken'): |
840 | 707 self._background.blit(self._alert_messages['life support'], |
708 (xpos, ypos)) | |
543 | 709 ypos += (self._alert_messages['life support'].get_size()[1] |
710 + self.ALERT_SPACING) | |
603
3ce19d33b51f
Rename state to game to not cause confusion with the other state
Neil Muller <neil@dip.sun.ac.za>
parents:
595
diff
changeset
|
711 if (self.game.scenes['mess'].get_data('life support status') |
800 | 712 == 'replaced'): |
840 | 713 self._background.blit(self._alert_messages['life support partial'], |
543 | 714 (xpos, ypos)) |
715 ypos += (self._alert_messages['life support partial'].get_size()[1] | |
716 + self.ALERT_SPACING) | |
255
2bd28030e8e4
Hook up parts of the bridge computer system
Neil Muller <neil@dip.sun.ac.za>
parents:
252
diff
changeset
|
717 |
222
b03debaec72d
Things and Items for bridge
Stefano Rivera <stefano@rivera.za.net>
parents:
150
diff
changeset
|
718 |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
719 SCENES = [Bridge] |
237
ae01c10497b3
Start work on bridge comp detail
Neil Muller <neil@dip.sun.ac.za>
parents:
235
diff
changeset
|
720 DETAIL_VIEWS = [ChairDetail, BridgeCompDetail] |