Mercurial > boomslang
comparison gamelib/scenes/engine.py @ 765:2f1952748cdb i18n
merge i18n and Russian translation
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Tue, 08 Mar 2011 14:37:43 +0200 |
parents | 0ce08d5e2acb a9925aaf5f61 |
children | 43b49f1de828 |
comparison
equal
deleted
inserted
replaced
528:0ce08d5e2acb | 765:2f1952748cdb |
---|---|
8 GenericDescThing) | 8 GenericDescThing) |
9 | 9 |
10 from gamelib.scenes.game_constants import PLAYER_ID | 10 from gamelib.scenes.game_constants import PLAYER_ID |
11 from gamelib.scenes.game_widgets import Door, make_jim_dialog | 11 from gamelib.scenes.game_widgets import Door, make_jim_dialog |
12 | 12 |
13 from gamelib.i18n import _ | |
13 | 14 |
14 class Engine(Scene): | 15 class Engine(Scene): |
15 | 16 |
16 FOLDER = "engine" | 17 FOLDER = "engine" |
17 BACKGROUND = "engine_room.png" | 18 BACKGROUND = "engine_room.png" |
37 self.add_thing(Stars()) | 38 self.add_thing(Stars()) |
38 self.add_thing(CrackedPipe()) | 39 self.add_thing(CrackedPipe()) |
39 self.add_thing(ComputerConsole()) | 40 self.add_thing(ComputerConsole()) |
40 self.add_thing(ToMap()) | 41 self.add_thing(ToMap()) |
41 self.add_thing(GenericDescThing('engine.body', 1, | 42 self.add_thing(GenericDescThing('engine.body', 1, |
42 "Dead. Those cans must have been past their sell-by date.", | 43 _("Dead. Those cans must have been past their sell-by date."), |
43 ( | 44 ( |
44 (594, 387, 45, 109), | 45 (594, 387, 45, 109), |
45 (549, 479, 60, 55), | 46 (549, 479, 60, 55), |
46 ) | 47 ) |
47 )) | 48 )) |
48 self.add_thing(GenericDescThing('engine.superconductors', 4, | 49 self.add_thing(GenericDescThing('engine.superconductors', 4, |
49 "Superconductors. The engines must be power hogs.", | 50 _("Superconductors. The engines must be power hogs."), |
50 ( | 51 ( |
51 (679, 246, 50, 56), | 52 (679, 246, 50, 56), |
52 (473, 280, 28, 23), | 53 (473, 280, 28, 23), |
53 (381, 224, 25, 22), | 54 (381, 224, 25, 22), |
54 ) | 55 ) |
55 )) | 56 )) |
56 self.add_thing(GenericDescThing('engine.floor_hole', 5, | 57 self.add_thing(GenericDescThing('engine.floor_hole', 5, |
57 "A gaping hole in the floor of the room. " | 58 _("A gaping hole in the floor of the room. " |
58 "It is clearly irreparable.", | 59 "It is clearly irreparable."), |
59 ( | 60 ( |
60 (257, 493, 141, 55), | 61 (257, 493, 141, 55), |
61 (301, 450, 95, 45), | 62 (301, 450, 95, 45), |
62 (377, 422, 19, 29), | 63 (377, 422, 19, 29), |
63 (239, 547, 123, 39), | 64 (239, 547, 123, 39), |
64 ) | 65 ) |
65 )) | 66 )) |
66 self.add_thing(GenericDescThing('engine.empty_cans', 7, | 67 self.add_thing(GenericDescThing('engine.empty_cans', 7, |
67 "Empty chocolate-covered bacon cans? Poor guy, he must have found them irresistible.", | 68 _("Empty chocolate-covered bacon cans? Poor guy, he must have found them irresistible."), |
68 ( | 69 ( |
69 (562, 422, 30, 31), | 70 (562, 422, 30, 31), |
70 ) | 71 ) |
71 )) | 72 )) |
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 hole in the floor.", | 80 _("A burned-out laser cutter. It may be responsible for the hole in the floor."), |
80 ( | 81 ( |
81 (120, 466, 115, 67), | 82 (120, 466, 115, 67), |
82 ) | 83 ) |
83 )) | 84 )) |
84 self.add_thing(GenericDescThing('engine.fuel_lines', 10, | 85 self.add_thing(GenericDescThing('engine.fuel_lines', 10, |
85 "The main fuel line for the engines.", | 86 _("The main fuel line for the engines."), |
86 ( | 87 ( |
87 (220, 49, 59, 75), | 88 (220, 49, 59, 75), |
88 (239, 84, 51, 66), | 89 (239, 84, 51, 66), |
89 (271, 113, 28, 53), | 90 (271, 113, 28, 53), |
90 (285, 132, 26, 50), | 91 (285, 132, 26, 50), |
100 (438, 217, 30, 11), | 101 (438, 217, 30, 11), |
101 (435, 225, 18, 15), | 102 (435, 225, 18, 15), |
102 ) | 103 ) |
103 )) | 104 )) |
104 self.add_thing(GenericDescThing('engine.spare_fuel_line', 11, | 105 self.add_thing(GenericDescThing('engine.spare_fuel_line', 11, |
105 "The spare fuel line. If something went wrong with the main one, you would hook that one up.", | 106 _("The spare fuel line. If something went wrong with the main one, you would hook that one up."), |
106 ( | 107 ( |
107 (512, 49, 68, 44), | 108 (512, 49, 68, 44), |
108 ) | 109 ) |
109 )) | 110 )) |
110 self.add_thing(GenericDescThing('engine.danger_area', 12, | 111 self.add_thing(GenericDescThing('engine.danger_area', 12, |
111 "The sign says DANGER. You would be wise to listen to it.", | 112 _("The sign says DANGER. You would be wise to listen to it."), |
112 ( | 113 ( |
113 (293, 343, 211, 46), | 114 (293, 343, 211, 46), |
114 ) | 115 ) |
115 )) | 116 )) |
116 self.add_thing(GenericDescThing('engine.exit_sign', 13, | 117 self.add_thing(GenericDescThing('engine.exit_sign', 13, |
117 "It's one of those glow-in-the-dark signs needed to satisfy the " | 118 _("It's one of those glow-in-the-dark signs needed to satisfy the " |
118 "health and safety inspectors.", | 119 "health and safety inspectors."), |
119 ( | 120 ( |
120 (681, 322, 80, 33), | 121 (681, 322, 80, 33), |
121 ) | 122 ) |
122 )) | 123 )) |
123 | 124 |
125 if self.things['engine.cryo_containers'].get_data('filled') \ | 126 if self.things['engine.cryo_containers'].get_data('filled') \ |
126 and self.things['engine.superconductor'].get_data('working'): | 127 and self.things['engine.superconductor'].get_data('working'): |
127 self.set_data('engine online', True) | 128 self.set_data('engine online', True) |
128 self.remove_thing(self.things['engine.engines.8']) | 129 self.remove_thing(self.things['engine.engines.8']) |
129 self.add_thing(Engines()) | 130 self.add_thing(Engines()) |
130 return make_jim_dialog("The engines are now operational. You have" | 131 return make_jim_dialog(_("The engines are now operational. You have" |
131 "done a satisfactory job, Prisoner %s." % PLAYER_ID, | 132 "done a satisfactory job, Prisoner %s.") % PLAYER_ID, |
132 self.state) | 133 self.state) |
133 | 134 |
134 def enter(self): | 135 def enter(self): |
135 if self.get_data('greet'): | 136 if self.get_data('greet'): |
136 self.set_data('greet', False) | 137 self.set_data('greet', False) |
137 return Result( | 138 return Result( |
138 "With your improvised helmet, the automatic airlock allows you into the engine room. Even if there wasn't a vacuum " | 139 _("With your improvised helmet, the automatic airlock allows you into the engine room. Even if there wasn't a vacuum " |
139 "it would be eerily quiet.") | 140 "it would be eerily quiet.")) |
140 | 141 |
141 class Engines(Thing): | 142 class Engines(Thing): |
142 NAME = 'engine.engines' | 143 NAME = 'engine.engines' |
143 | 144 |
144 INTERACTS = { | 145 INTERACTS = { |
149 | 150 |
150 def is_interactive(self, tool=None): | 151 def is_interactive(self, tool=None): |
151 return False | 152 return False |
152 | 153 |
153 def get_description(self): | 154 def get_description(self): |
154 return "All systems are go! Or at least the engines are." | 155 return _("All systems are go! Or at least the engines are.") |
155 | 156 |
156 | 157 |
157 class CanOpener(Item): | 158 class CanOpener(Item): |
158 INVENTORY_IMAGE = 'can_opener.png' | 159 INVENTORY_IMAGE = 'can_opener.png' |
159 CURSOR = CursorSprite('can_opener_cursor.png') | 160 CURSOR = CursorSprite('can_opener_cursor.png') |
167 } | 168 } |
168 | 169 |
169 INITIAL = 'canopener' | 170 INITIAL = 'canopener' |
170 | 171 |
171 def get_description(self): | 172 def get_description(self): |
172 return "A can opener. Looks like you won't be starving" | 173 return _("A can opener. Looks like you won't be starving") |
173 | 174 |
174 def interact_without(self): | 175 def interact_without(self): |
175 self.state.add_inventory_item('canopener') | 176 self.state.add_inventory_item('canopener') |
176 self.scene.remove_thing(self) | 177 self.scene.remove_thing(self) |
177 return Result("You pick up the can opener. It looks brand new; " | 178 return Result(_("You pick up the can opener. It looks brand new; " |
178 "the vacuum has kept it in perfect condition.") | 179 "the vacuum has kept it in perfect condition.")) |
179 | 180 |
180 | 181 |
181 class SuperconductorSocket(Thing): | 182 class SuperconductorSocket(Thing): |
182 NAME = 'engine.superconductor' | 183 NAME = 'engine.superconductor' |
183 | 184 |
194 'working': False, | 195 'working': False, |
195 } | 196 } |
196 | 197 |
197 def get_description(self): | 198 def get_description(self): |
198 if self.get_data('present') and not self.get_data('working'): | 199 if self.get_data('present') and not self.get_data('working'): |
199 return "That superconductor looks burned out. It's wedged in there pretty firmly." | 200 return _("That superconductor looks burned out. It's wedged in there pretty firmly.") |
200 elif not self.get_data('present'): | 201 elif not self.get_data('present'): |
201 return "An empty superconductor socket" | 202 return _("An empty superconductor socket") |
202 else: | 203 else: |
203 return "A working superconductor." | 204 return _("A working superconductor.") |
204 | 205 |
205 def interact_without(self): | 206 def interact_without(self): |
206 if self.get_data('present') and not self.get_data('working'): | 207 if self.get_data('present') and not self.get_data('working'): |
207 return Result("It's wedged in there pretty firmly, it won't come out.") | 208 return Result(_("It's wedged in there pretty firmly, it won't come out.")) |
208 elif self.get_data('working'): | 209 elif self.get_data('working'): |
209 return Result("You decide that working engines are more important than having a shiny superconductor.") | 210 return Result(_("You decide that working engines are more important than having a shiny superconductor.")) |
210 | 211 |
211 def interact_with_machete(self, item): | 212 def interact_with_machete(self, item): |
212 if self.get_data('present') and not self.get_data('working'): | 213 if self.get_data('present') and not self.get_data('working'): |
213 self.set_interact('removed') | 214 self.set_interact('removed') |
214 self.set_data('present', False) | 215 self.set_data('present', False) |
215 return Result("With leverage, the burned-out superconductor snaps out. " | 216 return Result(_("With leverage, the burned-out superconductor snaps out. " |
216 "You discard it.") | 217 "You discard it.")) |
217 | 218 |
218 def interact_with_superconductor(self, item): | 219 def interact_with_superconductor(self, item): |
219 if self.get_data('present'): | 220 if self.get_data('present'): |
220 return Result("It might help to remove the broken superconductor first") | 221 return Result(_("It might help to remove the broken superconductor first")) |
221 else: | 222 else: |
222 return Result("You plug in the superconductor, and feel a hum " | 223 return Result(_("You plug in the superconductor, and feel a hum " |
223 "as things kick into life. " | 224 "as things kick into life. " |
224 "Unfortunately, it's the wrong size for the socket " | 225 "Unfortunately, it's the wrong size for the socket " |
225 "and just falls out again when you let go.") | 226 "and just falls out again when you let go.")) |
226 | 227 |
227 def interact_with_taped_superconductor(self, item): | 228 def interact_with_taped_superconductor(self, item): |
228 if not self.get_data('present'): | 229 if not self.get_data('present'): |
229 self.set_interact('fixed') | 230 self.set_interact('fixed') |
230 self.set_data('present', True) | 231 self.set_data('present', True) |
231 self.set_data('working', True) | 232 self.set_data('working', True) |
232 self.state.remove_inventory_item(item.name) | 233 self.state.remove_inventory_item(item.name) |
233 results = [Result("The chair's superconductor looks over-specced " | 234 results = [Result(_("The chair's superconductor looks over-specced " |
234 "for this job, but it should work.")] | 235 "for this job, but it should work."))] |
235 results.append(self.scene.engine_online_check()) | 236 results.append(self.scene.engine_online_check()) |
236 return results | 237 return results |
237 else: | 238 else: |
238 return Result("It might help to remove the broken superconductor first.") | 239 return Result(_("It might help to remove the broken superconductor first.")) |
239 | 240 |
240 | 241 |
241 class CryoContainers(Thing): | 242 class CryoContainers(Thing): |
242 NAME = 'engine.cryo_containers' | 243 NAME = 'engine.cryo_containers' |
243 | 244 |
252 'filled': False, | 253 'filled': False, |
253 } | 254 } |
254 | 255 |
255 def get_description(self): | 256 def get_description(self): |
256 if not self.get_data('filled'): | 257 if not self.get_data('filled'): |
257 return "Those are coolant reservoirs. They look empty." | 258 return _("Those are coolant reservoirs. They look empty.") |
258 return "The coolant reservoirs are full." | 259 return _("The coolant reservoirs are full.") |
259 | 260 |
260 def is_interactive(self, tool=None): | 261 def is_interactive(self, tool=None): |
261 return False | 262 return False |
262 | 263 |
263 | 264 |
273 } | 274 } |
274 | 275 |
275 INITIAL = 'containers' | 276 INITIAL = 'containers' |
276 | 277 |
277 def get_description(self): | 278 def get_description(self): |
278 return "The receptacles for the coolant reservoirs." | 279 return _("The receptacles for the coolant reservoirs.") |
279 | 280 |
280 def interact_without(self): | 281 def interact_without(self): |
281 return Result("You stick your finger in the receptacle. " | 282 return Result(_("You stick your finger in the receptacle. " |
282 "It almost gets stuck.") | 283 "It almost gets stuck.")) |
283 | 284 |
284 def interact_with_full_detergent_bottle(self, item): | 285 def interact_with_full_detergent_bottle(self, item): |
285 if not self.scene.things['engine.cracked_pipe'].get_data('fixed'): | 286 if not self.scene.things['engine.cracked_pipe'].get_data('fixed'): |
286 return Result("Pouring the precious cryo fluid into a" | 287 return Result(_("Pouring the precious cryo fluid into a" |
287 " container connected to a cracked pipe would be a waste.") | 288 " container connected to a cracked pipe would be a waste.")) |
288 self.state.remove_inventory_item(item.name) | 289 self.state.remove_inventory_item(item.name) |
289 self.scene.things['engine.cryo_containers'].set_data('filled', True) | 290 self.scene.things['engine.cryo_containers'].set_data('filled', True) |
290 self.scene.things['engine.cryo_containers'].set_interact('full') | 291 self.scene.things['engine.cryo_containers'].set_interact('full') |
291 results = [Result("You fill the reservoirs. " | 292 results = [Result(_("You fill the reservoirs. " |
292 "The detergent bottle was just big enough, which " | 293 "The detergent bottle was just big enough, which " |
293 "is handy, because it's sprung a leak.")] | 294 "is handy, because it's sprung a leak."))] |
294 results.append(self.scene.engine_online_check()) | 295 results.append(self.scene.engine_online_check()) |
295 return results | 296 return results |
296 | 297 |
297 | 298 |
298 class CoolingPipes(Thing): | 299 class CoolingPipes(Thing): |
334 } | 335 } |
335 INITIAL = 'pipes' | 336 INITIAL = 'pipes' |
336 | 337 |
337 def get_description(self): | 338 def get_description(self): |
338 if not self.scene.things['engine.cryo_containers'].get_data('filled'): | 339 if not self.scene.things['engine.cryo_containers'].get_data('filled'): |
339 return "These pipes carry coolant to the superconductors. " \ | 340 return _("These pipes carry coolant to the superconductors. " \ |
340 "They feel warm." | 341 "They feel warm.") |
341 return "These pipes carry coolant to the superconductors. " \ | 342 return _("These pipes carry coolant to the superconductors. " \ |
342 "They are very cold." | 343 "They are very cold.") |
343 | 344 |
344 def is_interactive(self, tool=None): | 345 def is_interactive(self, tool=None): |
345 return False | 346 return False |
346 | 347 |
347 | 348 |
362 | 363 |
363 INITIAL = 'lines' | 364 INITIAL = 'lines' |
364 | 365 |
365 def get_description(self): | 366 def get_description(self): |
366 if self.scene.things['engine.superconductor'].get_data('working'): | 367 if self.scene.things['engine.superconductor'].get_data('working'): |
367 return "Power lines. They are delivering power to the engines." | 368 return _("Power lines. They are delivering power to the engines.") |
368 return "Power lines. It looks like they aren't working correctly." | 369 return _("Power lines. It looks like they aren't working correctly.") |
369 | 370 |
370 def is_interactive(self, tool=None): | 371 def is_interactive(self, tool=None): |
371 return False | 372 return False |
372 | 373 |
373 | 374 |
452 | 453 |
453 def is_interactive(self, tool=None): | 454 def is_interactive(self, tool=None): |
454 return False | 455 return False |
455 | 456 |
456 def get_description(self): | 457 def get_description(self): |
457 return "A gaping hole in the floor of the room. You're guessing" \ | 458 return _("A gaping hole in the floor of the room. You're guessing" \ |
458 " that's why there's a vacuum in here." | 459 " that's why there's a vacuum in here.") |
459 | 460 |
460 | 461 |
461 class CrackedPipe(Thing): | 462 class CrackedPipe(Thing): |
462 NAME = "engine.cracked_pipe" | 463 NAME = "engine.cracked_pipe" |
463 | 464 |
472 'fixed': False, | 473 'fixed': False, |
473 } | 474 } |
474 | 475 |
475 def get_description(self): | 476 def get_description(self): |
476 if self.get_data('fixed'): | 477 if self.get_data('fixed'): |
477 return "The duct tape appears to be holding." | 478 return _("The duct tape appears to be holding.") |
478 else: | 479 else: |
479 return "The pipe looks cracked and won't hold" \ | 480 return _("The pipe looks cracked and won't hold" \ |
480 " fluid until it's fixed." | 481 " fluid until it's fixed.") |
481 | 482 |
482 def interact_with_duct_tape(self, item): | 483 def interact_with_duct_tape(self, item): |
483 if self.get_data('fixed'): | 484 if self.get_data('fixed'): |
484 return Result("The duct tape already there appears to be " | 485 return Result(_("The duct tape already there appears to be " |
485 "sufficient.") | 486 "sufficient.")) |
486 else: | 487 else: |
487 self.set_data('fixed', True) | 488 self.set_data('fixed', True) |
488 self.set_interact('taped') | 489 self.set_interact('taped') |
489 return Result("You apply your trusty duct tape to the " | 490 return Result(_("You apply your trusty duct tape to the " |
490 "creak, sealing it.") | 491 "creak, sealing it.")) |
491 | 492 |
492 | 493 |
493 class ComputerConsole(Thing): | 494 class ComputerConsole(Thing): |
494 NAME = "engine.computer_console" | 495 NAME = "engine.computer_console" |
495 | 496 |
504 | 505 |
505 def interact_without(self): | 506 def interact_without(self): |
506 return Result(detail_view='engine_comp_detail') | 507 return Result(detail_view='engine_comp_detail') |
507 | 508 |
508 def get_description(self): | 509 def get_description(self): |
509 return "A computer console. It's alarmingly close to the engine." | 510 return _("A computer console. It's alarmingly close to the engine.") |
510 | 511 |
511 | 512 |
512 class EngineCompDetail(Scene): | 513 class EngineCompDetail(Scene): |
513 | 514 |
514 FOLDER = "engine" | 515 FOLDER = "engine" |
561 } | 562 } |
562 | 563 |
563 INITIAL = "door" | 564 INITIAL = "door" |
564 | 565 |
565 def get_description(self): | 566 def get_description(self): |
566 return "The airlock leads back to the rest of the ship." | 567 return _("The airlock leads back to the rest of the ship.") |
567 | 568 |
568 | 569 |
569 SCENES = [Engine] | 570 SCENES = [Engine] |
570 DETAIL_VIEWS = [EngineCompDetail] | 571 DETAIL_VIEWS = [EngineCompDetail] |