changeset 221:bcb7b2093118

Tweak cans
author Neil Muller <neil@dip.sun.ac.za>
date Thu, 26 Aug 2010 21:35:01 +0200
parents 15a86dba9df0
children b03debaec72d
files gamelib/scenes/mess.py
diffstat 1 files changed, 18 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/scenes/mess.py	Thu Aug 26 21:00:09 2010 +0200
+++ b/gamelib/scenes/mess.py	Thu Aug 26 21:35:01 2010 +0200
@@ -24,11 +24,8 @@
         self.add_thing(ToMap())
 
 
-class EmptyCan(CloneableItem):
-    "After emptying the full can."
-
-    INVENTORY_IMAGE = "empty_can.png"
-    CURSOR = CursorSprite('empty_can_cursor.png', 20, 30)
+class BaseCan(CloneableItem):
+    """Base class for the cans"""
 
     def interact_with_full_can(self, item, state):
         return Result("You bang the cans togther. It sounds like two cans being banged togther.", soundfile="can_hit.ogg")
@@ -39,8 +36,22 @@
     def interact_with_empty_can(self, item, state):
         return self.interact_with_full_can(item, state)
 
+    def interact_with_machete(self, item, state):
+        return Result("You'd managle it beyond usefulness")
 
-class FullCan(CloneableItem):
+
+class EmptyCan(BaseCan):
+    "After emptying the full can."
+
+    INVENTORY_IMAGE = "empty_can.png"
+    CURSOR = CursorSprite('empty_can_cursor.png', 20, 30)
+
+
+    def interact_with_titanium_leg(self, item, state):
+        return Result("Flattening the can doesn't look like a useful thing to do")
+
+
+class FullCan(BaseCan):
     "Found on the shelf."
 
     INVENTORY_IMAGE = "full_can.png"
@@ -52,17 +63,8 @@
         state.replace_inventory_item(self, dented)
         return Result("You club the can with the femur. The can gets dented, but doesn't open.", soundfile="can_hit.ogg")
 
-    def interact_with_full_can(self, item, state):
-        return Result("You bang the cans togther. It sounds like two cans being banged togther.", soundfile="can_hit.ogg")
 
-    def interact_with_dented_can(self, item, state):
-        return self.interact_with_full_can(item, state)
-
-    def interact_with_empty_can(self, item, state):
-        return self.interact_with_full_can(item, state)
-
-
-class DentedCan(CloneableItem):
+class DentedCan(BaseCan):
     "A can banged on with the femur"
 
     INVENTORY_IMAGE = "dented_can.png"
@@ -71,15 +73,6 @@
     def interact_with_titanium_leg(self, item, state):
         return Result("You club the can with the femur. The dents shift around, but it still doesn't open.", soundfile="can_hit.ogg")
 
-    def interact_with_full_can(self, item, state):
-        return Result("You bang the cans togther. It sounds like two cans being banged togther.", soundfile="can_hit.ogg")
-
-    def interact_with_dented_can(self, item, state):
-        return self.interact_with_full_can(item, state)
-
-    def interact_with_empty_can(self, item, state):
-        return self.interact_with_full_can(item, state)
-
 
 class TubeFragments(Item):
     "Old tubes that need repair."