diff gamelib/scenes/mess.py @ 167:5845a3ed4dad

Inventory interaction can (surprisingly) affect the inventory
author Neil Muller <neil@dip.sun.ac.za>
date Wed, 25 Aug 2010 12:21:16 +0200
parents d00aa26941c4
children de249f7867fc
line wrap: on
line diff
--- a/gamelib/scenes/mess.py	Wed Aug 25 12:03:08 2010 +0200
+++ b/gamelib/scenes/mess.py	Wed Aug 25 12:21:16 2010 +0200
@@ -30,13 +30,23 @@
     INVENTORY_IMAGE = "empty_can.png"
     CURSOR = CursorSprite('empty_can_cursor.png', 47, 3)
 
-
 class FullCan(Item):
     "Found on the shelf."
 
     INVENTORY_IMAGE = "full_can.png"
     CURSOR = CursorSprite('full_can_cursor.png', 47, 3)
 
+    def interact_with_titanium_leg(self, tool, state):
+        state.replace_inventory_item(self, DentedCan("dented_can"))
+        return Result("You club the can with the femur. The can gets dented, but doesn't open.")
+
+
+class DentedCan(FullCan):
+    "A can banged on with the femur"
+
+    def interact_with_titanium_leg(self, tool, inventory):
+        return Result("You club the can with the femur. The dents shift around, but it still doesn't open.")
+
 
 class TubeFragments(Item):
     "Old tubes that need repair."