comparison gamelib/scenes/cryo.py @ 603:3ce19d33b51f pyntnclick

Rename state to game to not cause confusion with the other state
author Neil Muller <neil@dip.sun.ac.za>
date Sat, 11 Feb 2012 20:09:47 +0200
parents c0e0b3d5730c
children dd12337423ab
comparison
equal deleted inserted replaced
602:1aac5a3b17e1 603:3ce19d33b51f
137 "You have been woken early under the terms of the " 137 "You have been woken early under the terms of the "
138 "emergency conscription act to assist with repairs to " 138 "emergency conscription act to assist with repairs to "
139 "the ship. Your behaviour during this time will " 139 "the ship. Your behaviour during this time will "
140 "be noted on your record and will be relayed to " 140 "be noted on your record and will be relayed to "
141 "prison officials when we reach the destination. " 141 "prison officials when we reach the destination. "
142 "Please report to the bridge." % PLAYER_ID, self.state) 142 "Please report to the bridge." % PLAYER_ID, self.game)
143 143
144 def leave(self): 144 def leave(self):
145 # Stop music 145 # Stop music
146 self.sound.change_playlist(None) 146 self.sound.change_playlist(None)
147 147
157 157
158 def interact_with_machete(self, item): 158 def interact_with_machete(self, item):
159 if self.get_data('fixed'): 159 if self.get_data('fixed'):
160 self.set_data('fixed', False) 160 self.set_data('fixed', False)
161 pipe = TubeFragment('tube_fragment') 161 pipe = TubeFragment('tube_fragment')
162 self.state.add_item(pipe) 162 self.game.add_item(pipe)
163 self.state.add_inventory_item(pipe.name) 163 self.game.add_inventory_item(pipe.name)
164 self.set_interact("chopped") 164 self.set_interact("chopped")
165 responses = [Result("It takes more effort than one would expect," 165 responses = [Result("It takes more effort than one would expect,"
166 " but eventually the pipe is separated from the wall.", 166 " but eventually the pipe is separated from the wall.",
167 soundfile="chop-chop.ogg")] 167 soundfile="chop-chop.ogg")]
168 if self.state.current_scene.get_data('vandalism_warn'): 168 if self.game.current_scene.get_data('vandalism_warn'):
169 self.state.current_scene.set_data('vandalism_warn', False) 169 self.game.current_scene.set_data('vandalism_warn', False)
170 responses.append(make_jim_dialog( 170 responses.append(make_jim_dialog(
171 ("Prisoner %s. Vandalism is an offence punishable by a " 171 ("Prisoner %s. Vandalism is an offence punishable by a "
172 "minimum of an additional 6 months to your sentence." 172 "minimum of an additional 6 months to your sentence."
173 ) % PLAYER_ID, self.state)) 173 ) % PLAYER_ID, self.game))
174 return responses 174 return responses
175 175
176 def is_interactive(self, tool=None): 176 def is_interactive(self, tool=None):
177 return self.get_data('fixed') 177 return self.get_data('fixed')
178 178
359 if self.get_data('door') != "open": 359 if self.get_data('door') != "open":
360 return Result("It moves slightly and then stops. A chain on the" 360 return Result("It moves slightly and then stops. A chain on the"
361 " other side is preventing it from opening completely.", 361 " other side is preventing it from opening completely.",
362 soundfile='chain.ogg') 362 soundfile='chain.ogg')
363 else: 363 else:
364 self.state.set_current_scene('map') 364 self.game.set_current_scene('map')
365 return None 365 return None
366 366
367 def interact_default(self, item): 367 def interact_default(self, item):
368 return self.interact_without() 368 return self.interact_without()
369 369
418 } 418 }
419 419
420 INITIAL = "leg" 420 INITIAL = "leg"
421 421
422 def interact_without(self): 422 def interact_without(self):
423 self.state.add_inventory_item('titanium_leg') 423 self.game.add_inventory_item('titanium_leg')
424 self.state.current_scene.things['cryo.unit.1'].set_data( 424 self.game.current_scene.things['cryo.unit.1'].set_data(
425 'contains_titanium_leg', False) 425 'contains_titanium_leg', False)
426 self.scene.remove_thing(self) 426 self.scene.remove_thing(self)
427 return Result("The skeletal occupant of this cryo unit has an" 427 return Result("The skeletal occupant of this cryo unit has an"
428 " artificial femur made of titanium. You take it.") 428 " artificial femur made of titanium. You take it.")
429 429
475 def interact_without(self): 475 def interact_without(self):
476 return Result("It's gooey") 476 return Result("It's gooey")
477 477
478 def interact_with_detergent_bottle(self, item): 478 def interact_with_detergent_bottle(self, item):
479 full = FullBottle('full_detergent_bottle') 479 full = FullBottle('full_detergent_bottle')
480 self.state.add_item(full) 480 self.game.add_item(full)
481 self.state.replace_inventory_item(item.name, full.name) 481 self.game.replace_inventory_item(item.name, full.name)
482 return Result("You scoop up some coolant and fill the bottle.") 482 return Result("You scoop up some coolant and fill the bottle.")
483 483
484 484
485 class CryoCompDetail(Scene): 485 class CryoCompDetail(Scene):
486 486
492 def setup(self): 492 def setup(self):
493 self._background_fixed = self.get_image( 493 self._background_fixed = self.get_image(
494 self.FOLDER, self.BACKGROUND_FIXED) 494 self.FOLDER, self.BACKGROUND_FIXED)
495 495
496 def draw_background(self, surface): 496 def draw_background(self, surface):
497 if self.state.scenes['engine'].get_data('engine online'): 497 if self.game.scenes['engine'].get_data('engine online'):
498 surface.blit(self._background_fixed, self.OFFSET, None) 498 surface.blit(self._background_fixed, self.OFFSET, None)
499 else: 499 else:
500 surface.blit(self._background, self.OFFSET, None) 500 surface.blit(self._background, self.OFFSET, None)
501 501
502 502