comparison 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
comparison
equal deleted inserted replaced
225:c2660c045041 226:a5325919342e
15 'accessible': True, 15 'accessible': True,
16 } 16 }
17 17
18 def __init__(self, state): 18 def __init__(self, state):
19 super(Mess, self).__init__(state) 19 super(Mess, self).__init__(state)
20 self.add_item(TubeFragments("tube_fragments"))
21 self.add_item(ReplacementTubes("replacement_tubes"))
22 self.add_thing(CansOnShelf()) 20 self.add_thing(CansOnShelf())
23 self.add_thing(Tubes()) 21 self.add_thing(Tubes())
24 self.add_thing(ToMap()) 22 self.add_thing(ToMap())
25 23
26 24
44 "After emptying the full can." 42 "After emptying the full can."
45 43
46 INVENTORY_IMAGE = "empty_can.png" 44 INVENTORY_IMAGE = "empty_can.png"
47 CURSOR = CursorSprite('empty_can_cursor.png', 20, 30) 45 CURSOR = CursorSprite('empty_can_cursor.png', 20, 30)
48 46
49
50 def interact_with_titanium_leg(self, item, state): 47 def interact_with_titanium_leg(self, item, state):
51 return Result("Flattening the can doesn't look like a useful thing to do") 48 return Result("Flattening the can doesn't look like a useful thing to do")
52 49
53 50
54 class FullCan(BaseCan): 51 class FullCan(BaseCan):
70 INVENTORY_IMAGE = "dented_can.png" 67 INVENTORY_IMAGE = "dented_can.png"
71 CURSOR = CursorSprite('dented_can_cursor.png', 20, 30) 68 CURSOR = CursorSprite('dented_can_cursor.png', 20, 30)
72 69
73 def interact_with_titanium_leg(self, item, state): 70 def interact_with_titanium_leg(self, item, state):
74 return Result("You club the can with the femur. The dents shift around, but it still doesn't open.", soundfile="can_hit.ogg") 71 return Result("You club the can with the femur. The dents shift around, but it still doesn't open.", soundfile="can_hit.ogg")
75
76
77 class TubeFragments(Item):
78 "Old tubes that need repair."
79
80 INVENTORY_IMAGE = "tube_fragments.png"
81 CURSOR = CursorSprite('tube_fragments_cursor.png', 36, 3)
82
83
84 class ReplacementTubes(Item):
85 "Repaired tubes."
86
87 INVENTORY_IMAGE = "replacement_tubes.png"
88 CURSOR = CursorSprite('replacement_tubes.png', 53, 46)
89 72
90 73
91 class CansOnShelf(Thing): 74 class CansOnShelf(Thing):
92 75
93 NAME = "mess.cans" 76 NAME = "mess.cans"
135 "fixed": InteractImage(252, 183, "fixed_tubes.png"), 118 "fixed": InteractImage(252, 183, "fixed_tubes.png"),
136 } 119 }
137 120
138 INITIAL = "blocked" 121 INITIAL = "blocked"
139 122
123 INITIAL_DATA = {
124 "status": "blocked",
125 "pipes_replaced": 0,
126 "fixed": False,
127 }
128
129 def interact_with_machete(self, item):
130 if self.get_data("status") == "blocked":
131 self.set_data("status", "broken")
132 self.set_interact("broken")
133 return Result("With a flurry of disgusting mutant vegetable chunks,"
134 " you clear the overgrown broccoli away from the access"
135 " panel and reveal some broken tubes. They look important.")
136 elif self.get_data("status") == "broken":
137 return Result("It looks broken enough already.")
138 else:
139 return Return("After all that effort fixing it, chopping it to bits doesn't seem very smart.")
140
141 def interact_with_pipe(self, item):
142 if self.get_data("status") == "blocked":
143 return Result("It would get lost in the fronds.")
144 else:
145 self.data['pipes_replaced'] += 1
146 self.state.remove_inventory_item(item.name)
147 return Result({
148 1: "The pipe slots neatly into place, but doesn't make an airtight seal.",
149 2: "This pipe is a little looser than the first. It definitely needs to be taped up.",
150 3: "The final pipe fits snugly, but won't hold under pressure.",
151 }[self.get_data('pipes_replaced')])
152
153 def interact_with_duct_tape(self, item):
154 if self.get_data("status") == "broken":
155 return Result("It would get lost in the fronds.")
156 elif self.get_data("fixed"):
157 return Result("There's quite enough tape on the ducting already.")
158 elif self.get_data("pipes_replaced") < 3:
159 return Result("All the pipes need to be in place before they can be taped up.")
160 else:
161 self.set_data("fixed", True)
162 self.set_data("status", "fixed")
163 self.set_interact("fixed")
164 # TODO: A less anticlimactic climax?
165 return Result("It takes quite a lot of tape, but eventually everything is"
166 " airtight and ready to hold pressure. Who'd've thought duct"
167 " tape could actually be used to tape ducts?")
168
140 169
141 class ToMap(Thing): 170 class ToMap(Thing):
142 "Way to map." 171 "Way to map."
143 172
144 NAME = "mess.tomap" 173 NAME = "mess.tomap"