Mercurial > boomslang
diff 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 |
line wrap: on
line diff
--- a/gamelib/scenes/scene_widgets.py Sat Aug 28 16:36:38 2010 +0200 +++ b/gamelib/scenes/scene_widgets.py Sat Aug 28 16:51:40 2010 +0200 @@ -177,6 +177,15 @@ "Waving that in the doorway does nothing. Try something else, perhaps?", ])) + +def make_jim_dialog(mesg, state): + "Utility helper function" + if state.scenes['bridge'].get_data('ai status') == 'online': + return Result(mesg, style='JIM') + else: + return None + + class BaseCamera(Thing): "Base class for the camera puzzles" @@ -186,6 +195,9 @@ return "A security camera watches over the room" def interact_with_escher_poster(self, item): + # Order matters here, because of helper function + ai_response = make_jim_dialog("3D scene reconstruction failed. Critical error. Entering emergency shutdown.", self.state) self.state.scenes['bridge'].set_data('ai status', 'looping') - return Result("JIM says '3D scene reconstruction failed. Critical error. Entering emergency shutdown.", style="JIM") + return ai_response +