# HG changeset patch # User Neil Muller # Date 1282951731 -7200 # Node ID bd9a760eeb18ddb5cfed09a9b22788dd7385e915 # Parent 75783238f73d2ad056dea87fbf9ff0c4237397ae Hook up canopener. Fix for replace_inventory changes diff -r 75783238f73d -r bd9a760eeb18 gamelib/scenes/machine.py --- a/gamelib/scenes/machine.py Sat Aug 28 01:28:25 2010 +0200 +++ b/gamelib/scenes/machine.py Sat Aug 28 01:28:51 2010 +0200 @@ -117,9 +117,6 @@ return Result("With high-precision spitzensparken, the cans are welded into a replacement tube.", soundfile='laser.ogg') - def interact_with_dented_can(self, item): - return self.interact_with_empty_can(item) - def interact_with_empty_can(self, item): starting_cans = self.get_data('cans_in_place') if starting_cans < 3: @@ -184,7 +181,7 @@ return Result("It looks like it eats fingers. Perhaps a different approach is in order?") def interact_with_titanium_leg(self, item): - self.state.replace_inventory_item(item, self.state.items['machete']) + self.state.replace_inventory_item(item.name, 'machete') return Result("After much delicate grinding and a few close calls with" " various body parts, the titanium femur now resembles" " a machete more than a bone. Nice and sharp, too.", diff -r 75783238f73d -r bd9a760eeb18 gamelib/scenes/mess.py --- a/gamelib/scenes/mess.py Sat Aug 28 01:28:25 2010 +0200 +++ b/gamelib/scenes/mess.py Sat Aug 28 01:28:51 2010 +0200 @@ -57,6 +57,12 @@ def interact_with_machete(self, item, state): return Result("You'd mangle it beyond usefulness.") + def interact_with_canopener(self, item, state): + empty = EmptyCan('empty_can') + state.add_item(empty) + state.replace_inventory_item(self.name, empty.name) + return Result("You open both ends of the can, discarding the hideous contents.") + class EmptyCan(BaseCan): "After emptying the full can." @@ -67,6 +73,9 @@ def interact_with_titanium_leg(self, item, state): return Result("Flattening the can doesn't look like a useful thing to do.") + def interact_with_canopener(self, item, state): + return Result("There's nothing left to open on this can") + class FullCan(BaseCan): "Found on the shelf." @@ -77,7 +86,7 @@ def interact_with_titanium_leg(self, item, state): dented = DentedCan("dented_can") state.add_item(dented) - state.replace_inventory_item(self, dented) + state.replace_inventory_item(self.name, dented.name) return Result("You club the can with the femur. The can gets dented, but doesn't open.", soundfile="can_hit.ogg")