Mercurial > pyntnclick
comparison gamelib/scenes/bridge.py @ 655:c77d6aa29bee pyntnclick
Some code to kinda demonstrate the ever so cunning state handling plan
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Sun, 12 Feb 2012 13:56:59 +0200 |
parents | 660ef5793886 |
children | b9504e6ecde1 |
comparison
equal
deleted
inserted
replaced
654:335db68e0db4 | 655:c77d6aa29bee |
---|---|
328 def get_description(self): | 328 def get_description(self): |
329 if self.scene.get_data('ai panel') == 'closed': | 329 if self.scene.get_data('ai panel') == 'closed': |
330 return "The sign reads 'Warning: Authorized Techinicians Only'." | 330 return "The sign reads 'Warning: Authorized Techinicians Only'." |
331 | 331 |
332 def interact_without(self): | 332 def interact_without(self): |
333 if self.scene.get_data('ai status') == 'online': | 333 ai_status = self.state.get_jim_state() |
334 if ai_status == 'online': | |
334 return self.interact_default(None) | 335 return self.interact_default(None) |
335 elif self.scene.get_data('ai panel') == 'closed': | 336 elif self.scene.get_data('ai panel') == 'closed': |
336 return Result("You are unable to open the panel with your" | 337 return Result("You are unable to open the panel with your" |
337 " bare hands.") | 338 " bare hands.") |
338 elif self.scene.get_data('ai panel') == 'open': | 339 elif self.scene.get_data('ai panel') == 'open': |
339 self.scene.set_data('ai panel', 'broken') | 340 self.scene.set_data('ai panel', 'broken') |
340 self.scene.set_data('ai status', 'dead') | 341 self.state.break_ai() |
341 self.set_interact('broken') | 342 self.set_interact('broken') |
342 return Result("You unplug various important-looking wires.") | 343 return Result("You unplug various important-looking wires.") |
343 | 344 |
344 def interact_with_machete(self, item): | 345 def interact_with_machete(self, item): |
345 if self.scene.get_data('ai status') == 'online': | 346 ai_status = self.state.get_jim_state() |
347 if ai_status == 'online': | |
346 return self.interact_default(item) | 348 return self.interact_default(item) |
347 elif self.scene.get_data('ai panel') == 'closed': | 349 elif self.scene.get_data('ai panel') == 'closed': |
348 self.scene.set_data('ai panel', 'open') | 350 self.scene.set_data('ai panel', 'open') |
349 self.set_interact('open') | 351 self.set_interact('open') |
350 return Result("Using the machete, you lever the panel off.") | 352 return Result("Using the machete, you lever the panel off.") |
351 elif self.scene.get_data('ai panel') == 'open': | 353 elif self.scene.get_data('ai panel') == 'open': |
352 self.scene.set_data('ai panel', 'broken') | 354 self.scene.set_data('ai panel', 'broken') |
353 self.scene.set_data('ai status', 'dead') | 355 self.state.break_ai() |
354 self.set_interact('broken') | 356 self.set_interact('broken') |
355 return Result("You smash various delicate components with" | 357 return Result("You smash various delicate components with" |
356 " the machete.") | 358 " the machete.") |
357 | 359 |
358 def interact_default(self, item): | 360 def interact_default(self, item): |
359 if self.scene.get_data('ai status') == 'online': | 361 if self.state.get_jim_state() == 'online': |
360 return (Result('You feel a shock from the panel.'), | 362 return (Result('You feel a shock from the panel.'), |
361 make_jim_dialog("Prisoner %s. Please step away from the" | 363 make_jim_dialog("Prisoner %s. Please step away from the" |
362 " panel. You are not an authorized" | 364 " panel. You are not an authorized" |
363 " technician." % PLAYER_ID, self.game)) | 365 " technician." % PLAYER_ID, self.game)) |
364 | 366 |