comparison gamelib/scenes/engine.py @ 769:43b49f1de828 pyntnclick-i18n

Merge i18n for before the pyntnclick split
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 26 Jan 2013 16:57:33 +0200
parents 386475464202 2f1952748cdb
children a35f5364437d
comparison
equal deleted inserted replaced
763:afe7b1cb16c0 769:43b49f1de828
1 """Engine room where things need to be repaired.""" 1 """Engine room where things need to be repaired."""
2 2
3 from pyntnclick.i18n import _
3 from pyntnclick.cursor import CursorSprite 4 from pyntnclick.cursor import CursorSprite
4 from pyntnclick.state import Scene, Item, Thing, Result 5 from pyntnclick.state import Scene, Item, Thing, Result
5 from pyntnclick.scenewidgets import (InteractNoImage, InteractRectUnion, 6 from pyntnclick.scenewidgets import (InteractNoImage, InteractRectUnion,
6 InteractImage, InteractAnimated, 7 InteractImage, InteractAnimated,
7 GenericDescThing) 8 GenericDescThing)
35 self.add_thing(Stars()) 36 self.add_thing(Stars())
36 self.add_thing(CrackedPipe()) 37 self.add_thing(CrackedPipe())
37 self.add_thing(ComputerConsole()) 38 self.add_thing(ComputerConsole())
38 self.add_thing(ToMap()) 39 self.add_thing(ToMap())
39 self.add_thing(GenericDescThing('engine.body', 1, 40 self.add_thing(GenericDescThing('engine.body', 1,
40 "Dead. Those cans must have been past their sell-by date.", 41 _("Dead. Those cans must have been past their sell-by date."),
41 ( 42 (
42 (594, 387, 45, 109), 43 (594, 387, 45, 109),
43 (549, 479, 60, 55), 44 (549, 479, 60, 55),
44 ) 45 )
45 )) 46 ))
46 self.add_thing(GenericDescThing('engine.superconductors', 4, 47 self.add_thing(GenericDescThing('engine.superconductors', 4,
47 "Superconductors. The engines must be power hogs.", 48 _("Superconductors. The engines must be power hogs."),
48 ( 49 (
49 (679, 246, 50, 56), 50 (679, 246, 50, 56),
50 (473, 280, 28, 23), 51 (473, 280, 28, 23),
51 (381, 224, 25, 22), 52 (381, 224, 25, 22),
52 ) 53 )
53 )) 54 ))
54 self.add_thing(GenericDescThing('engine.floor_hole', 5, 55 self.add_thing(GenericDescThing('engine.floor_hole', 5,
55 "A gaping hole in the floor of the room. " 56 _("A gaping hole in the floor of the room. "
56 "It is clearly irreparable.", 57 "It is clearly irreparable."),
57 ( 58 (
58 (257, 493, 141, 55), 59 (257, 493, 141, 55),
59 (301, 450, 95, 45), 60 (301, 450, 95, 45),
60 (377, 422, 19, 29), 61 (377, 422, 19, 29),
61 (239, 547, 123, 39), 62 (239, 547, 123, 39),
62 ) 63 )
63 )) 64 ))
64 self.add_thing(GenericDescThing('engine.empty_cans', 7, 65 self.add_thing(GenericDescThing('engine.empty_cans', 7,
65 "Empty chocolate-covered bacon cans? Poor guy, he must have" 66 _("Empty chocolate-covered bacon cans? Poor guy, he must have"
66 " found them irresistible.", 67 " found them irresistible."),
67 ( 68 (
68 (562, 422, 30, 31), 69 (562, 422, 30, 31),
69 ) 70 )
70 )) 71 ))
71 self.add_thing(GenericDescThing('engine.engines', 8, 72 self.add_thing(GenericDescThing('engine.engines', 8,
72 "The engines. They don't look like they are working.", 73 _("The engines. They don't look like they are working."),
73 ( 74 (
74 (342, 261, 109, 81), 75 (342, 261, 109, 81),
75 ) 76 )
76 )) 77 ))
77 self.add_thing(GenericDescThing('engine.laser_cutter', 9, 78 self.add_thing(GenericDescThing('engine.laser_cutter', 9,
78 "A burned-out laser cutter. It may be responsible for the" 79 _("A burned-out laser cutter. It may be responsible for the"
79 " hole in the floor.", 80 " hole in the floor."),
80 ( 81 (
81 (120, 466, 115, 67), 82 (120, 466, 115, 67),
82 ) 83 )
83 )) 84 ))
84 self.add_thing(GenericDescThing('engine.fuel_lines', 10, 85 self.add_thing(GenericDescThing('engine.fuel_lines', 10,
85 "The main fuel line for the engines.", 86 _("The main fuel line for the engines."),
86 ( 87 (
87 (220, 49, 59, 75), 88 (220, 49, 59, 75),
88 (239, 84, 51, 66), 89 (239, 84, 51, 66),
89 (271, 113, 28, 53), 90 (271, 113, 28, 53),
90 (285, 132, 26, 50), 91 (285, 132, 26, 50),
100 (438, 217, 30, 11), 101 (438, 217, 30, 11),
101 (435, 225, 18, 15), 102 (435, 225, 18, 15),
102 ) 103 )
103 )) 104 ))
104 self.add_thing(GenericDescThing('engine.spare_fuel_line', 11, 105 self.add_thing(GenericDescThing('engine.spare_fuel_line', 11,
105 "The spare fuel line. If something went wrong with the main" 106 _("The spare fuel line. If something went wrong with the main"
106 " one, you would hook that one up.", 107 " one, you would hook that one up."),
107 ( 108 (
108 (512, 49, 68, 44), 109 (512, 49, 68, 44),
109 ) 110 )
110 )) 111 ))
111 self.add_thing(GenericDescThing('engine.danger_area', 12, 112 self.add_thing(GenericDescThing('engine.danger_area', 12,
112 "The sign says DANGER. You would be wise to listen to it.", 113 _("The sign says DANGER. You would be wise to listen to it."),
113 ( 114 (
114 (293, 343, 211, 46), 115 (293, 343, 211, 46),
115 ) 116 )
116 )) 117 ))
117 self.add_thing(GenericDescThing('engine.exit_sign', 13, 118 self.add_thing(GenericDescThing('engine.exit_sign', 13,
118 "It's one of those glow-in-the-dark signs needed to satisfy the " 119 _("It's one of those glow-in-the-dark signs needed to satisfy the "
119 "health and safety inspectors.", 120 "health and safety inspectors."),
120 ( 121 (
121 (681, 322, 80, 33), 122 (681, 322, 80, 33),
122 ) 123 )
123 )) 124 ))
124 125
126 if (self.things['engine.cryo_containers'].get_data('filled') 127 if (self.things['engine.cryo_containers'].get_data('filled')
127 and self.things['engine.superconductor'].get_data('working')): 128 and self.things['engine.superconductor'].get_data('working')):
128 self.set_data('engine online', True) 129 self.set_data('engine online', True)
129 self.remove_thing(self.things['engine.engines.8']) 130 self.remove_thing(self.things['engine.engines.8'])
130 self.add_thing(Engines()) 131 self.add_thing(Engines())
131 return make_jim_dialog("The engines are now operational. You have" 132 return make_jim_dialog(_("The engines are now operational. You"
132 "done a satisfactory job, Prisoner %s." 133 " have done a satisfactory job, Prisoner"
133 % PLAYER_ID, 134 " %s.") % PLAYER_ID, self.game)
134 self.game)
135 135
136 def enter(self): 136 def enter(self):
137 if self.get_data('greet'): 137 if self.get_data('greet'):
138 self.set_data('greet', False) 138 self.set_data('greet', False)
139 return Result( 139 return Result(
140 "With your improvised helmet, the automatic airlock allows" 140 _("With your improvised helmet, the automatic airlock"
141 " you into the engine room. Even if there wasn't a vacuum " 141 " allows you into the engine room. Even if there wasn't"
142 "it would be eerily quiet.") 142 " a vacuum it would be eerily quiet."))
143 143
144 144
145 class Engines(Thing): 145 class Engines(Thing):
146 NAME = 'engine.engines' 146 NAME = 'engine.engines'
147 147
153 153
154 def is_interactive(self, tool=None): 154 def is_interactive(self, tool=None):
155 return False 155 return False
156 156
157 def get_description(self): 157 def get_description(self):
158 return "All systems are go! Or at least the engines are." 158 return _("All systems are go! Or at least the engines are.")
159 159
160 160
161 class CanOpener(Item): 161 class CanOpener(Item):
162 INVENTORY_IMAGE = 'can_opener.png' 162 INVENTORY_IMAGE = 'can_opener.png'
163 CURSOR = CursorSprite('can_opener_cursor.png') 163 CURSOR = CursorSprite('can_opener_cursor.png')
171 } 171 }
172 172
173 INITIAL = 'canopener' 173 INITIAL = 'canopener'
174 174
175 def get_description(self): 175 def get_description(self):
176 return "A can opener. Looks like you won't be starving" 176 return _("A can opener. Looks like you won't be starving")
177 177
178 def interact_without(self): 178 def interact_without(self):
179 self.game.add_inventory_item('canopener') 179 self.game.add_inventory_item('canopener')
180 self.scene.remove_thing(self) 180 self.scene.remove_thing(self)
181 return Result("You pick up the can opener. It looks brand new; " 181 return Result(_("You pick up the can opener. It looks brand new; "
182 "the vacuum has kept it in perfect condition.") 182 "the vacuum has kept it in perfect condition."))
183 183
184 184
185 class SuperconductorSocket(Thing): 185 class SuperconductorSocket(Thing):
186 NAME = 'engine.superconductor' 186 NAME = 'engine.superconductor'
187 187
198 'working': False, 198 'working': False,
199 } 199 }
200 200
201 def get_description(self): 201 def get_description(self):
202 if self.get_data('present') and not self.get_data('working'): 202 if self.get_data('present') and not self.get_data('working'):
203 return ("That superconductor looks burned out. It's wedged" 203 return _("That superconductor looks burned out. It's wedged"
204 " in there pretty firmly.") 204 " in there pretty firmly.")
205 elif not self.get_data('present'): 205 elif not self.get_data('present'):
206 return "An empty superconductor socket" 206 return _("An empty superconductor socket")
207 else: 207 else:
208 return "A working superconductor." 208 return _("A working superconductor.")
209 209
210 def select_interact(self): 210 def select_interact(self):
211 if not self.get_data('present'): 211 if not self.get_data('present'):
212 return 'removed' 212 return 'removed'
213 if self.get_data('working'): 213 if self.get_data('working'):
214 return 'fixed' 214 return 'fixed'
215 return self.INITIAL 215 return self.INITIAL
216 216
217 def interact_without(self): 217 def interact_without(self):
218 if self.get_data('present') and not self.get_data('working'): 218 if self.get_data('present') and not self.get_data('working'):
219 return Result("It's wedged in there pretty firmly, it won't" 219 return Result(_("It's wedged in there pretty firmly, it won't"
220 " come out.") 220 " come out."))
221 elif self.get_data('working'): 221 elif self.get_data('working'):
222 return Result("You decide that working engines are more important" 222 return Result(_("You decide that working engines are more "
223 " than having a shiny superconductor.") 223 " important than having a shiny superconductor."))
224 224
225 def interact_with_machete(self, item): 225 def interact_with_machete(self, item):
226 if self.get_data('present') and not self.get_data('working'): 226 if self.get_data('present') and not self.get_data('working'):
227 self.set_data('present', False) 227 self.set_data('present', False)
228 self.set_interact() 228 self.set_interact()
229 return Result("With leverage, the burned-out superconductor" 229 return Result(_("With leverage, the burned-out superconductor"
230 " snaps out. You discard it.") 230 " snaps out. You discard it."))
231 231
232 def interact_with_superconductor(self, item): 232 def interact_with_superconductor(self, item):
233 if self.get_data('present'): 233 if self.get_data('present'):
234 return Result("It might help to remove the broken" 234 return Result(_("It might help to remove the broken"
235 " superconductor first") 235 " superconductor first"))
236 else: 236 else:
237 return Result("You plug in the superconductor, and feel a hum " 237 return Result(_("You plug in the superconductor, and feel a hum "
238 "as things kick into life. " 238 "as things kick into life. Unfortunately, it's "
239 "Unfortunately, it's the wrong size for the socket " 239 "the wrong size for the socket and just falls "
240 "and just falls out again when you let go.") 240 "out again when you let go."))
241 241
242 def interact_with_taped_superconductor(self, item): 242 def interact_with_taped_superconductor(self, item):
243 if not self.get_data('present'): 243 if not self.get_data('present'):
244 self.set_data('present', True) 244 self.set_data('present', True)
245 self.set_data('working', True) 245 self.set_data('working', True)
246 self.set_interact() 246 self.set_interact()
247 self.game.remove_inventory_item(item.name) 247 self.game.remove_inventory_item(item.name)
248 results = [Result("The chair's superconductor looks over-specced " 248 results = [Result(_("The chair's superconductor looks over-specced"
249 "for this job, but it should work.")] 249 " for this job, but it should work."))]
250 results.append(self.scene.engine_online_check()) 250 results.append(self.scene.engine_online_check())
251 return results 251 return results
252 else: 252 else:
253 return Result("It might help to remove the broken superconductor" 253 return Result(_("It might help to remove the broken superconductor"
254 " first.") 254 " first."))
255 255
256 256
257 class CryoContainers(Thing): 257 class CryoContainers(Thing):
258 NAME = 'engine.cryo_containers' 258 NAME = 'engine.cryo_containers'
259 259
273 return 'full' 273 return 'full'
274 return self.INITIAL 274 return self.INITIAL
275 275
276 def get_description(self): 276 def get_description(self):
277 if not self.get_data('filled'): 277 if not self.get_data('filled'):
278 return "Those are coolant reservoirs. They look empty." 278 return _("Those are coolant reservoirs. They look empty.")
279 return "The coolant reservoirs are full." 279 return _("The coolant reservoirs are full.")
280 280
281 def is_interactive(self, tool=None): 281 def is_interactive(self, tool=None):
282 return False 282 return False
283 283
284 284
294 } 294 }
295 295
296 INITIAL = 'containers' 296 INITIAL = 'containers'
297 297
298 def get_description(self): 298 def get_description(self):
299 return "The receptacles for the coolant reservoirs." 299 return _("The receptacles for the coolant reservoirs.")
300 300
301 def interact_without(self): 301 def interact_without(self):
302 return Result("You stick your finger in the receptacle. " 302 return Result(_("You stick your finger in the receptacle. "
303 "It almost gets stuck.") 303 "It almost gets stuck."))
304 304
305 def interact_with_full_detergent_bottle(self, item): 305 def interact_with_full_detergent_bottle(self, item):
306 if not self.scene.things['engine.cracked_pipe'].get_data('fixed'): 306 if not self.scene.things['engine.cracked_pipe'].get_data('fixed'):
307 return Result("Pouring the precious cryo fluid into a" 307 return Result(_("Pouring the precious cryo fluid into a"
308 " container connected to a cracked pipe would be a waste.") 308 " container connected to a cracked pipe would be a"
309 " waste."))
309 self.game.remove_inventory_item(item.name) 310 self.game.remove_inventory_item(item.name)
310 self.scene.things['engine.cryo_containers'].set_data('filled', True) 311 self.scene.things['engine.cryo_containers'].set_data('filled', True)
311 self.scene.things['engine.cryo_containers'].set_interact() 312 self.scene.things['engine.cryo_containers'].set_interact()
312 results = [Result("You fill the reservoirs. " 313 results = [Result(_("You fill the reservoirs. "
313 "The detergent bottle was just big enough, which " 314 "The detergent bottle was just big enough, which "
314 "is handy, because it's sprung a leak.")] 315 "is handy, because it's sprung a leak."))]
315 results.append(self.scene.engine_online_check()) 316 results.append(self.scene.engine_online_check())
316 return results 317 return results
317 318
318 319
319 class CoolingPipes(Thing): 320 class CoolingPipes(Thing):
355 } 356 }
356 INITIAL = 'pipes' 357 INITIAL = 'pipes'
357 358
358 def get_description(self): 359 def get_description(self):
359 if not self.scene.things['engine.cryo_containers'].get_data('filled'): 360 if not self.scene.things['engine.cryo_containers'].get_data('filled'):
360 return "These pipes carry coolant to the superconductors. " \ 361 return _("These pipes carry coolant to the superconductors. "
361 "They feel warm." 362 "They feel warm.")
362 return "These pipes carry coolant to the superconductors. " \ 363 return _("These pipes carry coolant to the superconductors. "
363 "They are very cold." 364 "They are very cold.")
364 365
365 def is_interactive(self, tool=None): 366 def is_interactive(self, tool=None):
366 return False 367 return False
367 368
368 369
383 384
384 INITIAL = 'lines' 385 INITIAL = 'lines'
385 386
386 def get_description(self): 387 def get_description(self):
387 if self.scene.things['engine.superconductor'].get_data('working'): 388 if self.scene.things['engine.superconductor'].get_data('working'):
388 return "Power lines. They are delivering power to the engines." 389 return _("Power lines. They are delivering power to the engines.")
389 return "Power lines. It looks like they aren't working correctly." 390 return _("Power lines. It looks like they aren't working correctly.")
390 391
391 def is_interactive(self, tool=None): 392 def is_interactive(self, tool=None):
392 return False 393 return False
393 394
394 395
474 475
475 def is_interactive(self, tool=None): 476 def is_interactive(self, tool=None):
476 return False 477 return False
477 478
478 def get_description(self): 479 def get_description(self):
479 return "A gaping hole in the floor of the room. You're guessing" \ 480 return _("A gaping hole in the floor of the room. You're guessing"
480 " that's why there's a vacuum in here." 481 " that's why there's a vacuum in here.")
481 482
482 483
483 class CrackedPipe(Thing): 484 class CrackedPipe(Thing):
484 NAME = "engine.cracked_pipe" 485 NAME = "engine.cracked_pipe"
485 486
494 'fixed': False, 495 'fixed': False,
495 } 496 }
496 497
497 def get_description(self): 498 def get_description(self):
498 if self.get_data('fixed'): 499 if self.get_data('fixed'):
499 return "The duct tape appears to be holding." 500 return _("The duct tape appears to be holding.")
500 else: 501 else:
501 return "The pipe looks cracked and won't hold" \ 502 return _("The pipe looks cracked and won't hold"
502 " fluid until it's fixed." 503 " fluid until it's fixed.")
503 504
504 def select_interact(self): 505 def select_interact(self):
505 if self.get_data('fixed'): 506 if self.get_data('fixed'):
506 return 'taped' 507 return 'taped'
507 return self.INITIAL 508 return self.INITIAL
508 509
509 def interact_with_duct_tape(self, item): 510 def interact_with_duct_tape(self, item):
510 if self.get_data('fixed'): 511 if self.get_data('fixed'):
511 return Result("The duct tape already there appears to be " 512 return Result(_("The duct tape already there appears to be "
512 "sufficient.") 513 "sufficient."))
513 else: 514 else:
514 self.set_data('fixed', True) 515 self.set_data('fixed', True)
515 self.set_interact() 516 self.set_interact()
516 return Result("You apply your trusty duct tape to the " 517 return Result(_("You apply your trusty duct tape to the "
517 "creak, sealing it.") 518 "creak, sealing it."))
518 519
519 520
520 class ComputerConsole(Thing): 521 class ComputerConsole(Thing):
521 NAME = "engine.computer_console" 522 NAME = "engine.computer_console"
522 523
531 532
532 def interact_without(self): 533 def interact_without(self):
533 return Result(detail_view='engine_comp_detail') 534 return Result(detail_view='engine_comp_detail')
534 535
535 def get_description(self): 536 def get_description(self):
536 return "A computer console. It's alarmingly close to the engine." 537 return _("A computer console. It's alarmingly close to the engine.")
537 538
538 539
539 class EngineCompDetail(Scene): 540 class EngineCompDetail(Scene):
540 541
541 FOLDER = "engine" 542 FOLDER = "engine"
587 } 588 }
588 589
589 INITIAL = "door" 590 INITIAL = "door"
590 591
591 def get_description(self): 592 def get_description(self):
592 return "The airlock leads back to the rest of the ship." 593 return _("The airlock leads back to the rest of the ship.")
593 594
594 595
595 SCENES = [Engine] 596 SCENES = [Engine]
596 DETAIL_VIEWS = [EngineCompDetail] 597 DETAIL_VIEWS = [EngineCompDetail]