comparison gamelib/scenes/engine.py @ 478:a9925aaf5f61 1.0.1

i18n and Russian translation
author Stefano Rivera <stefano@rivera.za.net>
date Tue, 08 Mar 2011 12:29:14 +0200
parents 73f56bc78cc3
children 2f1952748cdb
comparison
equal deleted inserted replaced
477:51055400a9a8 478:a9925aaf5f61
7 from gamelib.scenes.scene_widgets import (Door, InteractText, InteractNoImage, 7 from gamelib.scenes.scene_widgets import (Door, InteractText, InteractNoImage,
8 InteractRectUnion, InteractImage, 8 InteractRectUnion, InteractImage,
9 InteractAnimated, GenericDescThing, 9 InteractAnimated, GenericDescThing,
10 make_jim_dialog) 10 make_jim_dialog)
11 11
12 from gamelib.i18n import _
12 13
13 class Engine(Scene): 14 class Engine(Scene):
14 15
15 FOLDER = "engine" 16 FOLDER = "engine"
16 BACKGROUND = "engine_room.png" 17 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.controlpanel', 2, 49 self.add_thing(GenericDescThing('engine.controlpanel', 2,
49 "A control panel. It seems dead.", 50 _("A control panel. It seems dead."),
50 ( 51 (
51 (513, 330, 58, 50), 52 (513, 330, 58, 50),
52 ) 53 )
53 )) 54 ))
54 self.add_thing(GenericDescThing('engine.superconductors', 4, 55 self.add_thing(GenericDescThing('engine.superconductors', 4,
55 "Superconductors. The engines must be power hogs.", 56 _("Superconductors. The engines must be power hogs."),
56 ( 57 (
57 (679, 246, 50, 56), 58 (679, 246, 50, 56),
58 (473, 280, 28, 23), 59 (473, 280, 28, 23),
59 (381, 224, 25, 22), 60 (381, 224, 25, 22),
60 ) 61 )
61 )) 62 ))
62 self.add_thing(GenericDescThing('engine.floor_hole', 5, 63 self.add_thing(GenericDescThing('engine.floor_hole', 5,
63 "A gaping hole in the floor of the room. You're guessing that's why there's a vacuum in here.", 64 _("A gaping hole in the floor of the room. You're guessing that's why there's a vacuum in here."),
64 ( 65 (
65 (257, 493, 141, 55), 66 (257, 493, 141, 55),
66 (301, 450, 95, 45), 67 (301, 450, 95, 45),
67 (377, 422, 19, 29), 68 (377, 422, 19, 29),
68 (239, 547, 123, 39), 69 (239, 547, 123, 39),
69 ) 70 )
70 )) 71 ))
71 self.add_thing(GenericDescThing('engine.empty_cans', 7, 72 self.add_thing(GenericDescThing('engine.empty_cans', 7,
72 "Empty chocolate-covered bacon cans? Poor guy, he must have found them irresistible.", 73 _("Empty chocolate-covered bacon cans? Poor guy, he must have found them irresistible."),
73 ( 74 (
74 (562, 422, 30, 31), 75 (562, 422, 30, 31),
75 ) 76 )
76 )) 77 ))
77 self.add_thing(GenericDescThing('engine.engines', 8, 78 self.add_thing(GenericDescThing('engine.engines', 8,
78 "The engines. They don't look like they are working.", 79 _("The engines. They don't look like they are working."),
79 ( 80 (
80 (342, 261, 109, 81), 81 (342, 261, 109, 81),
81 ) 82 )
82 )) 83 ))
83 self.add_thing(GenericDescThing('engine.laser_cutter', 9, 84 self.add_thing(GenericDescThing('engine.laser_cutter', 9,
84 "A burned-out laser cutter. It may be responsible for the hole in the floor.", 85 _("A burned-out laser cutter. It may be responsible for the hole in the floor."),
85 ( 86 (
86 (120, 466, 115, 67), 87 (120, 466, 115, 67),
87 ) 88 )
88 )) 89 ))
89 self.add_thing(GenericDescThing('engine.fuel_lines', 10, 90 self.add_thing(GenericDescThing('engine.fuel_lines', 10,
90 "The main fuel line for the engines.", 91 _("The main fuel line for the engines."),
91 ( 92 (
92 (220, 49, 59, 75), 93 (220, 49, 59, 75),
93 (239, 84, 51, 66), 94 (239, 84, 51, 66),
94 (271, 113, 28, 53), 95 (271, 113, 28, 53),
95 (285, 132, 26, 50), 96 (285, 132, 26, 50),
105 (438, 217, 30, 11), 106 (438, 217, 30, 11),
106 (435, 225, 18, 15), 107 (435, 225, 18, 15),
107 ) 108 )
108 )) 109 ))
109 self.add_thing(GenericDescThing('engine.spare_fuel_line', 11, 110 self.add_thing(GenericDescThing('engine.spare_fuel_line', 11,
110 "The spare fuel line. If something went wrong with the main one, you would hook that one up.", 111 _("The spare fuel line. If something went wrong with the main one, you would hook that one up."),
111 ( 112 (
112 (512, 49, 68, 44), 113 (512, 49, 68, 44),
113 ) 114 )
114 )) 115 ))
115 self.add_thing(GenericDescThing('engine.danger_area', 12, 116 self.add_thing(GenericDescThing('engine.danger_area', 12,
116 "The sign says DANGER. You would be wise to listen to it.", 117 _("The sign says DANGER. You would be wise to listen to it."),
117 ( 118 (
118 (293, 343, 211, 46), 119 (293, 343, 211, 46),
119 ) 120 )
120 )) 121 ))
121 self.add_thing(GenericDescThing('engine.exit_sign', 13, 122 self.add_thing(GenericDescThing('engine.exit_sign', 13,
122 "It's one of those glow-in-the-dark exit signs that you see everywhere.", 123 _("It's one of those glow-in-the-dark exit signs that you see everywhere."),
123 ( 124 (
124 (681, 322, 80, 33), 125 (681, 322, 80, 33),
125 ) 126 )
126 )) 127 ))
127 128
129 if self.things['engine.cryo_containers'].get_data('filled') \ 130 if self.things['engine.cryo_containers'].get_data('filled') \
130 and self.things['engine.superconductor'].get_data('working'): 131 and self.things['engine.superconductor'].get_data('working'):
131 self.set_data('engine online', True) 132 self.set_data('engine online', True)
132 self.remove_thing(self.things['engine.engines.8']) 133 self.remove_thing(self.things['engine.engines.8'])
133 self.add_thing(Engines()) 134 self.add_thing(Engines())
134 return make_jim_dialog("The engines are now operational. You have" 135 return make_jim_dialog(_("The engines are now operational. You have"
135 "done a satisfactory job, Prisoner %s." % PLAYER_ID, 136 "done a satisfactory job, Prisoner %s.") % PLAYER_ID,
136 self.state) 137 self.state)
137 138
138 def enter(self): 139 def enter(self):
139 if self.get_data('greet'): 140 if self.get_data('greet'):
140 self.set_data('greet', False) 141 self.set_data('greet', False)
141 return Result( 142 return Result(
142 "With your improvised helmet, the automatic airlock allows you into the engine room. Even if there wasn't a vacuum " 143 _("With your improvised helmet, the automatic airlock allows you into the engine room. Even if there wasn't a vacuum "
143 "it would be eerily quiet.") 144 "it would be eerily quiet."))
144 145
145 class Engines(Thing): 146 class Engines(Thing):
146 NAME = 'engine.engines' 147 NAME = 'engine.engines'
147 148
148 INTERACTS = { 149 INTERACTS = {
153 154
154 def is_interactive(self): 155 def is_interactive(self):
155 return False 156 return False
156 157
157 def get_description(self): 158 def get_description(self):
158 return "All systems are go! Or at least the engines are." 159 return _("All systems are go! Or at least the engines are.")
159 160
160 161
161 class CanOpener(Item): 162 class CanOpener(Item):
162 INVENTORY_IMAGE = 'can_opener.png' 163 INVENTORY_IMAGE = 'can_opener.png'
163 CURSOR = CursorSprite('can_opener_cursor.png') 164 CURSOR = CursorSprite('can_opener_cursor.png')
171 } 172 }
172 173
173 INITIAL = 'canopener' 174 INITIAL = 'canopener'
174 175
175 def get_description(self): 176 def get_description(self):
176 return "A can opener. Looks like you won't be starving" 177 return _("A can opener. Looks like you won't be starving")
177 178
178 def interact_without(self): 179 def interact_without(self):
179 self.state.add_inventory_item('canopener') 180 self.state.add_inventory_item('canopener')
180 self.scene.remove_thing(self) 181 self.scene.remove_thing(self)
181 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; "
182 "the vacuum has kept it in perfect condition.") 183 "the vacuum has kept it in perfect condition."))
183 184
184 185
185 class BrokenSuperconductor(Item): 186 class BrokenSuperconductor(Item):
186 INVENTORY_IMAGE = 'superconductor_broken.png' 187 INVENTORY_IMAGE = 'superconductor_broken.png'
187 CURSOR = CursorSprite('superconductor_broken_cursor.png') 188 CURSOR = CursorSprite('superconductor_broken_cursor.png')
203 'working': False, 204 'working': False,
204 } 205 }
205 206
206 def get_description(self): 207 def get_description(self):
207 if self.get_data('present') and not self.get_data('working'): 208 if self.get_data('present') and not self.get_data('working'):
208 return "That superconductor looks burned out. It's wedged in there pretty firmly." 209 return _("That superconductor looks burned out. It's wedged in there pretty firmly.")
209 elif not self.get_data('present'): 210 elif not self.get_data('present'):
210 return "An empty superconductor socket" 211 return _("An empty superconductor socket")
211 else: 212 else:
212 return "A working superconductor." 213 return _("A working superconductor.")
213 214
214 def interact_without(self): 215 def interact_without(self):
215 if self.get_data('present') and not self.get_data('working'): 216 if self.get_data('present') and not self.get_data('working'):
216 return Result("It's wedged in there pretty firmly, it won't come out.") 217 return Result(_("It's wedged in there pretty firmly, it won't come out."))
217 elif self.get_data('working'): 218 elif self.get_data('working'):
218 return Result("You decide that working engines are more important than having a shiny superconductor.") 219 return Result(_("You decide that working engines are more important than having a shiny superconductor."))
219 220
220 def interact_with_machete(self, item): 221 def interact_with_machete(self, item):
221 if self.get_data('present') and not self.get_data('working'): 222 if self.get_data('present') and not self.get_data('working'):
222 self.set_interact('removed') 223 self.set_interact('removed')
223 self.set_data('present', False) 224 self.set_data('present', False)
224 self.state.add_inventory_item('superconductor_broken') 225 self.state.add_inventory_item('superconductor_broken')
225 return Result("With leverage, the burned-out superconductor snaps out.") 226 return Result(_("With leverage, the burned-out superconductor snaps out."))
226 227
227 def interact_with_superconductor(self, item): 228 def interact_with_superconductor(self, item):
228 if self.get_data('present'): 229 if self.get_data('present'):
229 return Result("It might help to remove the broken superconductor first") 230 return Result(_("It might help to remove the broken superconductor first"))
230 else: 231 else:
231 return Result("You plug in the superconductor, and feel a hum " 232 return Result(_("You plug in the superconductor, and feel a hum "
232 "as things kick into life. " 233 "as things kick into life. "
233 "Unfortunately, it's the wrong size for the socket " 234 "Unfortunately, it's the wrong size for the socket "
234 "and just falls out again when you let go.") 235 "and just falls out again when you let go."))
235 236
236 def interact_with_taped_superconductor(self, item): 237 def interact_with_taped_superconductor(self, item):
237 if not self.get_data('present'): 238 if not self.get_data('present'):
238 self.set_interact('fixed') 239 self.set_interact('fixed')
239 self.set_data('present', True) 240 self.set_data('present', True)
240 self.set_data('working', True) 241 self.set_data('working', True)
241 self.state.remove_inventory_item(item.name) 242 self.state.remove_inventory_item(item.name)
242 results = [Result("The chair's superconductor looks over-specced " 243 results = [Result(_("The chair's superconductor looks over-specced "
243 "for this job, but it should work.")] 244 "for this job, but it should work."))]
244 results.append(self.scene.engine_online_check()) 245 results.append(self.scene.engine_online_check())
245 return results 246 return results
246 else: 247 else:
247 return Result("It might help to remove the broken superconductor first.") 248 return Result(_("It might help to remove the broken superconductor first."))
248 249
249 250
250 class CryoContainers(Thing): 251 class CryoContainers(Thing):
251 NAME = 'engine.cryo_containers' 252 NAME = 'engine.cryo_containers'
252 253
261 'filled': False, 262 'filled': False,
262 } 263 }
263 264
264 def get_description(self): 265 def get_description(self):
265 if not self.get_data('filled'): 266 if not self.get_data('filled'):
266 return "Those are coolant reservoirs. They look empty." 267 return _("Those are coolant reservoirs. They look empty.")
267 return "The coolant reservoirs are full." 268 return _("The coolant reservoirs are full.")
268 269
269 def is_interactive(self): 270 def is_interactive(self):
270 return False 271 return False
271 272
272 273
282 } 283 }
283 284
284 INITIAL = 'containers' 285 INITIAL = 'containers'
285 286
286 def get_description(self): 287 def get_description(self):
287 return "The receptacles for the coolant reservoirs." 288 return _("The receptacles for the coolant reservoirs.")
288 289
289 def interact_without(self): 290 def interact_without(self):
290 return Result("You stick your finger in the receptacle. " 291 return Result(_("You stick your finger in the receptacle. "
291 "It almost gets stuck.") 292 "It almost gets stuck."))
292 293
293 def interact_with_full_detergent_bottle(self, item): 294 def interact_with_full_detergent_bottle(self, item):
294 if not self.scene.things['engine.cracked_pipe'].get_data('fixed'): 295 if not self.scene.things['engine.cracked_pipe'].get_data('fixed'):
295 return Result("Pouring the precious cryo fluid into a" 296 return Result(_("Pouring the precious cryo fluid into a"
296 " container connected to a cracked pipe would be a waste.") 297 " container connected to a cracked pipe would be a waste."))
297 self.state.remove_inventory_item(item.name) 298 self.state.remove_inventory_item(item.name)
298 self.scene.things['engine.cryo_containers'].set_data('filled', True) 299 self.scene.things['engine.cryo_containers'].set_data('filled', True)
299 self.scene.things['engine.cryo_containers'].set_interact('full') 300 self.scene.things['engine.cryo_containers'].set_interact('full')
300 results = [Result("You fill the reservoirs. " 301 results = [Result(_("You fill the reservoirs. "
301 "The detergent bottle was just big enough, which " 302 "The detergent bottle was just big enough, which "
302 "is handy, because it's sprung a leak.")] 303 "is handy, because it's sprung a leak."))]
303 results.append(self.scene.engine_online_check()) 304 results.append(self.scene.engine_online_check())
304 return results 305 return results
305 306
306 307
307 class CoolingPipes(Thing): 308 class CoolingPipes(Thing):
343 } 344 }
344 INITIAL = 'pipes' 345 INITIAL = 'pipes'
345 346
346 def get_description(self): 347 def get_description(self):
347 if not self.scene.things['engine.cryo_containers'].get_data('filled'): 348 if not self.scene.things['engine.cryo_containers'].get_data('filled'):
348 return "These pipes carry coolant to the superconductors. " \ 349 return _("These pipes carry coolant to the superconductors. " \
349 "They feel warm." 350 "They feel warm.")
350 return "These pipes carry coolant to the superconductors. " \ 351 return _("These pipes carry coolant to the superconductors. " \
351 "They are very cold." 352 "They are very cold.")
352 353
353 def is_interactive(self): 354 def is_interactive(self):
354 return False 355 return False
355 356
356 357
371 372
372 INITIAL = 'lines' 373 INITIAL = 'lines'
373 374
374 def get_description(self): 375 def get_description(self):
375 if self.scene.things['engine.superconductor'].get_data('working'): 376 if self.scene.things['engine.superconductor'].get_data('working'):
376 return "Power lines. They are delivering power to the engines." 377 return _("Power lines. They are delivering power to the engines.")
377 return "Power lines. It looks like they aren't working correctly." 378 return _("Power lines. It looks like they aren't working correctly.")
378 379
379 def is_interactive(self): 380 def is_interactive(self):
380 return False 381 return False
381 382
382 383
461 462
462 def is_interactive(self): 463 def is_interactive(self):
463 return False 464 return False
464 465
465 def get_description(self): 466 def get_description(self):
466 return "A gaping hole in the floor of the room. You're guessing" \ 467 return _("A gaping hole in the floor of the room. You're guessing" \
467 " that's why there's a vacuum in here." 468 " that's why there's a vacuum in here.")
468 469
469 470
470 class CrackedPipe(Thing): 471 class CrackedPipe(Thing):
471 NAME = "engine.cracked_pipe" 472 NAME = "engine.cracked_pipe"
472 473
481 'fixed': False, 482 'fixed': False,
482 } 483 }
483 484
484 def get_description(self): 485 def get_description(self):
485 if self.get_data('fixed'): 486 if self.get_data('fixed'):
486 return "The duct tape appears to be holding." 487 return _("The duct tape appears to be holding.")
487 else: 488 else:
488 return "The pipe looks cracked and won't hold" \ 489 return _("The pipe looks cracked and won't hold" \
489 " fluid until it's fixed." 490 " fluid until it's fixed.")
490 491
491 def interact_with_duct_tape(self, item): 492 def interact_with_duct_tape(self, item):
492 if self.get_data('fixed'): 493 if self.get_data('fixed'):
493 return Result("The duct tape already there appears to be " 494 return Result(_("The duct tape already there appears to be "
494 "sufficient.") 495 "sufficient."))
495 else: 496 else:
496 self.set_data('fixed', True) 497 self.set_data('fixed', True)
497 self.set_interact('taped') 498 self.set_interact('taped')
498 return Result("You apply your trusty duct tape to the " 499 return Result(_("You apply your trusty duct tape to the "
499 "creak, sealing it.") 500 "creak, sealing it."))
500 501
501 502
502 class ComputerConsole(Thing): 503 class ComputerConsole(Thing):
503 NAME = "engine.computer_console" 504 NAME = "engine.computer_console"
504 505
510 511
511 def interact_without(self): 512 def interact_without(self):
512 return Result(detail_view='engine_comp_detail') 513 return Result(detail_view='engine_comp_detail')
513 514
514 def get_description(self): 515 def get_description(self):
515 return "A computer console. It's alarmingly close to the engine." 516 return _("A computer console. It's alarmingly close to the engine.")
516 517
517 518
518 class EngineCompDetail(Scene): 519 class EngineCompDetail(Scene):
519 520
520 FOLDER = "engine" 521 FOLDER = "engine"
569 } 570 }
570 571
571 INITIAL = "door" 572 INITIAL = "door"
572 573
573 def get_description(self): 574 def get_description(self):
574 return "The airlock leads back to the rest of the ship." 575 return _("The airlock leads back to the rest of the ship.")
575 576
576 577
577 SCENES = [Engine] 578 SCENES = [Engine]
578 DETAIL_VIEWS = [EngineCompDetail] 579 DETAIL_VIEWS = [EngineCompDetail]