comparison gamelib/scenes/cryo.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 bdaffaa8b6bf
comparison
equal deleted inserted replaced
764:a8510f4e2ea1 770:a35f5364437d
1 """Cryo room where the prisoner starts out.""" 1 """Cryo room where the prisoner starts out."""
2 2
3 import random 3 import random
4 4
5 from pyntnclick.i18n import _
5 from pyntnclick.cursor import CursorSprite 6 from pyntnclick.cursor import CursorSprite
6 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result 7 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result
7 from pyntnclick.scenewidgets import ( 8 from pyntnclick.scenewidgets import (
8 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated, 9 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated,
9 GenericDescThing, TakeableThing) 10 GenericDescThing, TakeableThing)
43 self.add_thing(CryoPools()) 44 self.add_thing(CryoPools())
44 45
45 # Flavour items 46 # Flavour items
46 # pipes 47 # pipes
47 self.add_thing(GenericDescThing('cryo.pipes', 1, 48 self.add_thing(GenericDescThing('cryo.pipes', 1,
48 "These pipes carry cooling fluid to the cryo units.", 49 _("These pipes carry cooling fluid to the cryo units."),
49 ( 50 (
50 (552, 145, 129, 66), 51 (552, 145, 129, 66),
51 (636, 82, 165, 60), 52 (636, 82, 165, 60),
52 (140, 135, 112, 73), 53 (140, 135, 112, 73),
53 (11, 63, 140, 67), 54 (11, 63, 140, 67),
54 ))) 55 )))
55 self.add_thing(UncuttableCryoPipes()) 56 self.add_thing(UncuttableCryoPipes())
56 57
57 # cryo units 58 # cryo units
58 self.add_thing(GenericCryoUnit(2, 59 self.add_thing(GenericCryoUnit(2,
59 "An empty cryo chamber.", 60 _("An empty cryo chamber."),
60 "Prisoner 81E4-C8900480E635. Embezzlement. 20 years.", 61 _("Prisoner 81E4-C8900480E635. Embezzlement. 20 years."),
61 ( 62 (
62 (155, 430, 50, 35), 63 (155, 430, 50, 35),
63 (125, 450, 60, 35), 64 (125, 450, 60, 35),
64 (95, 470, 60, 35), 65 (95, 470, 60, 35),
65 (55, 490, 60, 55), 66 (55, 490, 60, 55),
66 ))) 67 )))
67 68
68 self.add_thing(GenericCryoUnit(3, 69 self.add_thing(GenericCryoUnit(3,
69 "A working cryo chamber. The frosted glass obscures the details" 70 _("A working cryo chamber. The frosted glass obscures the details"
70 " of the occupant.", 71 " of the occupant."),
71 "Prisoner 9334-CE1EB0243BAB. Murder. 40 years.", 72 _("Prisoner 9334-CE1EB0243BAB. Murder. 40 years."),
72 ( 73 (
73 (215, 430, 50, 35), 74 (215, 430, 50, 35),
74 (205, 450, 50, 35), 75 (205, 450, 50, 35),
75 (185, 470, 50, 35), 76 (185, 470, 50, 35),
76 (125, 505, 80, 40), 77 (125, 505, 80, 40),
77 ))) 78 )))
78 79
79 self.add_thing(GenericCryoUnit(4, 80 self.add_thing(GenericCryoUnit(4,
80 "A broken cryo chamber. The skeleton inside has been picked" 81 _("A broken cryo chamber. The skeleton inside has been picked"
81 " clean.", 82 " clean."),
82 "Prisoner BFBC-8BF4C6B7492B. Importing illegal alien biomatter." 83 _("Prisoner BFBC-8BF4C6B7492B. Importing illegal alien biomatter."
83 " 15 years.", 84 " 15 years."),
84 ( 85 (
85 (275, 430, 50, 70), 86 (275, 430, 50, 70),
86 (255, 460, 50, 70), 87 (255, 460, 50, 70),
87 (235, 490, 50, 60), 88 (235, 490, 50, 60),
88 ))) 89 )))
89 90
90 self.add_thing(GenericCryoUnit(5, 91 self.add_thing(GenericCryoUnit(5,
91 "A working cryo chamber. The frosted glass obscures the details of" 92 _("A working cryo chamber. The frosted glass obscures the details "
92 " the occupant.", 93 "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.")
103 % PLAYER_ID,
102 ( 104 (
103 (399, 426, 70, 56), 105 (399, 426, 70, 56),
104 (404, 455, 69, 120), 106 (404, 455, 69, 120),
105 ))) 107 )))
106 108
107 self.add_thing(GenericCryoUnit(7, 109 self.add_thing(GenericCryoUnit(7,
108 "An empty cryo unit.", 110 _("An empty cryo unit."),
109 "Prisoner 83F1-CE32D3234749. Spamming. 5 years.", 111 _("Prisoner 83F1-CE32D3234749. Spamming. 5 years."),
110 ( 112 (
111 (472, 432, 58, 51), 113 (472, 432, 58, 51),
112 (488, 455, 41, 134), 114 (488, 455, 41, 134),
113 (517, 487, 42, 93), 115 (517, 487, 42, 93),
114 ))) 116 )))
115 117
116 self.add_thing(GenericCryoUnit(8, 118 self.add_thing(GenericCryoUnit(8,
117 "An empty cryo unit.", 119 _("An empty cryo unit."),
118 "Prisoner A455-9DF9F43C43E5. Medical malpractice. 10 years.", 120 _("Prisoner A455-9DF9F43C43E5. Medical malpractice. 10 years."),
119 ( 121 (
120 (596, 419, 69, 39), 122 (596, 419, 69, 39),
121 (616, 442, 82, 40), 123 (616, 442, 82, 40),
122 (648, 467, 84, 37), 124 (648, 467, 84, 37),
123 (681, 491, 97, 60), 125 (681, 491, 97, 60),
130 repeat=True) 132 repeat=True)
131 self.sound.change_playlist(background_playlist) 133 self.sound.change_playlist(background_playlist)
132 if self.get_data('greet'): 134 if self.get_data('greet'):
133 self.set_data('greet', False) 135 self.set_data('greet', False)
134 return make_jim_dialog( 136 return make_jim_dialog(
135 "Greetings, Prisoner %s. I am the Judicial " 137 _("Greetings, Prisoner %s. I am the Judicial "
136 "Incarceration Monitor. " 138 "Incarceration Monitor. "
137 "You have been woken early under the terms of the " 139 "You have been woken early under the terms of the "
138 "emergency conscription act to assist with repairs to " 140 "emergency conscription act to assist with repairs to "
139 "the ship. Your behaviour during this time will " 141 "the ship. Your behaviour during this time will "
140 "be noted on your record and will be relayed to " 142 "be noted on your record and will be relayed to "
141 "prison officials when we reach the destination. " 143 "prison officials when we reach the destination. "
142 "Please report to the bridge." % PLAYER_ID, self.game) 144 "Please report to the bridge.") % PLAYER_ID, self.game)
143 145
144 def leave(self): 146 def leave(self):
145 # Stop music 147 # Stop music
146 self.sound.change_playlist(None) 148 self.sound.change_playlist(None)
147 149
165 self.set_data('fixed', False) 167 self.set_data('fixed', False)
166 pipe = TubeFragment('tube_fragment') 168 pipe = TubeFragment('tube_fragment')
167 self.game.add_item(pipe) 169 self.game.add_item(pipe)
168 self.game.add_inventory_item(pipe.name) 170 self.game.add_inventory_item(pipe.name)
169 self.set_interact() 171 self.set_interact()
170 responses = [Result("It takes more effort than one would expect," 172 responses = [Result(_("It takes more effort than one would expect,"
171 " but eventually the pipe is separated from the wall.", 173 " but eventually the pipe is separated from"
172 soundfile="chop-chop.ogg")] 174 " the wall."), soundfile="chop-chop.ogg")]
173 if self.game.current_scene.get_data('vandalism_warn'): 175 if self.game.current_scene.get_data('vandalism_warn'):
174 self.game.current_scene.set_data('vandalism_warn', False) 176 self.game.current_scene.set_data('vandalism_warn', False)
175 responses.append(make_jim_dialog( 177 responses.append(make_jim_dialog(
176 ("Prisoner %s. Vandalism is an offence punishable by a " 178 _("Prisoner %s. Vandalism is an offence punishable by a "
177 "minimum of an additional 6 months to your sentence." 179 "minimum of an additional 6 months to your sentence."
178 ) % PLAYER_ID, self.game)) 180 ) % PLAYER_ID, self.game))
179 return responses 181 return responses
180 182
181 def is_interactive(self, tool=None): 183 def is_interactive(self, tool=None):
182 return self.get_data('fixed') 184 return self.get_data('fixed')
183 185
184 def interact_without(self): 186 def interact_without(self):
185 if self.get_data('fixed'): 187 if self.get_data('fixed'):
186 return Result("These pipes aren't attached to the wall very" 188 return Result(_("These pipes aren't attached to the wall very"
187 " solidly.") 189 " solidly."))
188 return None 190 return None
189 191
190 def get_description(self): 192 def get_description(self):
191 if self.get_data('fixed'): 193 if self.get_data('fixed'):
192 return "These pipes carry cooling fluid to empty cryo units." 194 return _("These pipes carry cooling fluid to empty cryo units.")
193 return "There used to be a pipe carrying cooling fluid here." 195 return _("There used to be a pipe carrying cooling fluid here.")
194 196
195 197
196 class UncuttableCryoPipes(Thing): 198 class UncuttableCryoPipes(Thing):
197 "Base class for cryo pipes that can't be cut down." 199 "Base class for cryo pipes that can't be cut down."
198 200
205 } 207 }
206 208
207 INITIAL = "fixed" 209 INITIAL = "fixed"
208 210
209 def interact_with_machete(self, item): 211 def interact_with_machete(self, item):
210 return Result("These pipes carry fluid to the working cryo units." 212 return Result(_("These pipes carry fluid to the working cryo units."
211 " Chopping them down doesn't seem sensible.") 213 " Chopping them down doesn't seem sensible."))
212 214
213 def is_interactive(self, tool=None): 215 def is_interactive(self, tool=None):
214 return True 216 return True
215 217
216 def interact_without(self): 218 def interact_without(self):
217 return Result("These pipes aren't attached to the wall very solidly.") 219 return Result(_("These pipes aren't attached to the wall very solidly."
218 220 ))
219 def get_description(self): 221
220 return "These pipes carry cooling fluid to the working cryo units." 222 def get_description(self):
223 return _("These pipes carry cooling fluid to the working cryo units.")
221 224
222 225
223 class TubeFragment(CloneableItem): 226 class TubeFragment(CloneableItem):
224 "Obtained after cutting down a cryo room pipe." 227 "Obtained after cutting down a cryo room pipe."
225 228
287 290
288 def interact_without(self): 291 def interact_without(self):
289 return Result(detail_view='cryo_detail') 292 return Result(detail_view='cryo_detail')
290 293
291 def interact_with_titanium_leg(self, item): 294 def interact_with_titanium_leg(self, item):
292 return Result("You hit the chamber that used to hold this very leg." 295 return Result(_("You hit the chamber that used to hold this very leg."
293 " Nothing happens as a result.", 296 " Nothing happens as a result."),
294 soundfile="clang2.ogg") 297 soundfile="clang2.ogg")
295 298
296 def get_description(self): 299 def get_description(self):
297 if self.get_data('contains_titanium_leg'): 300 if self.get_data('contains_titanium_leg'):
298 return "A broken cryo chamber, with a poor unfortunate corpse" \ 301 return _("A broken cryo chamber, with a poor unfortunate corpse"
299 " inside." 302 " inside.")
300 return "A broken cryo chamber. The corpse inside is missing a leg." 303 return _("A broken cryo chamber. The corpse inside is missing a leg.")
301 304
302 305
303 class GenericCryoUnit(GenericDescThing): 306 class GenericCryoUnit(GenericDescThing):
304 "Generic Cryo unit" 307 "Generic Cryo unit"
305 308
317 def get_description(self): 320 def get_description(self):
318 return self.description 321 return self.description
319 322
320 def interact_with_titanium_leg(self, item): 323 def interact_with_titanium_leg(self, item):
321 return Result(random.choice([ 324 return Result(random.choice([
322 "You bang on the chamber with the titanium femur. Nothing" 325 _("You bang on the chamber with the titanium femur. Nothing"
323 " much happens.", 326 " much happens."),
324 "Hitting the cryo unit with the femur doesn't achieve" 327 _("Hitting the cryo unit with the femur doesn't achieve"
325 " anything.", 328 " anything."),
326 "You hit the chamber with the femur. Nothing happens.", 329 _("You hit the chamber with the femur. Nothing happens."),
327 ]), soundfile="clang2.ogg") 330 ]), soundfile="clang2.ogg")
328 331
329 332
330 class CryoRoomDoor(Door): 333 class CryoRoomDoor(Door):
331 "Door to the cryo room." 334 "Door to the cryo room."
345 } 348 }
346 349
347 def interact_with_titanium_leg(self, item): 350 def interact_with_titanium_leg(self, item):
348 if self.get_data('door') == "ajar": 351 if self.get_data('door') == "ajar":
349 self.open_door() 352 self.open_door()
350 return Result("You wedge the titanium femur into the chain and" 353 return Result(_("You wedge the titanium femur into the chain and"
351 " twist. With a satisfying *snap*, the chain breaks and" 354 " twist. With a satisfying *snap*, the chain"
352 " the door opens.", soundfile='break.ogg') 355 " breaks and the door opens."),
356 soundfile='break.ogg')
353 elif self.get_data('door') == "shut": 357 elif self.get_data('door') == "shut":
354 text = ("You bang on the door with the titanium femur. It makes a" 358 text = _("You bang on the door with the titanium femur. It makes a"
355 " clanging sound.") 359 " clanging sound.")
356 return Result(text, soundfile='clang.ogg') 360 return Result(text, soundfile='clang.ogg')
357 else: 361 else:
358 return Result("You wave the femur in the doorway. Nothing" 362 return Result(_("You wave the femur in the doorway. Nothing"
359 " happens.") 363 " happens."))
360 364
361 def interact_without(self): 365 def interact_without(self):
362 if self.get_data('door') == "shut": 366 if self.get_data('door') == "shut":
363 self.half_open_door() 367 self.half_open_door()
364 if self.get_data('door') != "open": 368 if self.get_data('door') != "open":
365 return Result("It moves slightly and then stops. A chain on the" 369 return Result(_("It moves slightly and then stops. A chain on the"
366 " other side is preventing it from opening completely.", 370 " other side is preventing it from opening"
367 soundfile='chain.ogg') 371 " completely."), soundfile='chain.ogg')
368 else: 372 else:
369 self.game.change_scene('map') 373 self.game.change_scene('map')
370 return None 374 return None
371 375
372 def interact_default(self, item): 376 def interact_default(self, item):
383 self.set_data('door', "open") 387 self.set_data('door', "open")
384 self.set_interact() 388 self.set_interact()
385 389
386 def get_description(self): 390 def get_description(self):
387 if self.get_data('door') == "open": 391 if self.get_data('door') == "open":
388 return 'An open doorway leads to the rest of the ship.' 392 return _('An open doorway leads to the rest of the ship.')
389 elif self.get_data('door') == "ajar": 393 elif self.get_data('door') == "ajar":
390 return ("A rusty door. It can't open all the way because of a " 394 return _("A rusty door. It can't open all the way because of a "
391 "chain on the other side.") 395 "chain on the other side.")
392 return 'A rusty door. It is currently closed.' 396 return _('A rusty door. It is currently closed.')
393 397
394 398
395 class CryoComputer(Thing): 399 class CryoComputer(Thing):
396 "Computer in the cryo room." 400 "Computer in the cryo room."
397 401
408 412
409 def interact_without(self): 413 def interact_without(self):
410 return Result(detail_view='cryo_comp_detail') 414 return Result(detail_view='cryo_comp_detail')
411 415
412 def interact_with_titanium_leg(self, item): 416 def interact_with_titanium_leg(self, item):
413 return Result("Hitting it with the leg accomplishes nothing.") 417 return Result(_("Hitting it with the leg accomplishes nothing."))
414 418
415 def get_description(self): 419 def get_description(self):
416 return "A computer terminal, with some text on it." 420 return _("A computer terminal, with some text on it.")
417 421
418 422
419 class TitaniumLegThing(TakeableThing): 423 class TitaniumLegThing(TakeableThing):
420 "Triangle in the cryo room." 424 "Triangle in the cryo room."
421 425
430 434
431 def interact_without(self): 435 def interact_without(self):
432 self.game.scenes['cryo'].things['cryo.unit.1'].set_data( 436 self.game.scenes['cryo'].things['cryo.unit.1'].set_data(
433 'contains_titanium_leg', False) 437 'contains_titanium_leg', False)
434 self.take() 438 self.take()
435 return Result("The skeletal occupant of this cryo unit has an" 439 return Result(_("The skeletal occupant of this cryo unit has an"
436 " artificial femur made of titanium. You take it.") 440 " artificial femur made of titanium. You take it."))
437 441
438 def get_description(self): 442 def get_description(self):
439 return "This femur looks synthetic." 443 return _("This femur looks synthetic.")
440 444
441 445
442 class PlaqueThing(Thing): 446 class PlaqueThing(Thing):
443 "Plaque on the detailed cryo chamber" 447 "Plaque on the detailed cryo chamber"
444 448
449 } 453 }
450 454
451 INITIAL = "plaque" 455 INITIAL = "plaque"
452 456
453 def interact_without(self): 457 def interact_without(self):
454 return Result("The plaque is welded to the unit. You can't shift it.") 458 return Result(_("The plaque is welded to the unit. You can't shift it."
455 459 ))
456 def get_description(self): 460
457 return "'Prisoner 98CC-764E646391EE. War crimes. 45 years." 461 def get_description(self):
462 return _("'Prisoner 98CC-764E646391EE. War crimes. 45 years.")
458 463
459 464
460 class FullBottle(Item): 465 class FullBottle(Item):
461 INVENTORY_IMAGE = 'bottle_full.png' 466 INVENTORY_IMAGE = 'bottle_full.png'
462 CURSOR = CursorSprite('bottle_full_cursor.png', 27, 7) 467 CURSOR = CursorSprite('bottle_full_cursor.png', 27, 7)
476 } 481 }
477 482
478 INITIAL = 'pools' 483 INITIAL = 'pools'
479 484
480 def get_description(self): 485 def get_description(self):
481 return "Coolant leaks disturbingly from the bulkheads." 486 return _("Coolant leaks disturbingly from the bulkheads.")
482 487
483 def interact_without(self): 488 def interact_without(self):
484 return Result("It's gooey") 489 return Result(_("It's gooey"))
485 490
486 def interact_with_detergent_bottle(self, item): 491 def interact_with_detergent_bottle(self, item):
487 full = FullBottle('full_detergent_bottle') 492 full = FullBottle('full_detergent_bottle')
488 self.game.add_item(full) 493 self.game.add_item(full)
489 self.game.replace_inventory_item(item.name, full.name) 494 self.game.replace_inventory_item(item.name, full.name)
490 return Result("You scoop up some coolant and fill the bottle.") 495 return Result(_("You scoop up some coolant and fill the bottle."))
491 496
492 497
493 class CryoCompDetail(Scene): 498 class CryoCompDetail(Scene):
494 499
495 FOLDER = "cryo" 500 FOLDER = "cryo"