Mercurial > pyntnclick
comparison gamelib/scenes/engine.py @ 423:fc36fb0937a6
Engines on
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 28 Aug 2010 23:17:08 +0200 |
parents | 6a24970a0d21 |
children | 3dc589bb78e4 |
comparison
equal
deleted
inserted
replaced
422:785bceda2f4f | 423:fc36fb0937a6 |
---|---|
2 | 2 |
3 from gamelib.cursor import CursorSprite | 3 from gamelib.cursor import CursorSprite |
4 from gamelib.state import Scene, Item, Thing, Result | 4 from gamelib.state import Scene, Item, Thing, Result |
5 from gamelib.scenes.scene_widgets import (Door, InteractText, InteractNoImage, | 5 from gamelib.scenes.scene_widgets import (Door, InteractText, InteractNoImage, |
6 InteractRectUnion, InteractImage, | 6 InteractRectUnion, InteractImage, |
7 InteractAnimated, GenericDescThing) | 7 InteractAnimated, GenericDescThing, |
8 make_jim_dialog) | |
8 | 9 |
9 | 10 |
10 class Engine(Scene): | 11 class Engine(Scene): |
11 | 12 |
12 FOLDER = "engine" | 13 FOLDER = "engine" |
125 ( | 126 ( |
126 (681, 322, 80, 33), | 127 (681, 322, 80, 33), |
127 ) | 128 ) |
128 )) | 129 )) |
129 | 130 |
131 def engine_online_check(self): | |
132 if self.things['engine.cryo_containers'].get_data('filled') \ | |
133 and self.things['engine.superconductor'].get_data('working'): | |
134 self.set_data('engine online', True) | |
135 self.add_thing(Engines()) | |
136 return make_jim_dialog("The engines are now operational. " | |
137 "You have done a satisfactory job.", | |
138 self.state) | |
139 | |
130 def enter(self): | 140 def enter(self): |
131 return Result("You enter the engine room. Even if there wasn't a vacuum " | 141 return Result("You enter the engine room. Even if there wasn't a vacuum " |
132 "it would be eerily quiet.") | 142 "it would be eerily quiet.") |
143 | |
144 class Engines(Thing): | |
145 NAME = 'engine.engines' | |
146 | |
147 INTERACTS = { | |
148 'on': InteractImage(334, 253, 'engine_on.png'), | |
149 } | |
150 | |
151 INITIAL = 'on' | |
152 | |
153 def is_interactive(self): | |
154 return False | |
155 | |
133 | 156 |
134 class CanOpener(Item): | 157 class CanOpener(Item): |
135 INVENTORY_IMAGE = 'can_opener.png' | 158 INVENTORY_IMAGE = 'can_opener.png' |
136 CURSOR = CursorSprite('can_opener_cursor.png') | 159 CURSOR = CursorSprite('can_opener_cursor.png') |
137 | 160 |
209 def interact_with_taped_superconductor(self, item): | 232 def interact_with_taped_superconductor(self, item): |
210 if not self.get_data('present'): | 233 if not self.get_data('present'): |
211 self.set_interact('fixed') | 234 self.set_interact('fixed') |
212 self.set_data('present', True) | 235 self.set_data('present', True) |
213 self.set_data('working', True) | 236 self.set_data('working', True) |
214 self.scene.set_data('engine online', True) | |
215 self.state.remove_inventory_item(item.name) | 237 self.state.remove_inventory_item(item.name) |
216 return Result("The chair's superconductor looks over-specced for this job, but it should work") | 238 results = [Result("The chair's superconductor looks over-specced " |
239 "for this job, but it should work")] | |
240 results.append(self.scene.engine_online_check()) | |
241 return results | |
217 else: | 242 else: |
218 return Result("It might help to remove the broken superconductor first") | 243 return Result("It might help to remove the broken superconductor first") |
219 | 244 |
220 | 245 |
221 class CryoContainers(Thing): | 246 class CryoContainers(Thing): |
264 def interact_with_full_detergent_bottle(self, item): | 289 def interact_with_full_detergent_bottle(self, item): |
265 if not self.scene.things['engine.cracked_pipe'].get_data('fixed'): | 290 if not self.scene.things['engine.cracked_pipe'].get_data('fixed'): |
266 return Result("You think pouring the precious cryo fluid into a" | 291 return Result("You think pouring the precious cryo fluid into a" |
267 " container connected to a cracked pipe would be a waste.") | 292 " container connected to a cracked pipe would be a waste.") |
268 self.state.remove_inventory_item(item.name) | 293 self.state.remove_inventory_item(item.name) |
269 self.state.current_scene.things['engine.cryo_containers'] \ | 294 self.scene.things['engine.cryo_containers'].set_data('filled', True) |
270 .set_data('filled', True) | 295 self.scene.things['engine.cryo_containers'].set_interact('full') |
271 self.state.current_scene.things['engine.cryo_containers'] \ | 296 results = [Result("You fill the reservoirs. " |
272 .set_interact('full') | 297 "It seems the detergent bottle was just big enough.")] |
273 return Result("You fill the reservoirs. " | 298 results.append(self.scene.engine_online_check()) |
274 "It seems the detergent bottle was just big enough.") | 299 return results |
275 | 300 |
276 | 301 |
277 class CoolingPipes(Thing): | 302 class CoolingPipes(Thing): |
278 NAME = 'engine.coolingpipes' | 303 NAME = 'engine.coolingpipes' |
279 | 304 |
312 )), | 337 )), |
313 } | 338 } |
314 INITIAL = 'pipes' | 339 INITIAL = 'pipes' |
315 | 340 |
316 def get_description(self): | 341 def get_description(self): |
317 if not self.state.current_scene.things['engine.cryo_containers'] \ | 342 if not self.scene.things['engine.cryo_containers'].get_data('filled'): |
318 .get_data('filled'): | |
319 return "These pipes carry coolant to the superconductors. " \ | 343 return "These pipes carry coolant to the superconductors. " \ |
320 "They feel warm." | 344 "They feel warm." |
321 return "These pipes carry coolant to the superconductors. " \ | 345 return "These pipes carry coolant to the superconductors. " \ |
322 "They are very cold." | 346 "They are very cold." |
323 | 347 |
341 } | 365 } |
342 | 366 |
343 INITIAL = 'lines' | 367 INITIAL = 'lines' |
344 | 368 |
345 def get_description(self): | 369 def get_description(self): |
346 if self.state.current_scene.things['engine.superconductor'] \ | 370 if self.scene.things['engine.superconductor'].get_data('working'): |
347 .get_data('fixed'): | |
348 return "Power lines. They are delivering power to the engines." | 371 return "Power lines. They are delivering power to the engines." |
349 return "Power lines. It looks like they aren't working correctly." | 372 return "Power lines. It looks like they aren't working correctly." |
350 | 373 |
351 def is_interactive(self): | 374 def is_interactive(self): |
352 return False | 375 return False |
455 else: | 478 else: |
456 return "The pipe looks cracked and won't hold" \ | 479 return "The pipe looks cracked and won't hold" \ |
457 " fluid until it's fixed." | 480 " fluid until it's fixed." |
458 | 481 |
459 def interact_with_duct_tape(self, item): | 482 def interact_with_duct_tape(self, item): |
460 if set.get_data('fixed'): | 483 if self.get_data('fixed'): |
461 return Result("The duct tape already there appears to be" | 484 return Result("The duct tape already there appears to be " |
462 " sufficient.") | 485 "sufficient.") |
463 else: | 486 else: |
464 self.set_data('fixed', True) | 487 self.set_data('fixed', True) |
465 self.set_interact('taped') | 488 self.set_interact('taped') |
466 return Result("You apply your trust duct tape to the" | 489 return Result("You apply your trust duct tape to the " |
467 " creak, sealing it.") | 490 "creak, sealing it.") |
468 | 491 |
469 | 492 |
470 class ToMap(Door): | 493 class ToMap(Door): |
471 | 494 |
472 SCENE = "engine" | 495 SCENE = "engine" |