# HG changeset patch # User Jeremy Thurgood # Date 1283876015 -7200 # Node ID 8f3c82c685a4eadf01a6b13ef9c91bae645b75db # Parent 3e91c82c224028a4e981b8aeaf12156f7d063d18 Fix is_interactive() by adding tool param. diff -r 3e91c82c2240 -r 8f3c82c685a4 gamelib/gamescreen.py --- a/gamelib/gamescreen.py Tue Sep 07 17:05:51 2010 +0200 +++ b/gamelib/gamescreen.py Tue Sep 07 18:13:35 2010 +0200 @@ -39,7 +39,7 @@ item = self.state.inventory[item_no] if self.item_is_selected(item_no): self.unselect() - elif self.state.tool or item.is_interactive(): + elif item.is_interactive(self.state.tool): result = item.interact(self.state.tool) handle_result(result, self.state_widget) else: diff -r 3e91c82c2240 -r 8f3c82c685a4 gamelib/scenes/bridge.py --- a/gamelib/scenes/bridge.py Tue Sep 07 17:05:51 2010 +0200 +++ b/gamelib/scenes/bridge.py Tue Sep 07 18:13:35 2010 +0200 @@ -170,7 +170,7 @@ return self.state.current_scene.things['bridge.massagechair_base'] \ .get_description() - def is_interactive(self): + def is_interactive(self, tool=None): return False @@ -259,7 +259,7 @@ INITIAL = 'stars' - def is_interactive(self): + def is_interactive(self, tool=None): return False @@ -269,7 +269,7 @@ super(BlinkingLights, self).__init__() self.description = None - def is_interactive(self): + def is_interactive(self, tool=None): return False def leave(self): @@ -377,7 +377,7 @@ INITIAL = 'log tab' COMPUTER = 'bridge_comp_detail' - def is_interactive(self): + def is_interactive(self, tool=None): return self.state.detail_views[self.COMPUTER].get_data('tab') != 'log' def interact_without(self): @@ -397,7 +397,7 @@ INITIAL = 'alert tab' COMPUTER = 'bridge_comp_detail' - def is_interactive(self): + def is_interactive(self, tool=None): return self.state.detail_views[self.COMPUTER].get_data('tab') != 'alert' def interact_without(self): @@ -416,7 +416,7 @@ INITIAL = 'nav tab' COMPUTER = 'bridge_comp_detail' - def is_interactive(self): + def is_interactive(self, tool=None): return self.state.detail_views[self.COMPUTER].get_data('tab') != 'nav' def interact_without(self): @@ -442,7 +442,7 @@ self.ai_blocked = ai_blocked self.set_interact('line') - def is_interactive(self): + def is_interactive(self, tool=None): return self.state.detail_views[self.COMPUTER].get_data('tab') == 'nav' def interact_without(self): @@ -466,7 +466,7 @@ INITIAL = 'up' COMPUTER = 'bridge_comp_detail' - def is_interactive(self): + def is_interactive(self, tool=None): tab = self.state.detail_views[self.COMPUTER].get_data('tab') page = self.state.detail_views[self.COMPUTER].get_data('log page') return tab == 'log' and page > 0 @@ -489,7 +489,7 @@ INITIAL = 'down' COMPUTER = 'bridge_comp_detail' - def is_interactive(self): + def is_interactive(self, tool=None): tab = self.state.detail_views[self.COMPUTER].get_data('tab') page = self.state.detail_views[self.COMPUTER].get_data('log page') max_page = self.state.detail_views[self.COMPUTER].get_data('max page') diff -r 3e91c82c2240 -r 8f3c82c685a4 gamelib/scenes/cryo.py --- a/gamelib/scenes/cryo.py Tue Sep 07 17:05:51 2010 +0200 +++ b/gamelib/scenes/cryo.py Tue Sep 07 18:13:35 2010 +0200 @@ -174,7 +174,7 @@ ) % PLAYER_ID, self.state)) return responses - def is_interactive(self): + def is_interactive(self, tool=None): return self.get_data('fixed') def interact_without(self): @@ -205,7 +205,7 @@ return Result("These pipes carry fluid to the working cryo units." " Chopping them down doesn't seem sensible.") - def is_interactive(self): + def is_interactive(self, tool=None): return True def interact_without(self): @@ -300,7 +300,7 @@ super(GenericCryoUnit, self).__init__('cryo.unit', number, description, areas) self.detailed_description = detailed_description - def is_interactive(self): + def is_interactive(self, tool=None): return True def interact_without(self): diff -r 3e91c82c2240 -r 8f3c82c685a4 gamelib/scenes/engine.py --- a/gamelib/scenes/engine.py Tue Sep 07 17:05:51 2010 +0200 +++ b/gamelib/scenes/engine.py Tue Sep 07 18:13:35 2010 +0200 @@ -146,7 +146,7 @@ INITIAL = 'on' - def is_interactive(self): + def is_interactive(self, tool=None): return False def get_description(self): @@ -256,7 +256,7 @@ return "Those are coolant reservoirs. They look empty." return "The coolant reservoirs are full." - def is_interactive(self): + def is_interactive(self, tool=None): return False @@ -340,7 +340,7 @@ return "These pipes carry coolant to the superconductors. " \ "They are very cold." - def is_interactive(self): + def is_interactive(self, tool=None): return False @@ -366,7 +366,7 @@ return "Power lines. They are delivering power to the engines." return "Power lines. It looks like they aren't working correctly." - def is_interactive(self): + def is_interactive(self, tool=None): return False @@ -383,7 +383,7 @@ INITIAL = 'arrows' - def is_interactive(self): + def is_interactive(self, tool=None): return False @@ -400,7 +400,7 @@ INITIAL = 'arrows' - def is_interactive(self): + def is_interactive(self, tool=None): return False @@ -417,7 +417,7 @@ INITIAL = 'arrows' - def is_interactive(self): + def is_interactive(self, tool=None): return False @@ -433,7 +433,7 @@ INITIAL = 'sign' - def is_interactive(self): + def is_interactive(self, tool=None): return False @@ -449,7 +449,7 @@ INITIAL = 'stars' - def is_interactive(self): + def is_interactive(self, tool=None): return False def get_description(self): diff -r 3e91c82c2240 -r 8f3c82c685a4 gamelib/scenes/machine.py --- a/gamelib/scenes/machine.py Tue Sep 07 17:05:51 2010 +0200 +++ b/gamelib/scenes/machine.py Tue Sep 07 18:13:35 2010 +0200 @@ -286,7 +286,7 @@ INVENTORY_IMAGE = "manual.png" CURSOR = None - def is_interactive(self): + def is_interactive(self, tool=None): return True def interact_without(self): diff -r 3e91c82c2240 -r 8f3c82c685a4 gamelib/scenes/manual.py --- a/gamelib/scenes/manual.py Tue Sep 07 17:05:51 2010 +0200 +++ b/gamelib/scenes/manual.py Tue Sep 07 18:13:35 2010 +0200 @@ -35,7 +35,7 @@ self.set_data('display', display) self.set_interact(display) - def is_interactive(self): + def is_interactive(self, tool=None): return self.get_data('display') == 'on' @@ -94,7 +94,7 @@ 'page': 0, } - def is_interactive(self): + def is_interactive(self, tool=None): return False def set_page(self, page): diff -r 3e91c82c2240 -r 8f3c82c685a4 gamelib/scenes/mess.py --- a/gamelib/scenes/mess.py Tue Sep 07 17:05:51 2010 +0200 +++ b/gamelib/scenes/mess.py Tue Sep 07 18:13:35 2010 +0200 @@ -248,7 +248,7 @@ HISS = get_sound('boomslang.ogg') - def is_interactive(self): + def is_interactive(self, tool=None): return False def animate(self): diff -r 3e91c82c2240 -r 8f3c82c685a4 gamelib/scenes/scene_widgets.py --- a/gamelib/scenes/scene_widgets.py Tue Sep 07 17:05:51 2010 +0200 +++ b/gamelib/scenes/scene_widgets.py Tue Sep 07 18:13:35 2010 +0200 @@ -146,7 +146,7 @@ def get_description(self): return self.description - def is_interactive(self): + def is_interactive(self, tool=None): return False @@ -160,7 +160,7 @@ self.NAME = self.SCENE + '.door' Thing.__init__(self) - def is_interactive(self): + def is_interactive(self, tool=None): return True def interact_without(self): @@ -199,7 +199,7 @@ else: return "The security camera is powered down" - def is_interactive(self): + def is_interactive(self, tool=None): return self.state.scenes['bridge'].get_data('ai status') == 'online' def interact_with_escher_poster(self, item): diff -r 3e91c82c2240 -r 8f3c82c685a4 gamelib/state.py --- a/gamelib/state.py Tue Sep 07 17:05:51 2010 +0200 +++ b/gamelib/state.py Tue Sep 07 18:13:35 2010 +0200 @@ -359,11 +359,11 @@ class InteractiveMixin(object): - def is_interactive(self): + def is_interactive(self, tool=None): return True def interact(self, tool): - if not self.is_interactive(): + if not self.is_interactive(tool): return None if tool is None: return self.interact_without() @@ -523,7 +523,9 @@ def get_inverse_interact(self, tool): return getattr(tool, 'interact_with_' + self.tool_name, None) - def is_interactive(self): + def is_interactive(self, tool=None): + if tool: + return True return False