comparison gamelib/scenes/bridge.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
7 from pygame.rect import Rect 7 from pygame.rect import Rect
8 from albow.music import change_playlist, get_music, PlayList 8 from albow.music import change_playlist, get_music, PlayList
9 from albow.resource import get_image 9 from albow.resource import get_image
10 10
11 from gamelib.cursor import CursorSprite 11 from gamelib.cursor import CursorSprite
12 from gamelib.i18n import _
12 from gamelib.state import Scene, Item, Thing, Result 13 from gamelib.state import Scene, Item, Thing, Result
13 from gamelib.sound import get_current_playlist 14 from gamelib.sound import get_current_playlist
14 from gamelib.constants import DEBUG 15 from gamelib.constants import DEBUG
15 from gamelib.scenewidgets import (InteractNoImage, InteractRectUnion, 16 from gamelib.scenewidgets import (InteractNoImage, InteractRectUnion,
16 InteractImage, InteractAnimated, 17 InteractImage, InteractAnimated,
57 self.add_thing(LeftLights()) 58 self.add_thing(LeftLights())
58 self.add_thing(RightLights()) 59 self.add_thing(RightLights())
59 self.add_thing(JimPanel()) 60 self.add_thing(JimPanel())
60 self.add_thing(StarField()) 61 self.add_thing(StarField())
61 self.add_thing(GenericDescThing('bridge.wires', 1, 62 self.add_thing(GenericDescThing('bridge.wires', 1,
62 "The brightly coloured wires contrast with the drab walls.", 63 _("The brightly coloured wires contrast with the drab walls."),
63 ((46, 4, 711, 143),))) 64 ((46, 4, 711, 143),)))
64 self.add_thing(GenericDescThing('bridge.note', 2, 65 self.add_thing(GenericDescThing('bridge.note', 2,
65 "\"Dammit JIM, I'm a doctor, not an engineer!\"", 66 _("\"Dammit JIM, I'm a doctor, not an engineer!\""),
66 ( 67 (
67 (491, 494, 194, 105), 68 (491, 494, 194, 105),
68 (422, 533, 71, 66), 69 (422, 533, 71, 66),
69 ))) 70 )))
70 self.doctor = GenericDescThing('bridge.skel', 3, 71 self.doctor = GenericDescThing('bridge.skel', 3,
71 "A skeleton hangs improbably from the wires.", 72 _("A skeleton hangs improbably from the wires."),
72 ( 73 (
73 (632, 148, 40, 29), 74 (632, 148, 40, 29),
74 (683, 176, 30, 101), 75 (683, 176, 30, 101),
75 (652, 274, 45, 96), 76 (652, 274, 45, 96),
76 (639, 180, 11, 95), 77 (639, 180, 11, 95),
111 112
112 def interact_without(self): 113 def interact_without(self):
113 return Result(detail_view='bridge_comp_detail') 114 return Result(detail_view='bridge_comp_detail')
114 115
115 def interact_with_titanium_leg(self, item): 116 def interact_with_titanium_leg(self, item):
116 return Result("You can't break the duraplastic screen.") 117 return Result(_("You can't break the duraplastic screen."))
117 118
118 def interact_with_machete(self, item): 119 def interact_with_machete(self, item):
119 return Result("Scratching the screen won't help you.") 120 return Result(_("Scratching the screen won't help you."))
120 121
121 def get_description(self): 122 def get_description(self):
122 return "The main bridge computer screen." 123 return _("The main bridge computer screen.")
123 124
124 125
125 class MassageChairBase(Thing): 126 class MassageChairBase(Thing):
126 "The captain's massage chair, contains superconductor" 127 "The captain's massage chair, contains superconductor"
127 128
140 def interact_without(self): 141 def interact_without(self):
141 return Result(detail_view='chair_detail') 142 return Result(detail_view='chair_detail')
142 143
143 def get_description(self): 144 def get_description(self):
144 if self.get_data('contains_superconductor'): 145 if self.get_data('contains_superconductor'):
145 return "A top of the line Massage-o-Matic Captain's Executive Command Chair. " \ 146 return _("A top of the line Massage-o-Matic Captain's Executive Command Chair. " \
146 "It's massaging a skeleton." 147 "It's massaging a skeleton.")
147 return "The chair won't work any more, it has no power." 148 return _("The chair won't work any more, it has no power.")
148 149
149 150
150 class MassageChair(Thing): 151 class MassageChair(Thing):
151 "The captain's massage chair, contains superconductor" 152 "The captain's massage chair, contains superconductor"
152 153
191 } 192 }
192 193
193 INITIAL = 'stethoscope' 194 INITIAL = 'stethoscope'
194 195
195 def get_description(self): 196 def get_description(self):
196 return "A stethoscope hangs from the neck of the skeleton." 197 return _("A stethoscope hangs from the neck of the skeleton.")
197 198
198 def interact_without(self): 199 def interact_without(self):
199 self.state.add_inventory_item('stethoscope') 200 self.state.add_inventory_item('stethoscope')
200 self.scene.remove_thing(self) 201 self.scene.remove_thing(self)
201 # Fill in the doctor's rect 202 # Fill in the doctor's rect
202 self.scene.doctor.rect.append(self.rect) 203 self.scene.doctor.rect.append(self.rect)
203 return Result("You pick up the stethoscope and verify that the doctor's " 204 return Result(_("You pick up the stethoscope and verify that the doctor's "
204 "heart has stopped. Probably a while ago.") 205 "heart has stopped. Probably a while ago."))
205 206
206 207
207 class TapedSuperconductor(Item): 208 class TapedSuperconductor(Item):
208 "Used for connecting high-powered parts of the ship up" 209 "Used for connecting high-powered parts of the ship up"
209 210
219 220
220 def interact_with_duct_tape(self, item): 221 def interact_with_duct_tape(self, item):
221 taped_superconductor = TapedSuperconductor('taped_superconductor') 222 taped_superconductor = TapedSuperconductor('taped_superconductor')
222 self.state.add_item(taped_superconductor) 223 self.state.add_item(taped_superconductor)
223 self.state.replace_inventory_item(self.name, taped_superconductor.name) 224 self.state.replace_inventory_item(self.name, taped_superconductor.name)
224 return Result("You rip off a piece of duct tape and stick it on the superconductor. " 225 return Result(_("You rip off a piece of duct tape and stick it on the superconductor. "
225 "It almost sticks to itself, but you successfully avoid disaster.") 226 "It almost sticks to itself, but you successfully avoid disaster."))
226 227
227 228
228 class SuperconductorThing(Thing): 229 class SuperconductorThing(Thing):
229 "Superconductor from the massage chair." 230 "Superconductor from the massage chair."
230 231
239 def interact_without(self): 240 def interact_without(self):
240 self.state.add_inventory_item('superconductor') 241 self.state.add_inventory_item('superconductor')
241 self.state.current_scene.things['bridge.massagechair_base'] \ 242 self.state.current_scene.things['bridge.massagechair_base'] \
242 .set_data('contains_superconductor', False) 243 .set_data('contains_superconductor', False)
243 self.scene.remove_thing(self) 244 self.scene.remove_thing(self)
244 return (Result("The superconductor module unclips easily."), 245 return (Result(_("The superconductor module unclips easily.")),
245 make_jim_dialog(("Prisoner %s. That chair you've destroyed was " 246 make_jim_dialog(_("Prisoner %s. That chair you've destroyed was "
246 "property of the ship's captain. " 247 "property of the ship's captain. "
247 "You will surely be punished." 248 "You will surely be punished."
248 ) % PLAYER_ID, self.state)) 249 ) % PLAYER_ID, self.state))
249 250
250 class StarField(Thing): 251 class StarField(Thing):
272 def is_interactive(self, tool=None): 273 def is_interactive(self, tool=None):
273 return False 274 return False
274 275
275 def leave(self): 276 def leave(self):
276 self.description = random.choice([ 277 self.description = random.choice([
277 "The lights flash in interesting patterns.", 278 _("The lights flash in interesting patterns."),
278 "The flashing lights don't mean anything to you.", 279 _("The flashing lights don't mean anything to you."),
279 "The console lights flash and flicker.", 280 _("The console lights flash and flicker."),
280 ]) 281 ])
281 282
282 def get_description(self): 283 def get_description(self):
283 if not self.description: 284 if not self.description:
284 self.leave() 285 self.leave()
317 318
318 INITIAL = 'closed' 319 INITIAL = 'closed'
319 320
320 def get_description(self): 321 def get_description(self):
321 if self.scene.get_data('ai panel') == 'closed': 322 if self.scene.get_data('ai panel') == 'closed':
322 return "The sign reads 'Warning: Authorized Techinicians Only'." 323 return _("The sign reads 'Warning: Authorized Techinicians Only'.")
323 324
324 def interact_without(self): 325 def interact_without(self):
325 if self.scene.get_data('ai status') == 'online': 326 if self.scene.get_data('ai status') == 'online':
326 return self.interact_default(None) 327 return self.interact_default(None)
327 elif self.scene.get_data('ai panel') == 'closed': 328 elif self.scene.get_data('ai panel') == 'closed':
328 return Result("You are unable to open the panel with your bare hands.") 329 return Result(_("You are unable to open the panel with your bare hands."))
329 elif self.scene.get_data('ai panel') == 'open': 330 elif self.scene.get_data('ai panel') == 'open':
330 self.scene.set_data('ai panel', 'broken') 331 self.scene.set_data('ai panel', 'broken')
331 self.scene.set_data('ai status', 'dead') 332 self.scene.set_data('ai status', 'dead')
332 self.set_interact('broken') 333 self.set_interact('broken')
333 return Result("You unplug various important-looking wires.") 334 return Result(_("You unplug various important-looking wires."))
334 335
335 336
336 def interact_with_machete(self, item): 337 def interact_with_machete(self, item):
337 if self.scene.get_data('ai status') == 'online': 338 if self.scene.get_data('ai status') == 'online':
338 return self.interact_default(item) 339 return self.interact_default(item)
339 elif self.scene.get_data('ai panel') == 'closed': 340 elif self.scene.get_data('ai panel') == 'closed':
340 self.scene.set_data('ai panel', 'open') 341 self.scene.set_data('ai panel', 'open')
341 self.set_interact('open') 342 self.set_interact('open')
342 return Result("Using the machete, you lever the panel off.") 343 return Result(_("Using the machete, you lever the panel off."))
343 elif self.scene.get_data('ai panel') == 'open': 344 elif self.scene.get_data('ai panel') == 'open':
344 self.scene.set_data('ai panel', 'broken') 345 self.scene.set_data('ai panel', 'broken')
345 self.scene.set_data('ai status', 'dead') 346 self.scene.set_data('ai status', 'dead')
346 self.set_interact('broken') 347 self.set_interact('broken')
347 return Result("You smash various delicate components with the machete.") 348 return Result(_("You smash various delicate components with the machete."))
348 349
349 def interact_default(self, item): 350 def interact_default(self, item):
350 if self.scene.get_data('ai status') == 'online': 351 if self.scene.get_data('ai status') == 'online':
351 return (Result('You feel a shock from the panel.'), 352 return (Result(_('You feel a shock from the panel.')),
352 make_jim_dialog("Prisoner %s. Please step away from the panel. " 353 make_jim_dialog(_("Prisoner %s. Please step away from the panel. "
353 "You are not an authorized technician." % PLAYER_ID, self.state)) 354 "You are not an authorized technician.") % PLAYER_ID, self.state))
354 355
355 class ChairDetail(Scene): 356 class ChairDetail(Scene):
356 357
357 FOLDER = 'bridge' 358 FOLDER = 'bridge'
358 BACKGROUND = 'chair_detail.png' 359 BACKGROUND = 'chair_detail.png'
445 def is_interactive(self, tool=None): 446 def is_interactive(self, tool=None):
446 return self.state.detail_views[self.COMPUTER].get_data('tab') == 'nav' 447 return self.state.detail_views[self.COMPUTER].get_data('tab') == 'nav'
447 448
448 def interact_without(self): 449 def interact_without(self):
449 if self.state.scenes['bridge'].get_data('ai status') == 'online': 450 if self.state.scenes['bridge'].get_data('ai status') == 'online':
450 return make_jim_dialog("You are not authorized to change the destination.", self.state) 451 return make_jim_dialog(_("You are not authorized to change the destination."), self.state)
451 if not self.ai_blocked: 452 if not self.ai_blocked:
452 return Result("There's no good reason to choose to go to the penal colony.") 453 return Result(_("There's no good reason to choose to go to the penal colony."))
453 if self.state.scenes['bridge'].get_data('ai status') == 'looping': 454 if self.state.scenes['bridge'].get_data('ai status') == 'looping':
454 return Result("You could change the destination, but when JIM recovers, it'll just get reset.") 455 return Result(_("You could change the destination, but when JIM recovers, it'll just get reset."))
455 if self.state.scenes['bridge'].get_data('ai status') == 'dead': 456 if self.state.scenes['bridge'].get_data('ai status') == 'dead':
456 return Result("You change the destination.", soundfile="beep550.ogg", end_game=True) 457 return Result(_("You change the destination."), soundfile="beep550.ogg", end_game=True)
457 458
458 class CompUpButton(Thing): 459 class CompUpButton(Thing):
459 """Up button on log screen""" 460 """Up button on log screen"""
460 461
461 NAME = 'bridge_comp.up_button' 462 NAME = 'bridge_comp.up_button'