comparison gamelib/scenes/game_widgets.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 098ea4ea0d0d
children c77d6aa29bee
comparison
equal deleted inserted replaced
602:1aac5a3b17e1 603:3ce19d33b51f
17 def is_interactive(self, tool=None): 17 def is_interactive(self, tool=None):
18 return True 18 return True
19 19
20 def interact_without(self): 20 def interact_without(self):
21 """Go to map.""" 21 """Go to map."""
22 self.state.set_current_scene("map") 22 self.game.set_current_scene("map")
23 23
24 def get_description(self): 24 def get_description(self):
25 return 'An open doorway leads to the rest of the ship.' 25 return 'An open doorway leads to the rest of the ship.'
26 26
27 def interact_default(self, item): 27 def interact_default(self, item):
43 INITIAL_DATA = { 43 INITIAL_DATA = {
44 'state': 'online', 44 'state': 'online',
45 } 45 }
46 46
47 def get_description(self): 47 def get_description(self):
48 status = self.state.scenes['bridge'].get_data('ai status') 48 status = self.game.scenes['bridge'].get_data('ai status')
49 if status == 'online': 49 if status == 'online':
50 return "A security camera watches over the room" 50 return "A security camera watches over the room"
51 elif status == 'looping': 51 elif status == 'looping':
52 return "The security camera is currently offline but should be" \ 52 return "The security camera is currently offline but should be" \
53 " working soon" 53 " working soon"
54 else: 54 else:
55 return "The security camera is powered down" 55 return "The security camera is powered down"
56 56
57 def is_interactive(self, tool=None): 57 def is_interactive(self, tool=None):
58 return self.state.scenes['bridge'].get_data('ai status') == 'online' 58 return self.game.scenes['bridge'].get_data('ai status') == 'online'
59 59
60 def interact_with_escher_poster(self, item): 60 def interact_with_escher_poster(self, item):
61 # Order matters here, because of helper function 61 # Order matters here, because of helper function
62 if self.state.scenes['bridge'].get_data('ai status') == 'online': 62 if self.game.scenes['bridge'].get_data('ai status') == 'online':
63 ai_response = make_jim_dialog("3D scene reconstruction failed." 63 ai_response = make_jim_dialog("3D scene reconstruction failed."
64 " Critical error. Entering emergency shutdown.", 64 " Critical error. Entering emergency shutdown.",
65 self.state) 65 self.game)
66 self.state.scenes['bridge'].set_data('ai status', 'looping') 66 self.game.scenes['bridge'].set_data('ai status', 'looping')
67 return ai_response 67 return ai_response
68 68
69 def animate(self): 69 def animate(self):
70 ai_status = self.state.scenes['bridge'].get_data('ai status') 70 ai_status = self.game.scenes['bridge'].get_data('ai status')
71 if ai_status != self.get_data('status'): 71 if ai_status != self.get_data('status'):
72 self.set_data('status', ai_status) 72 self.set_data('status', ai_status)
73 self.set_interact(ai_status) 73 self.set_interact(ai_status)
74 super(BaseCamera, self).animate() 74 super(BaseCamera, self).animate()