Mercurial > pyntnclick
comparison gamelib/scenes/engine.py @ 770:a35f5364437d pyntnclick
Merge i18n
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 26 Jan 2013 17:00:43 +0200 |
parents | a8510f4e2ea1 43b49f1de828 |
children | 246538901599 |
comparison
equal
deleted
inserted
replaced
764:a8510f4e2ea1 | 770:a35f5364437d |
---|---|
1 """Engine room where things need to be repaired.""" | 1 """Engine room where things need to be repaired.""" |
2 | 2 |
3 from pyntnclick.i18n import _ | |
3 from pyntnclick.cursor import CursorSprite | 4 from pyntnclick.cursor import CursorSprite |
4 from pyntnclick.state import Scene, Item, Thing, Result | 5 from pyntnclick.state import Scene, Item, Thing, Result |
5 from pyntnclick.scenewidgets import ( | 6 from pyntnclick.scenewidgets import ( |
6 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated, | 7 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated, |
7 GenericDescThing, TakeableThing) | 8 GenericDescThing, TakeableThing) |
35 self.add_thing(Stars()) | 36 self.add_thing(Stars()) |
36 self.add_thing(CrackedPipe()) | 37 self.add_thing(CrackedPipe()) |
37 self.add_thing(ComputerConsole()) | 38 self.add_thing(ComputerConsole()) |
38 self.add_thing(ToMap()) | 39 self.add_thing(ToMap()) |
39 self.add_thing(GenericDescThing('engine.body', 1, | 40 self.add_thing(GenericDescThing('engine.body', 1, |
40 "Dead. Those cans must have been past their sell-by date.", | 41 _("Dead. Those cans must have been past their sell-by date."), |
41 ( | 42 ( |
42 (594, 387, 45, 109), | 43 (594, 387, 45, 109), |
43 (549, 479, 60, 55), | 44 (549, 479, 60, 55), |
44 ) | 45 ) |
45 )) | 46 )) |
46 self.add_thing(GenericDescThing('engine.superconductors', 4, | 47 self.add_thing(GenericDescThing('engine.superconductors', 4, |
47 "Superconductors. The engines must be power hogs.", | 48 _("Superconductors. The engines must be power hogs."), |
48 ( | 49 ( |
49 (679, 246, 50, 56), | 50 (679, 246, 50, 56), |
50 (473, 280, 28, 23), | 51 (473, 280, 28, 23), |
51 (381, 224, 25, 22), | 52 (381, 224, 25, 22), |
52 ) | 53 ) |
53 )) | 54 )) |
54 self.add_thing(GenericDescThing('engine.floor_hole', 5, | 55 self.add_thing(GenericDescThing('engine.floor_hole', 5, |
55 "A gaping hole in the floor of the room. " | 56 _("A gaping hole in the floor of the room. " |
56 "It is clearly irreparable.", | 57 "It is clearly irreparable."), |
57 ( | 58 ( |
58 (257, 493, 141, 55), | 59 (257, 493, 141, 55), |
59 (301, 450, 95, 45), | 60 (301, 450, 95, 45), |
60 (377, 422, 19, 29), | 61 (377, 422, 19, 29), |
61 (239, 547, 123, 39), | 62 (239, 547, 123, 39), |
62 ) | 63 ) |
63 )) | 64 )) |
64 self.add_thing(GenericDescThing('engine.empty_cans', 7, | 65 self.add_thing(GenericDescThing('engine.empty_cans', 7, |
65 "Empty chocolate-covered bacon cans? Poor guy, he must have" | 66 _("Empty chocolate-covered bacon cans? Poor guy, he must have" |
66 " found them irresistible.", | 67 " found them irresistible."), |
67 ( | 68 ( |
68 (562, 422, 30, 31), | 69 (562, 422, 30, 31), |
69 ) | 70 ) |
70 )) | 71 )) |
71 if not self.get_data('engine online'): | 72 if not self.get_data('engine online'): |
72 self.add_thing(GenericDescThing('engine.engines', 8, | 73 self.add_thing(GenericDescThing('engine.engines', 8, |
73 "The engines. They don't look like they are working.", | 74 _("The engines. They don't look like they are working."), |
74 ( | 75 ( |
75 (342, 261, 109, 81), | 76 (342, 261, 109, 81), |
76 ) | 77 ) |
77 )) | 78 )) |
78 self.add_thing(GenericDescThing('engine.laser_cutter', 9, | 79 self.add_thing(GenericDescThing('engine.laser_cutter', 9, |
79 "A burned-out laser cutter. It may be responsible for the" | 80 _("A burned-out laser cutter. It may be responsible for the" |
80 " hole in the floor.", | 81 " hole in the floor."), |
81 ( | 82 ( |
82 (120, 466, 115, 67), | 83 (120, 466, 115, 67), |
83 ) | 84 ) |
84 )) | 85 )) |
85 self.add_thing(GenericDescThing('engine.fuel_lines', 10, | 86 self.add_thing(GenericDescThing('engine.fuel_lines', 10, |
86 "The main fuel line for the engines.", | 87 _("The main fuel line for the engines."), |
87 ( | 88 ( |
88 (220, 49, 59, 75), | 89 (220, 49, 59, 75), |
89 (239, 84, 51, 66), | 90 (239, 84, 51, 66), |
90 (271, 113, 28, 53), | 91 (271, 113, 28, 53), |
91 (285, 132, 26, 50), | 92 (285, 132, 26, 50), |
101 (438, 217, 30, 11), | 102 (438, 217, 30, 11), |
102 (435, 225, 18, 15), | 103 (435, 225, 18, 15), |
103 ) | 104 ) |
104 )) | 105 )) |
105 self.add_thing(GenericDescThing('engine.spare_fuel_line', 11, | 106 self.add_thing(GenericDescThing('engine.spare_fuel_line', 11, |
106 "The spare fuel line. If something went wrong with the main" | 107 _("The spare fuel line. If something went wrong with the main" |
107 " one, you would hook that one up.", | 108 " one, you would hook that one up."), |
108 ( | 109 ( |
109 (512, 49, 68, 44), | 110 (512, 49, 68, 44), |
110 ) | 111 ) |
111 )) | 112 )) |
112 self.add_thing(GenericDescThing('engine.danger_area', 12, | 113 self.add_thing(GenericDescThing('engine.danger_area', 12, |
113 "The sign says DANGER. You would be wise to listen to it.", | 114 _("The sign says DANGER. You would be wise to listen to it."), |
114 ( | 115 ( |
115 (293, 343, 211, 46), | 116 (293, 343, 211, 46), |
116 ) | 117 ) |
117 )) | 118 )) |
118 self.add_thing(GenericDescThing('engine.exit_sign', 13, | 119 self.add_thing(GenericDescThing('engine.exit_sign', 13, |
119 "It's one of those glow-in-the-dark signs needed to satisfy the " | 120 _("It's one of those glow-in-the-dark signs needed to satisfy the " |
120 "health and safety inspectors.", | 121 "health and safety inspectors."), |
121 ( | 122 ( |
122 (681, 322, 80, 33), | 123 (681, 322, 80, 33), |
123 ) | 124 ) |
124 )) | 125 )) |
125 | 126 |
127 if (self.things['engine.cryo_containers'].get_data('filled') | 128 if (self.things['engine.cryo_containers'].get_data('filled') |
128 and self.things['engine.superconductor'].get_data('working')): | 129 and self.things['engine.superconductor'].get_data('working')): |
129 self.set_data('engine online', True) | 130 self.set_data('engine online', True) |
130 self.remove_thing(self.things['engine.engines.8']) | 131 self.remove_thing(self.things['engine.engines.8']) |
131 self.add_thing(Engines()) | 132 self.add_thing(Engines()) |
132 return make_jim_dialog("The engines are now operational. You have" | 133 return make_jim_dialog(_("The engines are now operational. You" |
133 "done a satisfactory job, Prisoner %s." | 134 " have done a satisfactory job, Prisoner" |
134 % PLAYER_ID, | 135 " %s.") % PLAYER_ID, self.game) |
135 self.game) | |
136 | 136 |
137 def enter(self): | 137 def enter(self): |
138 if self.get_data('greet'): | 138 if self.get_data('greet'): |
139 self.set_data('greet', False) | 139 self.set_data('greet', False) |
140 return Result( | 140 return Result( |
141 "With your improvised helmet, the automatic airlock allows" | 141 _("With your improvised helmet, the automatic airlock" |
142 " you into the engine room. Even if there wasn't a vacuum " | 142 " allows you into the engine room. Even if there wasn't" |
143 "it would be eerily quiet.") | 143 " a vacuum it would be eerily quiet.")) |
144 | 144 |
145 | 145 |
146 class Engines(Thing): | 146 class Engines(Thing): |
147 NAME = 'engine.engines' | 147 NAME = 'engine.engines' |
148 | 148 |
154 | 154 |
155 def is_interactive(self, tool=None): | 155 def is_interactive(self, tool=None): |
156 return False | 156 return False |
157 | 157 |
158 def get_description(self): | 158 def get_description(self): |
159 return "All systems are go! Or at least the engines are." | 159 return _("All systems are go! Or at least the engines are.") |
160 | 160 |
161 | 161 |
162 class CanOpener(Item): | 162 class CanOpener(Item): |
163 INVENTORY_IMAGE = 'can_opener.png' | 163 INVENTORY_IMAGE = 'can_opener.png' |
164 CURSOR = CursorSprite('can_opener_cursor.png') | 164 CURSOR = CursorSprite('can_opener_cursor.png') |
173 | 173 |
174 INITIAL = 'canopener' | 174 INITIAL = 'canopener' |
175 ITEM = 'canopener' | 175 ITEM = 'canopener' |
176 | 176 |
177 def get_description(self): | 177 def get_description(self): |
178 return "A can opener. Looks like you won't be starving" | 178 return _("A can opener. Looks like you won't be starving") |
179 | 179 |
180 def interact_without(self): | 180 def interact_without(self): |
181 self.take() | 181 self.take() |
182 return Result("You pick up the can opener. It looks brand new; " | 182 return Result(_("You pick up the can opener. It looks brand new; " |
183 "the vacuum has kept it in perfect condition.") | 183 "the vacuum has kept it in perfect condition.")) |
184 | 184 |
185 | 185 |
186 class SuperconductorSocket(Thing): | 186 class SuperconductorSocket(Thing): |
187 NAME = 'engine.superconductor' | 187 NAME = 'engine.superconductor' |
188 | 188 |
199 'working': False, | 199 'working': False, |
200 } | 200 } |
201 | 201 |
202 def get_description(self): | 202 def get_description(self): |
203 if self.get_data('present') and not self.get_data('working'): | 203 if self.get_data('present') and not self.get_data('working'): |
204 return ("That superconductor looks burned out. It's wedged" | 204 return _("That superconductor looks burned out. It's wedged" |
205 " in there pretty firmly.") | 205 " in there pretty firmly.") |
206 elif not self.get_data('present'): | 206 elif not self.get_data('present'): |
207 return "An empty superconductor socket" | 207 return _("An empty superconductor socket") |
208 else: | 208 else: |
209 return "A working superconductor." | 209 return _("A working superconductor.") |
210 | 210 |
211 def select_interact(self): | 211 def select_interact(self): |
212 if not self.get_data('present'): | 212 if not self.get_data('present'): |
213 return 'removed' | 213 return 'removed' |
214 if self.get_data('working'): | 214 if self.get_data('working'): |
215 return 'fixed' | 215 return 'fixed' |
216 return self.INITIAL | 216 return self.INITIAL |
217 | 217 |
218 def interact_without(self): | 218 def interact_without(self): |
219 if self.get_data('present') and not self.get_data('working'): | 219 if self.get_data('present') and not self.get_data('working'): |
220 return Result("It's wedged in there pretty firmly, it won't" | 220 return Result(_("It's wedged in there pretty firmly, it won't" |
221 " come out.") | 221 " come out.")) |
222 elif self.get_data('working'): | 222 elif self.get_data('working'): |
223 return Result("You decide that working engines are more important" | 223 return Result(_("You decide that working engines are more " |
224 " than having a shiny superconductor.") | 224 " important than having a shiny superconductor.")) |
225 | 225 |
226 def interact_with_machete(self, item): | 226 def interact_with_machete(self, item): |
227 if self.get_data('present') and not self.get_data('working'): | 227 if self.get_data('present') and not self.get_data('working'): |
228 self.set_data('present', False) | 228 self.set_data('present', False) |
229 self.set_interact() | 229 self.set_interact() |
230 return Result("With leverage, the burned-out superconductor" | 230 return Result(_("With leverage, the burned-out superconductor" |
231 " snaps out. You discard it.") | 231 " snaps out. You discard it.")) |
232 | 232 |
233 def interact_with_superconductor(self, item): | 233 def interact_with_superconductor(self, item): |
234 if self.get_data('present'): | 234 if self.get_data('present'): |
235 return Result("It might help to remove the broken" | 235 return Result(_("It might help to remove the broken" |
236 " superconductor first") | 236 " superconductor first")) |
237 else: | 237 else: |
238 return Result("You plug in the superconductor, and feel a hum " | 238 return Result(_("You plug in the superconductor, and feel a hum " |
239 "as things kick into life. " | 239 "as things kick into life. Unfortunately, it's " |
240 "Unfortunately, it's the wrong size for the socket " | 240 "the wrong size for the socket and just falls " |
241 "and just falls out again when you let go.") | 241 "out again when you let go.")) |
242 | 242 |
243 def interact_with_taped_superconductor(self, item): | 243 def interact_with_taped_superconductor(self, item): |
244 if not self.get_data('present'): | 244 if not self.get_data('present'): |
245 self.set_data('present', True) | 245 self.set_data('present', True) |
246 self.set_data('working', True) | 246 self.set_data('working', True) |
247 self.set_interact() | 247 self.set_interact() |
248 self.game.remove_inventory_item(item.name) | 248 self.game.remove_inventory_item(item.name) |
249 results = [Result("The chair's superconductor looks over-specced " | 249 results = [Result(_("The chair's superconductor looks over-specced" |
250 "for this job, but it should work.")] | 250 " for this job, but it should work."))] |
251 results.append(self.scene.engine_online_check()) | 251 results.append(self.scene.engine_online_check()) |
252 return results | 252 return results |
253 else: | 253 else: |
254 return Result("It might help to remove the broken superconductor" | 254 return Result(_("It might help to remove the broken superconductor" |
255 " first.") | 255 " first.")) |
256 | 256 |
257 | 257 |
258 class CryoContainers(Thing): | 258 class CryoContainers(Thing): |
259 NAME = 'engine.cryo_containers' | 259 NAME = 'engine.cryo_containers' |
260 | 260 |
274 return 'full' | 274 return 'full' |
275 return self.INITIAL | 275 return self.INITIAL |
276 | 276 |
277 def get_description(self): | 277 def get_description(self): |
278 if not self.get_data('filled'): | 278 if not self.get_data('filled'): |
279 return "Those are coolant reservoirs. They look empty." | 279 return _("Those are coolant reservoirs. They look empty.") |
280 return "The coolant reservoirs are full." | 280 return _("The coolant reservoirs are full.") |
281 | 281 |
282 def is_interactive(self, tool=None): | 282 def is_interactive(self, tool=None): |
283 return False | 283 return False |
284 | 284 |
285 | 285 |
295 } | 295 } |
296 | 296 |
297 INITIAL = 'containers' | 297 INITIAL = 'containers' |
298 | 298 |
299 def get_description(self): | 299 def get_description(self): |
300 return "The receptacles for the coolant reservoirs." | 300 return _("The receptacles for the coolant reservoirs.") |
301 | 301 |
302 def interact_without(self): | 302 def interact_without(self): |
303 return Result("You stick your finger in the receptacle. " | 303 return Result(_("You stick your finger in the receptacle. " |
304 "It almost gets stuck.") | 304 "It almost gets stuck.")) |
305 | 305 |
306 def interact_with_full_detergent_bottle(self, item): | 306 def interact_with_full_detergent_bottle(self, item): |
307 if not self.scene.things['engine.cracked_pipe'].get_data('fixed'): | 307 if not self.scene.things['engine.cracked_pipe'].get_data('fixed'): |
308 return Result("Pouring the precious cryo fluid into a" | 308 return Result(_("Pouring the precious cryo fluid into a" |
309 " container connected to a cracked pipe would be a waste.") | 309 " container connected to a cracked pipe would be a" |
310 " waste.")) | |
310 self.game.remove_inventory_item(item.name) | 311 self.game.remove_inventory_item(item.name) |
311 self.scene.things['engine.cryo_containers'].set_data('filled', True) | 312 self.scene.things['engine.cryo_containers'].set_data('filled', True) |
312 self.scene.things['engine.cryo_containers'].set_interact() | 313 self.scene.things['engine.cryo_containers'].set_interact() |
313 results = [Result("You fill the reservoirs. " | 314 results = [Result(_("You fill the reservoirs. " |
314 "The detergent bottle was just big enough, which " | 315 "The detergent bottle was just big enough, which " |
315 "is handy, because it's sprung a leak.")] | 316 "is handy, because it's sprung a leak."))] |
316 results.append(self.scene.engine_online_check()) | 317 results.append(self.scene.engine_online_check()) |
317 return results | 318 return results |
318 | 319 |
319 | 320 |
320 class CoolingPipes(Thing): | 321 class CoolingPipes(Thing): |
356 } | 357 } |
357 INITIAL = 'pipes' | 358 INITIAL = 'pipes' |
358 | 359 |
359 def get_description(self): | 360 def get_description(self): |
360 if not self.scene.things['engine.cryo_containers'].get_data('filled'): | 361 if not self.scene.things['engine.cryo_containers'].get_data('filled'): |
361 return "These pipes carry coolant to the superconductors. " \ | 362 return _("These pipes carry coolant to the superconductors. " |
362 "They feel warm." | 363 "They feel warm.") |
363 return "These pipes carry coolant to the superconductors. " \ | 364 return _("These pipes carry coolant to the superconductors. " |
364 "They are very cold." | 365 "They are very cold.") |
365 | 366 |
366 def is_interactive(self, tool=None): | 367 def is_interactive(self, tool=None): |
367 return False | 368 return False |
368 | 369 |
369 | 370 |
384 | 385 |
385 INITIAL = 'lines' | 386 INITIAL = 'lines' |
386 | 387 |
387 def get_description(self): | 388 def get_description(self): |
388 if self.scene.things['engine.superconductor'].get_data('working'): | 389 if self.scene.things['engine.superconductor'].get_data('working'): |
389 return "Power lines. They are delivering power to the engines." | 390 return _("Power lines. They are delivering power to the engines.") |
390 return "Power lines. It looks like they aren't working correctly." | 391 return _("Power lines. It looks like they aren't working correctly.") |
391 | 392 |
392 def is_interactive(self, tool=None): | 393 def is_interactive(self, tool=None): |
393 return False | 394 return False |
394 | 395 |
395 | 396 |
475 | 476 |
476 def is_interactive(self, tool=None): | 477 def is_interactive(self, tool=None): |
477 return False | 478 return False |
478 | 479 |
479 def get_description(self): | 480 def get_description(self): |
480 return "A gaping hole in the floor of the room. You're guessing" \ | 481 return _("A gaping hole in the floor of the room. You're guessing" |
481 " that's why there's a vacuum in here." | 482 " that's why there's a vacuum in here.") |
482 | 483 |
483 | 484 |
484 class CrackedPipe(Thing): | 485 class CrackedPipe(Thing): |
485 NAME = "engine.cracked_pipe" | 486 NAME = "engine.cracked_pipe" |
486 | 487 |
495 'fixed': False, | 496 'fixed': False, |
496 } | 497 } |
497 | 498 |
498 def get_description(self): | 499 def get_description(self): |
499 if self.get_data('fixed'): | 500 if self.get_data('fixed'): |
500 return "The duct tape appears to be holding." | 501 return _("The duct tape appears to be holding.") |
501 else: | 502 else: |
502 return "The pipe looks cracked and won't hold" \ | 503 return _("The pipe looks cracked and won't hold" |
503 " fluid until it's fixed." | 504 " fluid until it's fixed.") |
504 | 505 |
505 def select_interact(self): | 506 def select_interact(self): |
506 if self.get_data('fixed'): | 507 if self.get_data('fixed'): |
507 return 'taped' | 508 return 'taped' |
508 return self.INITIAL | 509 return self.INITIAL |
509 | 510 |
510 def interact_with_duct_tape(self, item): | 511 def interact_with_duct_tape(self, item): |
511 if self.get_data('fixed'): | 512 if self.get_data('fixed'): |
512 return Result("The duct tape already there appears to be " | 513 return Result(_("The duct tape already there appears to be " |
513 "sufficient.") | 514 "sufficient.")) |
514 else: | 515 else: |
515 self.set_data('fixed', True) | 516 self.set_data('fixed', True) |
516 self.set_interact() | 517 self.set_interact() |
517 return Result("You apply your trusty duct tape to the " | 518 return Result(_("You apply your trusty duct tape to the " |
518 "creak, sealing it.") | 519 "creak, sealing it.")) |
519 | 520 |
520 | 521 |
521 class ComputerConsole(Thing): | 522 class ComputerConsole(Thing): |
522 NAME = "engine.computer_console" | 523 NAME = "engine.computer_console" |
523 | 524 |
532 | 533 |
533 def interact_without(self): | 534 def interact_without(self): |
534 return Result(detail_view='engine_comp_detail') | 535 return Result(detail_view='engine_comp_detail') |
535 | 536 |
536 def get_description(self): | 537 def get_description(self): |
537 return "A computer console. It's alarmingly close to the engine." | 538 return _("A computer console. It's alarmingly close to the engine.") |
538 | 539 |
539 | 540 |
540 class EngineCompDetail(Scene): | 541 class EngineCompDetail(Scene): |
541 | 542 |
542 FOLDER = "engine" | 543 FOLDER = "engine" |
588 } | 589 } |
589 | 590 |
590 INITIAL = "door" | 591 INITIAL = "door" |
591 | 592 |
592 def get_description(self): | 593 def get_description(self): |
593 return "The airlock leads back to the rest of the ship." | 594 return _("The airlock leads back to the rest of the ship.") |
594 | 595 |
595 | 596 |
596 SCENES = [Engine] | 597 SCENES = [Engine] |
597 DETAIL_VIEWS = [EngineCompDetail] | 598 DETAIL_VIEWS = [EngineCompDetail] |