comparison gamelib/scenes/cryo.py @ 852:f95830b58336

Merge pyntnclick
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 21 Jun 2014 22:04:35 +0200
parents bdebe693453f
children
comparison
equal deleted inserted replaced
546:ad4d6ffd25d7 852:f95830b58336
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 albow.music import change_playlist, get_music, PlayList 5 from pyntnclick.i18n import _
6 from albow.resource import get_image 6 from pyntnclick.utils import render_text
7 7 from pyntnclick.cursor import CursorSprite
8 from gamelib.cursor import CursorSprite 8 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result
9 from gamelib.state import Scene, Item, CloneableItem, Thing, Result 9 from pyntnclick.scenewidgets import (
10 from gamelib.scenewidgets import (InteractNoImage, InteractRectUnion, 10 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated,
11 InteractImage, InteractAnimated, 11 GenericDescThing, TakeableThing)
12 GenericDescThing)
13 12
14 from gamelib.scenes.game_constants import PLAYER_ID 13 from gamelib.scenes.game_constants import PLAYER_ID
15 from gamelib.scenes.game_widgets import Door, make_jim_dialog 14 from gamelib.scenes.game_widgets import Door, make_jim_dialog
16 15
17 16
21 BACKGROUND = "cryo_room.png" 20 BACKGROUND = "cryo_room.png"
22 21
23 INITIAL_DATA = { 22 INITIAL_DATA = {
24 'greet': True, 23 'greet': True,
25 'vandalism_warn': True, 24 'vandalism_warn': True,
25 'sentence': 30,
26 } 26 }
27 27
28 # sounds that will be played randomly as background noise 28 # sounds that will be played randomly as background noise
29 MUSIC = [ 29 MUSIC = [
30 'drip1.ogg', 30 'drip1.ogg',
33 'creaking.ogg', 33 'creaking.ogg',
34 'silent.ogg', 34 'silent.ogg',
35 'silent.ogg', 35 'silent.ogg',
36 ] 36 ]
37 37
38 def __init__(self, state): 38 def setup(self):
39 super(Cryo, self).__init__(state) 39 self.add_item_factory(TitaniumLeg)
40 self.add_item(TitaniumLeg("titanium_leg")) 40 self.add_item_factory(TubeFragment)
41 self.add_item_factory(FullBottle)
41 self.add_thing(CryoUnitAlpha()) 42 self.add_thing(CryoUnitAlpha())
42 self.add_thing(CryoRoomDoor()) 43 self.add_thing(CryoRoomDoor())
43 self.add_thing(CryoComputer()) 44 self.add_thing(CryoComputer())
44 self.add_thing(CryoPipeLeft()) 45 self.add_thing(CryoPipeLeft())
45 self.add_thing(CryoPipeRightTop()) 46 self.add_thing(CryoPipeRightTop())
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" 74 _("A working cryo chamber. The frosted glass obscures the details"
74 " of the occupant.", 75 " of the occupant."),
75 "Prisoner 9334-CE1EB0243BAB. Murder. 40 years.", 76 _("Prisoner 9334-CE1EB0243BAB. Murder. 40 years."),
76 ( 77 (
77 (215, 430, 50, 35), 78 (215, 430, 50, 35),
78 (205, 450, 50, 35), 79 (205, 450, 50, 35),
79 (185, 470, 50, 35), 80 (185, 470, 50, 35),
80 (125, 505, 80, 40), 81 (125, 505, 80, 40),
81 ))) 82 )))
82 83
83 self.add_thing(GenericCryoUnit(4, 84 self.add_thing(GenericCryoUnit(4,
84 "A broken cryo chamber. The skeleton inside has been picked" 85 _("A broken cryo chamber. The skeleton inside has been picked"
85 " clean.", 86 " clean."),
86 "Prisoner BFBC-8BF4C6B7492B. Importing illegal alien biomatter." 87 _("Prisoner BFBC-8BF4C6B7492B. Importing illegal alien biomatter."
87 " 15 years.", 88 " 15 years."),
88 ( 89 (
89 (275, 430, 50, 70), 90 (275, 430, 50, 70),
90 (255, 460, 50, 70), 91 (255, 460, 50, 70),
91 (235, 490, 50, 60), 92 (235, 490, 50, 60),
92 ))) 93 )))
93 94
94 self.add_thing(GenericCryoUnit(5, 95 self.add_thing(GenericCryoUnit(5,
95 "A working cryo chamber. The frosted glass obscures the details of" 96 _("A working cryo chamber. The frosted glass obscures the details "
96 " the occupant.", 97 "of the occupant."),
97 "Prisoner B520-99495B8C41CE. Copyright infringement. 60 years.", 98 _("Prisoner B520-99495B8C41CE. Copyright infringement. 60 years."),
98 ( 99 (
99 (340, 430, 50, 70), 100 (340, 430, 50, 70),
100 (330, 500, 60, 50), 101 (330, 500, 60, 50),
101 ))) 102 )))
102 103
103 self.add_thing(GenericCryoUnit(6, 104 self.add_thing(GenericCryoUnit(6,
104 "An empty cryo unit. Recently filled by you.", 105 _("An empty cryo unit. Recently filled by you."),
105 "Prisoner %s. Safecracking, grand larceny. 30 years." % PLAYER_ID, 106 _("Prisoner %s. Safecracking, grand larceny. 30 years.")
107 % PLAYER_ID,
106 ( 108 (
107 (399, 426, 70, 56), 109 (399, 426, 70, 56),
108 (404, 455, 69, 120), 110 (404, 455, 69, 120),
109 ))) 111 )))
110 112
111 self.add_thing(GenericCryoUnit(7, 113 self.add_thing(GenericCryoUnit(7,
112 "An empty cryo unit.", 114 _("An empty cryo unit."),
113 "Prisoner 83F1-CE32D3234749. Spamming. 5 years.", 115 _("Prisoner 83F1-CE32D3234749. Spamming. 5 years."),
114 ( 116 (
115 (472, 432, 58, 51), 117 (472, 432, 58, 51),
116 (488, 455, 41, 134), 118 (488, 455, 41, 134),
117 (517, 487, 42, 93), 119 (517, 487, 42, 93),
118 ))) 120 )))
119 121
120 self.add_thing(GenericCryoUnit(8, 122 self.add_thing(GenericCryoUnit(8,
121 "An empty cryo unit.", 123 _("An empty cryo unit."),
122 "Prisoner A455-9DF9F43C43E5. Medical malpractice. 10 years.", 124 _("Prisoner A455-9DF9F43C43E5. Medical malpractice. 10 years."),
123 ( 125 (
124 (596, 419, 69, 39), 126 (596, 419, 69, 39),
125 (616, 442, 82, 40), 127 (616, 442, 82, 40),
126 (648, 467, 84, 37), 128 (648, 467, 84, 37),
127 (681, 491, 97, 60), 129 (681, 491, 97, 60),
128 ))) 130 )))
129 131
130 def enter(self): 132 def enter(self):
131 # Setup music 133 # Setup music
132 pieces = [get_music(x, prefix='sounds') for x in self.MUSIC] 134 pieces = [self.sound.get_music(x) for x in self.MUSIC]
133 background_playlist = PlayList(pieces, random=True, repeat=True) 135 background_playlist = self.sound.get_playlist(pieces, random=True,
134 change_playlist(background_playlist) 136 repeat=True)
137 self.sound.change_playlist(background_playlist)
135 if self.get_data('greet'): 138 if self.get_data('greet'):
136 self.set_data('greet', False) 139 self.set_data('greet', False)
137 return make_jim_dialog( 140 return make_jim_dialog(
138 "Greetings, Prisoner %s. I am the Judicial " 141 _("Greetings, Prisoner %s. I am the Judicial "
139 "Incarceration Monitor. " 142 "Incarceration Monitor. "
140 "You have been woken early under the terms of the " 143 "You have been woken early under the terms of the "
141 "emergency conscription act to assist with repairs to " 144 "emergency conscription act to assist with repairs to "
142 "the ship. Your behaviour during this time will " 145 "the ship. Your behaviour during this time will "
143 "be noted on your record and will be relayed to " 146 "be noted on your record and will be relayed to "
144 "prison officials when we reach the destination. " 147 "prison officials when we reach the destination. "
145 "Please report to the bridge." % PLAYER_ID, self.state) 148 "Please report to the bridge.") % PLAYER_ID, self.game)
146 149
147 def leave(self): 150 def leave(self):
148 # Stop music 151 # Stop music
149 change_playlist(None) 152 self.sound.change_playlist(None)
150 153
151 154
152 class CryoPipeBase(Thing): 155 class CryoPipeBase(Thing):
153 "Base class for cryo pipes that need to be stolen." 156 "Base class for cryo pipes that need to be stolen."
154 157
156 159
157 INITIAL_DATA = { 160 INITIAL_DATA = {
158 'fixed': True, 161 'fixed': True,
159 } 162 }
160 163
164 def select_interact(self):
165 if not self.get_data('fixed'):
166 return 'chopped'
167 return self.INITIAL
168
161 def interact_with_machete(self, item): 169 def interact_with_machete(self, item):
162 if self.get_data('fixed'): 170 if self.get_data('fixed'):
163 self.set_data('fixed', False) 171 self.set_data('fixed', False)
164 pipe = TubeFragment('tube_fragment') 172 self.game.add_inventory_item('tube_fragment')
165 self.state.add_item(pipe) 173 self.set_interact()
166 self.state.add_inventory_item(pipe.name) 174 responses = [Result(_("It takes more effort than one would expect,"
167 self.set_interact("chopped") 175 " but eventually the pipe is separated from"
168 responses = [Result("It takes more effort than one would expect," 176 " the wall."), soundfile="chop-chop.ogg")]
169 " but eventually the pipe is separated from the wall.", 177 if self.game.get_current_scene().get_data('vandalism_warn'):
170 soundfile="chop-chop.ogg")] 178 self.game.get_current_scene().set_data('vandalism_warn', False)
171 if self.state.current_scene.get_data('vandalism_warn'):
172 self.state.current_scene.set_data('vandalism_warn', False)
173 responses.append(make_jim_dialog( 179 responses.append(make_jim_dialog(
174 ("Prisoner %s. Vandalism is an offence punishable by a " 180 _("Prisoner %s. Vandalism is an offence punishable by a "
175 "minimum of an additional 6 months to your sentence." 181 "minimum of an additional 6 months to your sentence."
176 ) % PLAYER_ID, self.state)) 182 ) % PLAYER_ID, self.game))
177 return responses 183 return responses
178 184
179 def is_interactive(self, tool=None): 185 def is_interactive(self, tool=None):
180 return self.get_data('fixed') 186 return self.get_data('fixed')
181 187
182 def interact_without(self): 188 def interact_without(self):
183 if self.get_data('fixed'): 189 if self.get_data('fixed'):
184 return Result("These pipes aren't attached to the wall very" 190 return Result(_("These pipes aren't attached to the wall very"
185 " solidly.") 191 " solidly."))
186 return None 192 return None
187 193
188 def get_description(self): 194 def get_description(self):
189 if self.get_data('fixed'): 195 if self.get_data('fixed'):
190 return "These pipes carry cooling fluid to empty cryo units." 196 return _("These pipes carry cooling fluid to empty cryo units.")
191 return "There used to be a pipe carrying cooling fluid here." 197 return _("There used to be a pipe carrying cooling fluid here.")
192 198
193 199
194 class UncuttableCryoPipes(Thing): 200 class UncuttableCryoPipes(Thing):
195 "Base class for cryo pipes that can't be cut down." 201 "Base class for cryo pipes that can't be cut down."
196 202
203 } 209 }
204 210
205 INITIAL = "fixed" 211 INITIAL = "fixed"
206 212
207 def interact_with_machete(self, item): 213 def interact_with_machete(self, item):
208 return Result("These pipes carry fluid to the working cryo units." 214 return Result(_("These pipes carry fluid to the working cryo units."
209 " Chopping them down doesn't seem sensible.") 215 " Chopping them down doesn't seem sensible."))
210 216
211 def is_interactive(self, tool=None): 217 def is_interactive(self, tool=None):
212 return True 218 return True
213 219
214 def interact_without(self): 220 def interact_without(self):
215 return Result("These pipes aren't attached to the wall very solidly.") 221 return Result(
216 222 _("These pipes aren't attached to the wall very solidly."))
217 def get_description(self): 223
218 return "These pipes carry cooling fluid to the working cryo units." 224 def get_description(self):
225 return _("These pipes carry cooling fluid to the working cryo units.")
219 226
220 227
221 class TubeFragment(CloneableItem): 228 class TubeFragment(CloneableItem):
222 "Obtained after cutting down a cryo room pipe." 229 "Obtained after cutting down a cryo room pipe."
223 230
231 NAME = "tube_fragment"
224 INVENTORY_IMAGE = "tube_fragment.png" 232 INVENTORY_IMAGE = "tube_fragment.png"
225 CURSOR = CursorSprite('tube_fragment_cursor.png') 233 CURSOR = CursorSprite('tube_fragment_cursor.png')
226 TOOL_NAME = "tube_fragment" 234 TOOL_NAME = "tube_fragment"
235 MAX_COUNT = 3
227 236
228 237
229 class CryoPipeLeft(CryoPipeBase): 238 class CryoPipeLeft(CryoPipeBase):
230 "Left cryo pipe." 239 "Left cryo pipe."
231 240
257 266
258 267
259 class TitaniumLeg(Item): 268 class TitaniumLeg(Item):
260 "Titanium leg, found on a piratical corpse." 269 "Titanium leg, found on a piratical corpse."
261 270
271 NAME = 'titanium_leg'
262 INVENTORY_IMAGE = "titanium_femur.png" 272 INVENTORY_IMAGE = "titanium_femur.png"
263 CURSOR = CursorSprite('titanium_femur_cursor.png', 13, 5) 273 CURSOR = CursorSprite('titanium_femur_cursor.png', 13, 5)
264 274
265 275
266 class CryoUnitAlpha(Thing): 276 class CryoUnitAlpha(Thing):
285 295
286 def interact_without(self): 296 def interact_without(self):
287 return Result(detail_view='cryo_detail') 297 return Result(detail_view='cryo_detail')
288 298
289 def interact_with_titanium_leg(self, item): 299 def interact_with_titanium_leg(self, item):
290 return Result("You hit the chamber that used to hold this very leg." 300 return Result(_("You hit the chamber that used to hold this very leg."
291 " Nothing happens as a result.", 301 " Nothing happens as a result."),
292 soundfile="clang2.ogg") 302 soundfile="clang2.ogg")
293 303
294 def get_description(self): 304 def get_description(self):
295 if self.get_data('contains_titanium_leg'): 305 if self.get_data('contains_titanium_leg'):
296 return "A broken cryo chamber, with a poor unfortunate corpse" \ 306 return _("A broken cryo chamber, with a poor unfortunate corpse"
297 " inside." 307 " inside.")
298 return "A broken cryo chamber. The corpse inside is missing a leg." 308 return _("A broken cryo chamber. The corpse inside is missing a leg.")
299 309
300 310
301 class GenericCryoUnit(GenericDescThing): 311 class GenericCryoUnit(GenericDescThing):
302 "Generic Cryo unit" 312 "Generic Cryo unit"
303 313
315 def get_description(self): 325 def get_description(self):
316 return self.description 326 return self.description
317 327
318 def interact_with_titanium_leg(self, item): 328 def interact_with_titanium_leg(self, item):
319 return Result(random.choice([ 329 return Result(random.choice([
320 "You bang on the chamber with the titanium femur. Nothing" 330 _("You bang on the chamber with the titanium femur. Nothing"
321 " much happens.", 331 " much happens."),
322 "Hitting the cryo unit with the femur doesn't achieve" 332 _("Hitting the cryo unit with the femur doesn't achieve"
323 " anything.", 333 " anything."),
324 "You hit the chamber with the femur. Nothing happens.", 334 _("You hit the chamber with the femur. Nothing happens."),
325 ]), soundfile="clang2.ogg") 335 ]), soundfile="clang2.ogg")
326 336
327 337
328 class CryoRoomDoor(Door): 338 class CryoRoomDoor(Door):
329 "Door to the cryo room." 339 "Door to the cryo room."
343 } 353 }
344 354
345 def interact_with_titanium_leg(self, item): 355 def interact_with_titanium_leg(self, item):
346 if self.get_data('door') == "ajar": 356 if self.get_data('door') == "ajar":
347 self.open_door() 357 self.open_door()
348 return Result("You wedge the titanium femur into the chain and" 358 return Result(_("You wedge the titanium femur into the chain and"
349 " twist. With a satisfying *snap*, the chain breaks and" 359 " twist. With a satisfying *snap*, the chain"
350 " the door opens.", soundfile='break.ogg') 360 " breaks and the door opens."),
361 soundfile='break.ogg')
351 elif self.get_data('door') == "shut": 362 elif self.get_data('door') == "shut":
352 text = "You bang on the door with the titanium femur. It makes a" 363 text = _("You bang on the door with the titanium femur. It makes a"
353 " clanging sound." 364 " clanging sound.")
354 return Result(text, soundfile='clang.ogg') 365 return Result(text, soundfile='clang.ogg')
355 else: 366 else:
356 return Result("You wave the femur in the doorway. Nothing" 367 return Result(_("You wave the femur in the doorway. Nothing"
357 " happens.") 368 " happens."))
358 369
359 def interact_without(self): 370 def interact_without(self):
360 if self.get_data('door') == "shut": 371 if self.get_data('door') == "shut":
361 self.half_open_door() 372 self.half_open_door()
362 if self.get_data('door') != "open": 373 if self.get_data('door') != "open":
363 return Result("It moves slightly and then stops. A chain on the" 374 return Result(_("It moves slightly and then stops. A chain on the"
364 " other side is preventing it from opening completely.", 375 " other side is preventing it from opening"
365 soundfile='chain.ogg') 376 " completely."), soundfile='chain.ogg')
366 else: 377 else:
367 self.state.set_current_scene('map') 378 self.game.change_scene('map')
368 return None 379 return None
369 380
370 def interact_default(self, item): 381 def interact_default(self, item):
371 return self.interact_without() 382 return self.interact_without()
372 383
384 def select_interact(self):
385 return self.get_data('door') or self.INITIAL
386
373 def half_open_door(self): 387 def half_open_door(self):
374 self.set_data('door', "ajar") 388 self.set_data('door', "ajar")
375 self.set_interact("ajar") 389 self.set_interact()
376 390
377 def open_door(self): 391 def open_door(self):
378 self.set_data('door', "open") 392 self.set_data('door', "open")
379 self.set_interact("open") 393 self.set_interact()
380 394
381 def get_description(self): 395 def get_description(self):
382 if self.get_data('door') == "open": 396 if self.get_data('door') == "open":
383 return 'An open doorway leads to the rest of the ship.' 397 return _('An open doorway leads to the rest of the ship.')
384 elif self.get_data('door') == "ajar": 398 elif self.get_data('door') == "ajar":
385 return ("A rusty door. It can't open all the way because of a " 399 return _("A rusty door. It can't open all the way because of a "
386 "chain on the other side.") 400 "chain on the other side.")
387 return 'A rusty door. It is currently closed.' 401 return _('A rusty door. It is currently closed.')
388 402
389 403
390 class CryoComputer(Thing): 404 class CryoComputer(Thing):
391 "Computer in the cryo room." 405 "Computer in the cryo room."
392 406
403 417
404 def interact_without(self): 418 def interact_without(self):
405 return Result(detail_view='cryo_comp_detail') 419 return Result(detail_view='cryo_comp_detail')
406 420
407 def interact_with_titanium_leg(self, item): 421 def interact_with_titanium_leg(self, item):
408 return Result("Hitting it with the leg accomplishes nothing.") 422 return Result(_("Hitting it with the leg accomplishes nothing."))
409 423
410 def get_description(self): 424 def get_description(self):
411 return "A computer terminal, with some text on it." 425 return _("A computer terminal, with some text on it.")
412 426
413 427
414 class TitaniumLegThing(Thing): 428 class TitaniumLegThing(TakeableThing):
415 "Triangle in the cryo room." 429 "Triangle in the cryo room."
416 430
417 NAME = "cryo.titanium_leg" 431 NAME = "cryo.titanium_leg"
418 432
419 INTERACTS = { 433 INTERACTS = {
420 "leg": InteractImage(180, 132, "leg.png"), 434 "leg": InteractImage(180, 132, "leg.png"),
421 } 435 }
422 436
423 INITIAL = "leg" 437 INITIAL = "leg"
424 438 ITEM = 'titanium_leg'
425 def interact_without(self): 439
426 self.state.add_inventory_item('titanium_leg') 440 def interact_without(self):
427 self.state.current_scene.things['cryo.unit.1'].set_data( 441 self.game.scenes['cryo'].things['cryo.unit.1'].set_data(
428 'contains_titanium_leg', False) 442 'contains_titanium_leg', False)
429 self.scene.remove_thing(self) 443 self.take()
430 return Result("The skeletal occupant of this cryo unit has an" 444 return Result(_("The skeletal occupant of this cryo unit has an"
431 " artificial femur made of titanium. You take it.") 445 " artificial femur made of titanium. You take it."))
432 446
433 def get_description(self): 447 def get_description(self):
434 return "This femur looks synthetic." 448 return _("This femur looks synthetic.")
435 449
436 450
437 class PlaqueThing(Thing): 451 class PlaqueThing(Thing):
438 "Plaque on the detailed cryo chamber" 452 "Plaque on the detailed cryo chamber"
439 453
444 } 458 }
445 459
446 INITIAL = "plaque" 460 INITIAL = "plaque"
447 461
448 def interact_without(self): 462 def interact_without(self):
449 return Result("The plaque is welded to the unit. You can't shift it.") 463 return Result(
450 464 _("The plaque is welded to the unit. You can't shift it."))
451 def get_description(self): 465
452 return "'Prisoner 98CC-764E646391EE. War crimes. 45 years." 466 def get_description(self):
467 return _("'Prisoner 98CC-764E646391EE. War crimes. 45 years.")
453 468
454 469
455 class FullBottle(Item): 470 class FullBottle(Item):
471 NAME = 'full_detergent_bottle'
456 INVENTORY_IMAGE = 'bottle_full.png' 472 INVENTORY_IMAGE = 'bottle_full.png'
457 CURSOR = CursorSprite('bottle_full_cursor.png', 27, 7) 473 CURSOR = CursorSprite('bottle_full_cursor.png', 27, 7)
458 474
459 475
460 class CryoPools(Thing): 476 class CryoPools(Thing):
471 } 487 }
472 488
473 INITIAL = 'pools' 489 INITIAL = 'pools'
474 490
475 def get_description(self): 491 def get_description(self):
476 return "Coolant leaks disturbingly from the bulkheads." 492 return _("Coolant leaks disturbingly from the bulkheads.")
477 493
478 def interact_without(self): 494 def interact_without(self):
479 return Result("It's gooey") 495 return Result(_("It's gooey"))
480 496
481 def interact_with_detergent_bottle(self, item): 497 def interact_with_detergent_bottle(self, item):
482 full = FullBottle('full_detergent_bottle') 498 self.game.replace_inventory_item(item.name, 'full_detergent_bottle')
483 self.state.add_item(full) 499 return Result(_("You scoop up some coolant and fill the bottle."))
484 self.state.replace_inventory_item(item.name, full.name)
485 return Result("You scoop up some coolant and fill the bottle.")
486 500
487 501
488 class CryoCompDetail(Scene): 502 class CryoCompDetail(Scene):
489 503
490 FOLDER = "cryo" 504 FOLDER = "cryo"
491 BACKGROUND = "comp_info_detail.png" 505 BACKGROUND = "comp_info_detail.png"
492 BACKGROUND_FIXED = "comp_info_detail_fixed.png"
493 NAME = "cryo_comp_detail" 506 NAME = "cryo_comp_detail"
494 507
495 def __init__(self, state): 508 def setup(self):
496 super(CryoCompDetail, self).__init__(state) 509 background = self.get_image(
497 self._background_fixed = get_image(self.FOLDER, self.BACKGROUND_FIXED) 510 self.FOLDER, self.BACKGROUND)
511 # Add the common text strings
512 bg = (0, 0, 0, 0)
513 fg = 'lightgreen'
514 font = 'DejaVuSans-Bold.ttf'
515 size = 18
516
517 background.blit(render_text(_("Info"),
518 font, 24, fg, bg, self.resource, (90, 25), False), (25, 60))
519 background.blit(render_text(_("Cryo Units Online: 2, 4"),
520 font, size, fg, bg, self.resource, (240, 30), False), (15, 120))
521 background.blit(render_text(_("Crew Active: 0"),
522 font, size, fg, bg, self.resource, (240, 30), False), (15, 170))
523 background.blit(render_text(_("Current Trip Time: 97558 days"),
524 font, size, fg, bg, self.resource, (340, 30), False), (15, 210))
525 background.blit(render_text(_("Expected Time of Arrival:"),
526 font, size, fg, bg, self.resource, (340, 30), False), (15, 240))
527
528 self._background_fixed = background.copy()
529 self._background_offline = background.copy()
530
531 self._background_fixed.blit(render_text(_("397 days"),
532 font, size, fg, bg, self.resource, (340, 30), False), (275, 240))
533
534 self._background_offline.blit(render_text(
535 _("<Error: Division by Zero Error>"),
536 font, size, fg, bg, self.resource, (340, 30), False), (275, 240))
498 537
499 def draw_background(self, surface): 538 def draw_background(self, surface):
500 if self.state.scenes['engine'].get_data('engine online'): 539 if self.game.scenes['engine'].get_data('engine online'):
501 surface.blit(self._background_fixed, self.OFFSET, None) 540 surface.blit(self._background_fixed, self.OFFSET, None)
502 else: 541 else:
503 surface.blit(self._background, self.OFFSET, None) 542 surface.blit(self._background_offline, self.OFFSET, None)
504 543
505 544
506 class CryoUnitWithCorpse(Scene): 545 class CryoUnitWithCorpse(Scene):
507 546
508 FOLDER = "cryo" 547 FOLDER = "cryo"
509 BACKGROUND = "cryo_unit_detail.png" 548 BACKGROUND = "cryo_unit_detail.png"
510 NAME = "cryo_detail" 549 NAME = "cryo_detail"
511 550
512 def __init__(self, state): 551 def setup(self):
513 super(CryoUnitWithCorpse, self).__init__(state)
514 self.add_thing(TitaniumLegThing()) 552 self.add_thing(TitaniumLegThing())
515 self.add_thing(PlaqueThing()) 553 self.add_thing(PlaqueThing())
516 554
517 555
518 SCENES = [Cryo] 556 SCENES = [Cryo]