comparison gamelib/scenes/cryo.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
12 GenericDescThing) 12 GenericDescThing)
13 13
14 from gamelib.scenes.game_constants import PLAYER_ID 14 from gamelib.scenes.game_constants import PLAYER_ID
15 from gamelib.scenes.game_widgets import Door, make_jim_dialog 15 from gamelib.scenes.game_widgets import Door, make_jim_dialog
16 16
17 from gamelib.i18n import _
17 18
18 class Cryo(Scene): 19 class Cryo(Scene):
19 20
20 FOLDER = "cryo" 21 FOLDER = "cryo"
21 BACKGROUND = "cryo_room.png" 22 BACKGROUND = "cryo_room.png"
47 self.add_thing(CryoPools()) 48 self.add_thing(CryoPools())
48 49
49 # Flavour items 50 # Flavour items
50 # pipes 51 # pipes
51 self.add_thing(GenericDescThing('cryo.pipes', 1, 52 self.add_thing(GenericDescThing('cryo.pipes', 1,
52 "These pipes carry cooling fluid to the cryo units.", 53 _("These pipes carry cooling fluid to the cryo units."),
53 ( 54 (
54 (552, 145, 129, 66), 55 (552, 145, 129, 66),
55 (636, 82, 165, 60), 56 (636, 82, 165, 60),
56 (140, 135, 112, 73), 57 (140, 135, 112, 73),
57 (11, 63, 140, 67), 58 (11, 63, 140, 67),
58 ))) 59 )))
59 self.add_thing(UncuttableCryoPipes()) 60 self.add_thing(UncuttableCryoPipes())
60 61
61 # cryo units 62 # cryo units
62 self.add_thing(GenericCryoUnit(2, 63 self.add_thing(GenericCryoUnit(2,
63 "An empty cryo chamber.", 64 _("An empty cryo chamber."),
64 "Prisoner 81E4-C8900480E635. Embezzlement. 20 years.", 65 _("Prisoner 81E4-C8900480E635. Embezzlement. 20 years."),
65 ( 66 (
66 (155, 430, 50, 35), 67 (155, 430, 50, 35),
67 (125, 450, 60, 35), 68 (125, 450, 60, 35),
68 (95, 470, 60, 35), 69 (95, 470, 60, 35),
69 (55, 490, 60, 55), 70 (55, 490, 60, 55),
70 ))) 71 )))
71 72
72 self.add_thing(GenericCryoUnit(3, 73 self.add_thing(GenericCryoUnit(3,
73 "A working cryo chamber. The frosted glass obscures the details of the occupant.", 74 _("A working cryo chamber. The frosted glass obscures the details of the occupant."),
74 "Prisoner 9334-CE1EB0243BAB. Murder. 40 years.", 75 _("Prisoner 9334-CE1EB0243BAB. Murder. 40 years."),
75 ( 76 (
76 (215, 430, 50, 35), 77 (215, 430, 50, 35),
77 (205, 450, 50, 35), 78 (205, 450, 50, 35),
78 (185, 470, 50, 35), 79 (185, 470, 50, 35),
79 (125, 505, 80, 40), 80 (125, 505, 80, 40),
80 ))) 81 )))
81 82
82 self.add_thing(GenericCryoUnit(4, 83 self.add_thing(GenericCryoUnit(4,
83 "A broken cryo chamber. The skeleton inside has been picked clean.", 84 _("A broken cryo chamber. The skeleton inside has been picked clean."),
84 "Prisoner BFBC-8BF4C6B7492B. Importing illegal alien biomatter. 15 years.", 85 _("Prisoner BFBC-8BF4C6B7492B. Importing illegal alien biomatter. 15 years."),
85 ( 86 (
86 (275, 430, 50, 70), 87 (275, 430, 50, 70),
87 (255, 460, 50, 70), 88 (255, 460, 50, 70),
88 (235, 490, 50, 60), 89 (235, 490, 50, 60),
89 ))) 90 )))
90 91
91 self.add_thing(GenericCryoUnit(5, 92 self.add_thing(GenericCryoUnit(5,
92 "A working cryo chamber. The frosted glass obscures the details of the occupant.", 93 _("A working cryo chamber. The frosted glass obscures the details of the occupant."),
93 "Prisoner B520-99495B8C41CE. Copyright infringement. 60 years.", 94 _("Prisoner B520-99495B8C41CE. Copyright infringement. 60 years."),
94 ( 95 (
95 (340, 430, 50, 70), 96 (340, 430, 50, 70),
96 (330, 500, 60, 50), 97 (330, 500, 60, 50),
97 ))) 98 )))
98 99
99 self.add_thing(GenericCryoUnit(6, 100 self.add_thing(GenericCryoUnit(6,
100 "An empty cryo unit. Recently filled by you.", 101 _("An empty cryo unit. Recently filled by you."),
101 "Prisoner %s. Safecracking, grand larceny. 30 years." % PLAYER_ID, 102 _("Prisoner %s. Safecracking, grand larceny. 30 years.") % PLAYER_ID,
102 ( 103 (
103 (399, 426, 70, 56), 104 (399, 426, 70, 56),
104 (404, 455, 69, 120), 105 (404, 455, 69, 120),
105 ))) 106 )))
106 107
107 self.add_thing(GenericCryoUnit(7, 108 self.add_thing(GenericCryoUnit(7,
108 "An empty cryo unit.", 109 _("An empty cryo unit."),
109 "Prisoner 83F1-CE32D3234749. Spamming. 5 years.", 110 _("Prisoner 83F1-CE32D3234749. Spamming. 5 years."),
110 ( 111 (
111 (472, 432, 58, 51), 112 (472, 432, 58, 51),
112 (488, 455, 41, 134), 113 (488, 455, 41, 134),
113 (517, 487, 42, 93), 114 (517, 487, 42, 93),
114 ))) 115 )))
115 116
116 self.add_thing(GenericCryoUnit(8, 117 self.add_thing(GenericCryoUnit(8,
117 "An empty cryo unit.", 118 _("An empty cryo unit."),
118 "Prisoner A455-9DF9F43C43E5. Medical malpractice. 10 years.", 119 _("Prisoner A455-9DF9F43C43E5. Medical malpractice. 10 years."),
119 ( 120 (
120 (596, 419, 69, 39), 121 (596, 419, 69, 39),
121 (616, 442, 82, 40), 122 (616, 442, 82, 40),
122 (648, 467, 84, 37), 123 (648, 467, 84, 37),
123 (681, 491, 97, 60), 124 (681, 491, 97, 60),
129 background_playlist = PlayList(pieces, random=True, repeat=True) 130 background_playlist = PlayList(pieces, random=True, repeat=True)
130 change_playlist(background_playlist) 131 change_playlist(background_playlist)
131 if self.get_data('greet'): 132 if self.get_data('greet'):
132 self.set_data('greet', False) 133 self.set_data('greet', False)
133 return make_jim_dialog( 134 return make_jim_dialog(
134 "Greetings, Prisoner %s. I am the Judicial " 135 _("Greetings, Prisoner %s. I am the Judicial "
135 "Incarceration Monitor. " 136 "Incarceration Monitor. "
136 "You have been woken early under the terms of the " 137 "You have been woken early under the terms of the "
137 "emergency conscription act to assist with repairs to " 138 "emergency conscription act to assist with repairs to "
138 "the ship. Your behaviour during this time will " 139 "the ship. Your behaviour during this time will "
139 "be noted on your record and will be relayed to " 140 "be noted on your record and will be relayed to "
140 "prison officials when we reach the destination. " 141 "prison officials when we reach the destination. "
141 "Please report to the bridge." % PLAYER_ID, self.state) 142 "Please report to the bridge.") % PLAYER_ID, self.state)
142 143
143 def leave(self): 144 def leave(self):
144 # Stop music 145 # Stop music
145 change_playlist(None) 146 change_playlist(None)
146 147
159 self.set_data('fixed', False) 160 self.set_data('fixed', False)
160 pipe = TubeFragment('tube_fragment') 161 pipe = TubeFragment('tube_fragment')
161 self.state.add_item(pipe) 162 self.state.add_item(pipe)
162 self.state.add_inventory_item(pipe.name) 163 self.state.add_inventory_item(pipe.name)
163 self.set_interact("chopped") 164 self.set_interact("chopped")
164 responses = [Result("It takes more effort than one would expect, but " 165 responses = [Result(_("It takes more effort than one would expect, but "
165 "eventually the pipe is separated from the wall.", 166 "eventually the pipe is separated from the wall."),
166 soundfile="chop-chop.ogg")] 167 soundfile="chop-chop.ogg")]
167 if self.state.current_scene.get_data('vandalism_warn'): 168 if self.state.current_scene.get_data('vandalism_warn'):
168 self.state.current_scene.set_data('vandalism_warn', False) 169 self.state.current_scene.set_data('vandalism_warn', False)
169 responses.append(make_jim_dialog( 170 responses.append(make_jim_dialog(
170 ("Prisoner %s. Vandalism is an offence punishable by a " 171 _("Prisoner %s. Vandalism is an offence punishable by a "
171 "minimum of an additional 6 months to your sentence." 172 "minimum of an additional 6 months to your sentence."
172 ) % PLAYER_ID, self.state)) 173 ) % PLAYER_ID, self.state))
173 return responses 174 return responses
174 175
175 def is_interactive(self, tool=None): 176 def is_interactive(self, tool=None):
176 return self.get_data('fixed') 177 return self.get_data('fixed')
177 178
178 def interact_without(self): 179 def interact_without(self):
179 if self.get_data('fixed'): 180 if self.get_data('fixed'):
180 return Result("These pipes aren't attached to the wall very solidly.") 181 return Result(_("These pipes aren't attached to the wall very solidly."))
181 return None 182 return None
182 183
183 def get_description(self): 184 def get_description(self):
184 if self.get_data('fixed'): 185 if self.get_data('fixed'):
185 return "These pipes carry cooling fluid to empty cryo units." 186 return _("These pipes carry cooling fluid to empty cryo units.")
186 return "There used to be a pipe carrying cooling fluid here." 187 return _("There used to be a pipe carrying cooling fluid here.")
187 188
188 189
189 class UncuttableCryoPipes(Thing): 190 class UncuttableCryoPipes(Thing):
190 "Base class for cryo pipes that can't be cut down." 191 "Base class for cryo pipes that can't be cut down."
191 192
198 } 199 }
199 200
200 INITIAL = "fixed" 201 INITIAL = "fixed"
201 202
202 def interact_with_machete(self, item): 203 def interact_with_machete(self, item):
203 return Result("These pipes carry fluid to the working cryo units." 204 return Result(_("These pipes carry fluid to the working cryo units."
204 " Chopping them down doesn't seem sensible.") 205 " Chopping them down doesn't seem sensible."))
205 206
206 def is_interactive(self, tool=None): 207 def is_interactive(self, tool=None):
207 return True 208 return True
208 209
209 def interact_without(self): 210 def interact_without(self):
210 return Result("These pipes aren't attached to the wall very solidly.") 211 return Result(_("These pipes aren't attached to the wall very solidly."))
211 212
212 def get_description(self): 213 def get_description(self):
213 return "These pipes carry cooling fluid to the working cryo units." 214 return _("These pipes carry cooling fluid to the working cryo units.")
214 215
215 216
216 class TubeFragment(CloneableItem): 217 class TubeFragment(CloneableItem):
217 "Obtained after cutting down a cryo room pipe." 218 "Obtained after cutting down a cryo room pipe."
218 219
280 281
281 def interact_without(self): 282 def interact_without(self):
282 return Result(detail_view='cryo_detail') 283 return Result(detail_view='cryo_detail')
283 284
284 def interact_with_titanium_leg(self, item): 285 def interact_with_titanium_leg(self, item):
285 return Result("You hit the chamber that used to hold this very leg. Nothing happens as a result.", 286 return Result(_("You hit the chamber that used to hold this very leg. Nothing happens as a result."),
286 soundfile="clang2.ogg") 287 soundfile="clang2.ogg")
287 288
288 def get_description(self): 289 def get_description(self):
289 if self.get_data('contains_titanium_leg'): 290 if self.get_data('contains_titanium_leg'):
290 return "A broken cryo chamber, with a poor unfortunate corpse inside." 291 return _("A broken cryo chamber, with a poor unfortunate corpse inside.")
291 return "A broken cryo chamber. The corpse inside is missing a leg." 292 return _("A broken cryo chamber. The corpse inside is missing a leg.")
292 293
293 294
294 class GenericCryoUnit(GenericDescThing): 295 class GenericCryoUnit(GenericDescThing):
295 "Generic Cryo unit" 296 "Generic Cryo unit"
296 297
307 def get_description(self): 308 def get_description(self):
308 return self.description 309 return self.description
309 310
310 def interact_with_titanium_leg(self, item): 311 def interact_with_titanium_leg(self, item):
311 return Result(random.choice([ 312 return Result(random.choice([
312 "You bang on the chamber with the titanium femur. Nothing much happens.", 313 _("You bang on the chamber with the titanium femur. Nothing much happens."),
313 "Hitting the cryo unit with the femur doesn't achieve anything.", 314 _("Hitting the cryo unit with the femur doesn't achieve anything."),
314 "You hit the chamber with the femur. Nothing happens.", 315 _("You hit the chamber with the femur. Nothing happens."),
315 ]), soundfile="clang2.ogg") 316 ]), soundfile="clang2.ogg")
316 317
317 318
318 class CryoRoomDoor(Door): 319 class CryoRoomDoor(Door):
319 "Door to the cryo room." 320 "Door to the cryo room."
333 } 334 }
334 335
335 def interact_with_titanium_leg(self, item): 336 def interact_with_titanium_leg(self, item):
336 if self.get_data('door') == "ajar": 337 if self.get_data('door') == "ajar":
337 self.open_door() 338 self.open_door()
338 return Result("You wedge the titanium femur into the chain and twist. With a satisfying *snap*, the chain breaks and the door opens.", soundfile='break.ogg') 339 return Result(_("You wedge the titanium femur into the chain and twist. With a satisfying *snap*, the chain breaks and the door opens."), soundfile='break.ogg')
339 elif self.get_data('door') == "shut": 340 elif self.get_data('door') == "shut":
340 text = "You bang on the door with the titanium femur. It makes a clanging sound." 341 text = _("You bang on the door with the titanium femur. It makes a clanging sound.")
341 return Result(text, soundfile='clang.ogg') 342 return Result(text, soundfile='clang.ogg')
342 else: 343 else:
343 return Result("You wave the femur in the doorway. Nothing happens.") 344 return Result(_("You wave the femur in the doorway. Nothing happens."))
344 345
345 def interact_without(self): 346 def interact_without(self):
346 if self.get_data('door') == "shut": 347 if self.get_data('door') == "shut":
347 self.half_open_door() 348 self.half_open_door()
348 if self.get_data('door') != "open": 349 if self.get_data('door') != "open":
349 return Result("It moves slightly and then stops. A chain on the other side is preventing it from opening completely.", soundfile='chain.ogg') 350 return Result(_("It moves slightly and then stops. A chain on the other side is preventing it from opening completely."), soundfile='chain.ogg')
350 else: 351 else:
351 self.state.set_current_scene('map') 352 self.state.set_current_scene('map')
352 return None 353 return None
353 354
354 def interact_default(self, item): 355 def interact_default(self, item):
362 self.set_data('door', "open") 363 self.set_data('door', "open")
363 self.set_interact("open") 364 self.set_interact("open")
364 365
365 def get_description(self): 366 def get_description(self):
366 if self.get_data('door') == "open": 367 if self.get_data('door') == "open":
367 return 'An open doorway leads to the rest of the ship.' 368 return _('An open doorway leads to the rest of the ship.')
368 elif self.get_data('door') == "ajar": 369 elif self.get_data('door') == "ajar":
369 return ("A rusty door. It can't open all the way because of a " 370 return _("A rusty door. It can't open all the way because of a "
370 "chain on the other side.") 371 "chain on the other side.")
371 return 'A rusty door. It is currently closed.' 372 return _('A rusty door. It is currently closed.')
372 373
373 374
374 class CryoComputer(Thing): 375 class CryoComputer(Thing):
375 "Computer in the cryo room." 376 "Computer in the cryo room."
376 377
387 388
388 def interact_without(self): 389 def interact_without(self):
389 return Result(detail_view='cryo_comp_detail') 390 return Result(detail_view='cryo_comp_detail')
390 391
391 def interact_with_titanium_leg(self, item): 392 def interact_with_titanium_leg(self, item):
392 return Result("Hitting it with the leg accomplishes nothing.") 393 return Result(_("Hitting it with the leg accomplishes nothing."))
393 394
394 def get_description(self): 395 def get_description(self):
395 return "A computer terminal, with some text on it." 396 return _("A computer terminal, with some text on it.")
396 397
397 398
398 class TitaniumLegThing(Thing): 399 class TitaniumLegThing(Thing):
399 "Triangle in the cryo room." 400 "Triangle in the cryo room."
400 401
408 409
409 def interact_without(self): 410 def interact_without(self):
410 self.state.add_inventory_item('titanium_leg') 411 self.state.add_inventory_item('titanium_leg')
411 self.state.current_scene.things['cryo.unit.1'].set_data('contains_titanium_leg', False) 412 self.state.current_scene.things['cryo.unit.1'].set_data('contains_titanium_leg', False)
412 self.scene.remove_thing(self) 413 self.scene.remove_thing(self)
413 return Result("The skeletal occupant of this cryo unit has an artificial femur made of titanium. You take it.") 414 return Result(_("The skeletal occupant of this cryo unit has an artificial femur made of titanium. You take it."))
414 415
415 def get_description(self): 416 def get_description(self):
416 return "This femur looks synthetic." 417 return _("This femur looks synthetic.")
417 418
418 419
419 class PlaqueThing(Thing): 420 class PlaqueThing(Thing):
420 "Plaque on the detailed cryo chamber" 421 "Plaque on the detailed cryo chamber"
421 422
426 } 427 }
427 428
428 INITIAL = "plaque" 429 INITIAL = "plaque"
429 430
430 def interact_without(self): 431 def interact_without(self):
431 return Result("The plaque is welded to the unit. You can't shift it.") 432 return Result(_("The plaque is welded to the unit. You can't shift it."))
432 433
433 def get_description(self): 434 def get_description(self):
434 return "'Prisoner 98CC-764E646391EE. War crimes. 45 years." 435 return _("'Prisoner 98CC-764E646391EE. War crimes. 45 years.")
435 436
436 437
437 class FullBottle(Item): 438 class FullBottle(Item):
438 INVENTORY_IMAGE = 'bottle_full.png' 439 INVENTORY_IMAGE = 'bottle_full.png'
439 CURSOR = CursorSprite('bottle_full_cursor.png', 27, 7) 440 CURSOR = CursorSprite('bottle_full_cursor.png', 27, 7)
453 } 454 }
454 455
455 INITIAL = 'pools' 456 INITIAL = 'pools'
456 457
457 def get_description(self): 458 def get_description(self):
458 return "Coolant leaks disturbingly from the bulkheads." 459 return _("Coolant leaks disturbingly from the bulkheads.")
459 460
460 def interact_without(self): 461 def interact_without(self):
461 return Result("It's gooey") 462 return Result(_("It's gooey"))
462 463
463 def interact_with_detergent_bottle(self, item): 464 def interact_with_detergent_bottle(self, item):
464 full = FullBottle('full_detergent_bottle') 465 full = FullBottle('full_detergent_bottle')
465 self.state.add_item(full) 466 self.state.add_item(full)
466 self.state.replace_inventory_item(item.name, full.name) 467 self.state.replace_inventory_item(item.name, full.name)
467 return Result("You scoop up some coolant and fill the bottle.") 468 return Result(_("You scoop up some coolant and fill the bottle."))
468 469
469 470
470 class CryoCompDetail(Scene): 471 class CryoCompDetail(Scene):
471 472
472 FOLDER = "cryo" 473 FOLDER = "cryo"