comparison gamelib/scenes/scene_widgets.py @ 360:452230d78541

Use make_jim_dialog everywhere
author Neil Muller <neil@dip.sun.ac.za>
date Sat, 28 Aug 2010 16:51:40 +0200
parents 09efb8b7c132
children 19aff54b2e73
comparison
equal deleted inserted replaced
359:6b94f549443b 360:452230d78541
175 "Sadly, this isn't that sort of game.", 175 "Sadly, this isn't that sort of game.",
176 "Your valiant efforts are foiled by the Evil Game Designer.", 176 "Your valiant efforts are foiled by the Evil Game Designer.",
177 "Waving that in the doorway does nothing. Try something else, perhaps?", 177 "Waving that in the doorway does nothing. Try something else, perhaps?",
178 ])) 178 ]))
179 179
180
181 def make_jim_dialog(mesg, state):
182 "Utility helper function"
183 if state.scenes['bridge'].get_data('ai status') == 'online':
184 return Result(mesg, style='JIM')
185 else:
186 return None
187
188
180 class BaseCamera(Thing): 189 class BaseCamera(Thing):
181 "Base class for the camera puzzles" 190 "Base class for the camera puzzles"
182 191
183 INITIAL = 'camera' 192 INITIAL = 'camera'
184 193
185 def get_description(self): 194 def get_description(self):
186 return "A security camera watches over the room" 195 return "A security camera watches over the room"
187 196
188 def interact_with_escher_poster(self, item): 197 def interact_with_escher_poster(self, item):
198 # Order matters here, because of helper function
199 ai_response = make_jim_dialog("3D scene reconstruction failed. Critical error. Entering emergency shutdown.", self.state)
189 self.state.scenes['bridge'].set_data('ai status', 'looping') 200 self.state.scenes['bridge'].set_data('ai status', 'looping')
190 return Result("JIM says '3D scene reconstruction failed. Critical error. Entering emergency shutdown.", style="JIM") 201 return ai_response
191 202
203