diff gamelib/scenes/mess.py @ 226:a5325919342e

Tubes, pipes and ducts.
author Jeremy Thurgood <firxen@gmail.com>
date Thu, 26 Aug 2010 22:48:03 +0200
parents 8d8aef45db4e
children ce1e85768f7b
line wrap: on
line diff
--- a/gamelib/scenes/mess.py	Thu Aug 26 22:38:17 2010 +0200
+++ b/gamelib/scenes/mess.py	Thu Aug 26 22:48:03 2010 +0200
@@ -17,8 +17,6 @@
 
     def __init__(self, state):
         super(Mess, self).__init__(state)
-        self.add_item(TubeFragments("tube_fragments"))
-        self.add_item(ReplacementTubes("replacement_tubes"))
         self.add_thing(CansOnShelf())
         self.add_thing(Tubes())
         self.add_thing(ToMap())
@@ -46,7 +44,6 @@
     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")
 
@@ -74,20 +71,6 @@
         return Result("You club the can with the femur. The dents shift around, but it still doesn't open.", soundfile="can_hit.ogg")
 
 
-class TubeFragments(Item):
-    "Old tubes that need repair."
-
-    INVENTORY_IMAGE = "tube_fragments.png"
-    CURSOR = CursorSprite('tube_fragments_cursor.png', 36, 3)
-
-
-class ReplacementTubes(Item):
-    "Repaired tubes."
-
-    INVENTORY_IMAGE = "replacement_tubes.png"
-    CURSOR = CursorSprite('replacement_tubes.png', 53, 46)
-
-
 class CansOnShelf(Thing):
 
     NAME = "mess.cans"
@@ -137,6 +120,52 @@
 
     INITIAL = "blocked"
 
+    INITIAL_DATA = {
+        "status": "blocked",
+        "pipes_replaced": 0,
+        "fixed": False,
+        }
+
+    def interact_with_machete(self, item):
+        if self.get_data("status") == "blocked":
+            self.set_data("status", "broken")
+            self.set_interact("broken")
+            return Result("With a flurry of disgusting mutant vegetable chunks,"
+                          " you clear the overgrown broccoli away from the access"
+                          " panel and reveal some broken tubes. They look important.")
+        elif self.get_data("status") == "broken":
+            return Result("It looks broken enough already.")
+        else:
+            return Return("After all that effort fixing it, chopping it to bits doesn't seem very smart.")
+
+    def interact_with_pipe(self, item):
+        if self.get_data("status") == "blocked":
+            return Result("It would get lost in the fronds.")
+        else:
+            self.data['pipes_replaced'] += 1
+            self.state.remove_inventory_item(item.name)
+            return Result({
+                    1: "The pipe slots neatly into place, but doesn't make an airtight seal.",
+                    2: "This pipe is a little looser than the first. It definitely needs to be taped up.",
+                    3: "The final pipe fits snugly, but won't hold under pressure.",
+                    }[self.get_data('pipes_replaced')])
+
+    def interact_with_duct_tape(self, item):
+        if self.get_data("status") == "broken":
+            return Result("It would get lost in the fronds.")
+        elif self.get_data("fixed"):
+            return Result("There's quite enough tape on the ducting already.")
+        elif self.get_data("pipes_replaced") < 3:
+            return Result("All the pipes need to be in place before they can be taped up.")
+        else:
+            self.set_data("fixed", True)
+            self.set_data("status", "fixed")
+            self.set_interact("fixed")
+            # TODO: A less anticlimactic climax?
+            return Result("It takes quite a lot of tape, but eventually everything is"
+                          " airtight and ready to hold pressure. Who'd've thought duct"
+                          " tape could actually be used to tape ducts?")
+
 
 class ToMap(Thing):
     "Way to map."