comparison gamelib/scenes/bridge.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 b0bd36c2c840
comparison
equal deleted inserted replaced
764:a8510f4e2ea1 770:a35f5364437d
4 4
5 from pygame.colordict import THECOLORS 5 from pygame.colordict import THECOLORS
6 from pygame.color import Color 6 from pygame.color import Color
7 from pygame.rect import Rect 7 from pygame.rect import Rect
8 8
9 from pyntnclick.i18n import _
9 from pyntnclick.cursor import CursorSprite 10 from pyntnclick.cursor import CursorSprite
10 from pyntnclick.state import Scene, Item, Thing, Result 11 from pyntnclick.state import Scene, Item, Thing, Result
11 from pyntnclick.scenewidgets import ( 12 from pyntnclick.scenewidgets import (
12 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated, 13 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated,
13 GenericDescThing, TakeableThing) 14 GenericDescThing, TakeableThing)
52 self.add_thing(LeftLights()) 53 self.add_thing(LeftLights())
53 self.add_thing(RightLights()) 54 self.add_thing(RightLights())
54 self.add_thing(JimPanel()) 55 self.add_thing(JimPanel())
55 self.add_thing(StarField()) 56 self.add_thing(StarField())
56 self.add_thing(GenericDescThing('bridge.wires', 1, 57 self.add_thing(GenericDescThing('bridge.wires', 1,
57 "The brightly coloured wires contrast with the drab walls.", 58 _("The brightly coloured wires contrast with the drab walls."),
58 ((46, 4, 711, 143),))) 59 ((46, 4, 711, 143),)))
59 self.add_thing(GenericDescThing('bridge.note', 2, 60 self.add_thing(GenericDescThing('bridge.note', 2,
60 "\"Dammit JIM, I'm a doctor, not an engineer!\"", 61 _("\"Dammit JIM, I'm a doctor, not an engineer!\""),
61 ( 62 (
62 (491, 494, 194, 105), 63 (491, 494, 194, 105),
63 (422, 533, 71, 66), 64 (422, 533, 71, 66),
64 ))) 65 )))
65 self.doctor = GenericDescThing('bridge.skel', 3, 66 self.doctor = GenericDescThing('bridge.skel', 3,
66 "A skeleton hangs improbably from the wires.", 67 _("A skeleton hangs improbably from the wires."),
67 ( 68 (
68 (632, 148, 40, 29), 69 (632, 148, 40, 29),
69 (683, 176, 30, 101), 70 (683, 176, 30, 101),
70 (652, 274, 45, 96), 71 (652, 274, 45, 96),
71 (639, 180, 11, 95), 72 (639, 180, 11, 95),
106 107
107 def interact_without(self): 108 def interact_without(self):
108 return Result(detail_view='bridge_comp_detail') 109 return Result(detail_view='bridge_comp_detail')
109 110
110 def interact_with_titanium_leg(self, item): 111 def interact_with_titanium_leg(self, item):
111 return Result("You can't break the duraplastic screen.") 112 return Result(_("You can't break the duraplastic screen."))
112 113
113 def interact_with_machete(self, item): 114 def interact_with_machete(self, item):
114 return Result("Scratching the screen won't help you.") 115 return Result(_("Scratching the screen won't help you."))
115 116
116 def get_description(self): 117 def get_description(self):
117 return "The main bridge computer screen." 118 return _("The main bridge computer screen.")
118 119
119 120
120 class MassageChairBase(Thing): 121 class MassageChairBase(Thing):
121 "The captain's massage chair, contains superconductor" 122 "The captain's massage chair, contains superconductor"
122 123
135 def interact_without(self): 136 def interact_without(self):
136 return Result(detail_view='chair_detail') 137 return Result(detail_view='chair_detail')
137 138
138 def get_description(self): 139 def get_description(self):
139 if self.get_data('contains_superconductor'): 140 if self.get_data('contains_superconductor'):
140 return ("A top of the line Massage-o-Matic Captain's Executive" 141 return _("A top of the line Massage-o-Matic Captain's Executive"
141 " Command Chair. It's massaging a skeleton.") 142 " Command Chair. It's massaging a skeleton.")
142 return "The chair won't work any more, it has no power." 143 return _("The chair won't work any more, it has no power.")
143 144
144 145
145 class MassageChair(Thing): 146 class MassageChair(Thing):
146 "The captain's massage chair, contains superconductor" 147 "The captain's massage chair, contains superconductor"
147 148
187 188
188 INITIAL = 'stethoscope' 189 INITIAL = 'stethoscope'
189 ITEM = 'stethoscope' 190 ITEM = 'stethoscope'
190 191
191 def get_description(self): 192 def get_description(self):
192 return "A stethoscope hangs from the neck of the skeleton." 193 return _("A stethoscope hangs from the neck of the skeleton.")
193 194
194 def interact_without(self): 195 def interact_without(self):
195 self.take() 196 self.take()
196 # Fill in the doctor's rect 197 # Fill in the doctor's rect
197 self.scene.doctor.rect.append(self.rect) 198 self.scene.doctor.rect.append(self.rect)
198 return Result("You pick up the stethoscope and verify that the" 199 return Result(_("You pick up the stethoscope and verify that the"
199 " doctor's heart has stopped. Probably a while ago.") 200 " doctor's heart has stopped. Probably a while ago."))
200 201
201 202
202 class TapedSuperconductor(Item): 203 class TapedSuperconductor(Item):
203 "Used for connecting high-powered parts of the ship up" 204 "Used for connecting high-powered parts of the ship up"
204 205
214 215
215 def interact_with_duct_tape(self, item): 216 def interact_with_duct_tape(self, item):
216 taped_superconductor = TapedSuperconductor('taped_superconductor') 217 taped_superconductor = TapedSuperconductor('taped_superconductor')
217 self.game.add_item(taped_superconductor) 218 self.game.add_item(taped_superconductor)
218 self.game.replace_inventory_item(self.name, taped_superconductor.name) 219 self.game.replace_inventory_item(self.name, taped_superconductor.name)
219 return Result("You rip off a piece of duct tape and stick it on the" 220 return Result(_("You rip off a piece of duct tape and stick it on the"
220 " superconductor. It almost sticks to itself, but you" 221 " superconductor. It almost sticks to itself, but you"
221 " successfully avoid disaster.") 222 " successfully avoid disaster."))
222 223
223 224
224 class SuperconductorThing(TakeableThing): 225 class SuperconductorThing(TakeableThing):
225 "Superconductor from the massage chair." 226 "Superconductor from the massage chair."
226 227
235 236
236 def interact_without(self): 237 def interact_without(self):
237 self.game.scenes['bridge'].things['bridge.massagechair_base'] \ 238 self.game.scenes['bridge'].things['bridge.massagechair_base'] \
238 .set_data('contains_superconductor', False) 239 .set_data('contains_superconductor', False)
239 self.take() 240 self.take()
240 return (Result("The superconductor module unclips easily."), 241 return (Result(_("The superconductor module unclips easily.")),
241 make_jim_dialog(("Prisoner %s. That chair you've destroyed" 242 make_jim_dialog(_("Prisoner %s. That chair you've destroyed"
242 " was property of the ship's captain. " 243 " was property of the ship's captain. "
243 "You will surely be punished." 244 "You will surely be punished.")
244 % PLAYER_ID), self.game)) 245 % PLAYER_ID, self.game))
245 246
246 247
247 class StarField(Thing): 248 class StarField(Thing):
248 249
249 NAME = 'bridge.stars' 250 NAME = 'bridge.stars'
269 def is_interactive(self, tool=None): 270 def is_interactive(self, tool=None):
270 return False 271 return False
271 272
272 def leave(self): 273 def leave(self):
273 self.description = random.choice([ 274 self.description = random.choice([
274 "The lights flash in interesting patterns.", 275 _("The lights flash in interesting patterns."),
275 "The flashing lights don't mean anything to you.", 276 _("The flashing lights don't mean anything to you."),
276 "The console lights flash and flicker.", 277 _("The console lights flash and flicker."),
277 ]) 278 ])
278 279
279 def get_description(self): 280 def get_description(self):
280 if not self.description: 281 if not self.description:
281 self.leave() 282 self.leave()
325 326
326 INITIAL = 'closed' 327 INITIAL = 'closed'
327 328
328 def get_description(self): 329 def get_description(self):
329 if self.scene.get_data('ai panel') == 'closed': 330 if self.scene.get_data('ai panel') == 'closed':
330 return "The sign reads 'Warning: Authorized Techinicians Only'." 331 return _("The sign reads 'Warning: Authorized Techinicians Only'.")
331 332
332 def select_interact(self): 333 def select_interact(self):
333 status = self.get_data('ai panel') 334 status = self.get_data('ai panel')
334 return status or self.INITIAL 335 return status or self.INITIAL
335 336
336 def interact_without(self): 337 def interact_without(self):
337 ai_status = self.state.get_jim_state() 338 ai_status = self.state.get_jim_state()
338 if ai_status == 'online': 339 if ai_status == 'online':
339 return self.interact_default(None) 340 return self.interact_default(None)
340 elif self.scene.get_data('ai panel') == 'closed': 341 elif self.scene.get_data('ai panel') == 'closed':
341 return Result("You are unable to open the panel with your" 342 return Result(_("You are unable to open the panel with your"
342 " bare hands.") 343 " bare hands."))
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.state.break_ai() 346 self.state.break_ai()
346 self.set_interact() 347 self.set_interact()
347 return Result("You unplug various important-looking wires.") 348 return Result(_("You unplug various important-looking wires."))
348 349
349 def interact_with_machete(self, item): 350 def interact_with_machete(self, item):
350 ai_status = self.state.get_jim_state() 351 ai_status = self.state.get_jim_state()
351 if ai_status == 'online': 352 if ai_status == 'online':
352 return self.interact_default(item) 353 return self.interact_default(item)
353 elif self.scene.get_data('ai panel') == 'closed': 354 elif self.scene.get_data('ai panel') == 'closed':
354 self.scene.set_data('ai panel', 'open') 355 self.scene.set_data('ai panel', 'open')
355 self.set_interact() 356 self.set_interact()
356 return Result("Using the machete, you lever the panel off.") 357 return Result(_("Using the machete, you lever the panel off."))
357 elif self.scene.get_data('ai panel') == 'open': 358 elif self.scene.get_data('ai panel') == 'open':
358 self.scene.set_data('ai panel', 'broken') 359 self.scene.set_data('ai panel', 'broken')
359 self.state.break_ai() 360 self.state.break_ai()
360 self.set_interact() 361 self.set_interact()
361 return Result("You smash various delicate components with" 362 return Result(_("You smash various delicate components with"
362 " the machete.") 363 " the machete."))
363 364
364 def interact_default(self, item): 365 def interact_default(self, item):
365 if self.state.get_jim_state() == 'online': 366 if self.state.get_jim_state() == 'online':
366 return (Result('You feel a shock from the panel.'), 367 return (Result(_('You feel a shock from the panel.')),
367 make_jim_dialog("Prisoner %s. Please step away from the" 368 make_jim_dialog(_("Prisoner %s. Please step away from the"
368 " panel. You are not an authorized" 369 " panel. You are not an authorized"
369 " technician." % PLAYER_ID, self.game)) 370 " technician.") % PLAYER_ID, self.game))
370 371
371 372
372 class ChairDetail(Scene): 373 class ChairDetail(Scene):
373 374
374 FOLDER = 'bridge' 375 FOLDER = 'bridge'
465 def is_interactive(self, tool=None): 466 def is_interactive(self, tool=None):
466 return self.game.detail_views[self.COMPUTER].get_data('tab') == 'nav' 467 return self.game.detail_views[self.COMPUTER].get_data('tab') == 'nav'
467 468
468 def interact_without(self): 469 def interact_without(self):
469 if self.game.scenes['bridge'].get_data('ai status') == 'online': 470 if self.game.scenes['bridge'].get_data('ai status') == 'online':
470 return make_jim_dialog("You are not authorized to change the" 471 return make_jim_dialog(_("You are not authorized to change the"
471 " destination.", self.game) 472 " destination."), self.game)
472 if not self.ai_blocked: 473 if not self.ai_blocked:
473 return Result("There's no good reason to choose to go to the" 474 return Result(_("There's no good reason to choose to go to the"
474 " penal colony.") 475 " penal colony."))
475 if self.game.scenes['bridge'].get_data('ai status') == 'looping': 476 if self.game.scenes['bridge'].get_data('ai status') == 'looping':
476 return Result("You could change the destination, but when JIM" 477 return Result(_("You could change the destination, but when JIM"
477 " recovers, it'll just get reset.") 478 " recovers, it'll just get reset."))
478 if self.game.scenes['bridge'].get_data('ai status') == 'dead': 479 if self.game.scenes['bridge'].get_data('ai status') == 'dead':
479 return Result("You change the destination.", 480 return Result(_("You change the destination."),
480 soundfile="beep550.ogg", end_game=True) 481 soundfile="beep550.ogg", end_game=True)
481 482
482 483
483 class CompUpButton(Thing): 484 class CompUpButton(Thing):
484 """Up button on log screen""" 485 """Up button on log screen"""