Mercurial > pyntnclick
comparison gamelib/scenes/machine.py @ 539:11530992924a
PEP8 clean-up for engine, machine and mess.
author | Simon Cross <hodgestar+bzr@gmail.com> |
---|---|
date | Sat, 11 Feb 2012 12:20:12 +0200 |
parents | 0ce08d5e2acb |
children | 098ea4ea0d0d |
comparison
equal
deleted
inserted
replaced
538:d1b86d5849a0 | 539:11530992924a |
---|---|
67 (510, 360, 13, 11), | 67 (510, 360, 13, 11), |
68 (532, 331, 14, 11), | 68 (532, 331, 14, 11), |
69 (605, 304, 26, 8), | 69 (605, 304, 26, 8), |
70 ))) | 70 ))) |
71 self.add_thing(GenericDescThing("machine.drill_press_block", 7, | 71 self.add_thing(GenericDescThing("machine.drill_press_block", 7, |
72 "The block for the laser drill press", # TODO: fix description | 72 "The block for the laser drill press", # TODO: fix description |
73 ((461, 446, 38, 27),))) | 73 ((461, 446, 38, 27),))) |
74 | 74 |
75 | 75 |
76 class ToMap(Door): | 76 class ToMap(Door): |
77 | 77 |
131 if "tube" in contents: | 131 if "tube" in contents: |
132 return Result("There is already a tube fragment in the welder.") | 132 return Result("There is already a tube fragment in the welder.") |
133 self.state.remove_inventory_item(item.name) | 133 self.state.remove_inventory_item(item.name) |
134 contents.add("tube") | 134 contents.add("tube") |
135 self.update_contents() | 135 self.update_contents() |
136 return Result("You carefully place the tube fragments in the laser welder.") | 136 return Result("You carefully place the tube fragments in the" |
137 " laser welder.") | |
137 | 138 |
138 def get_description(self): | 139 def get_description(self): |
139 contents = self.get_data('contents') | 140 contents = self.get_data('contents') |
140 if not contents: | 141 if not contents: |
141 return "This is a Smith and Wesson 'zOMG' class high-precision laser welder." | 142 return ("This is a Smith and Wesson 'zOMG' class high-precision" |
143 " laser welder.") | |
142 if len(contents) == 1: | 144 if len(contents) == 1: |
143 msg = "The laser welder looks hungry, somehow." | 145 msg = "The laser welder looks hungry, somehow." |
144 if "can" in contents: | 146 if "can" in contents: |
145 msg += " It currently contains an empty can." | 147 msg += " It currently contains an empty can." |
146 elif "tube" in contents: | 148 elif "tube" in contents: |
147 msg += " It currently contains a tube fragment." | 149 msg += " It currently contains a tube fragment." |
148 elif len(contents) == 2: | 150 elif len(contents) == 2: |
149 msg = "The laser welder looks expectant. " | 151 msg = "The laser welder looks expectant. " |
150 if "can" in contents and "tube" in contents: | 152 if "can" in contents and "tube" in contents: |
151 msg += " It currently contains an empty can and a tube fragment." | 153 msg += (" It currently contains an empty can and a" |
154 " tube fragment.") | |
152 return msg | 155 return msg |
153 | 156 |
154 | 157 |
155 class LaserWelderButton(Thing): | 158 class LaserWelderButton(Thing): |
156 | 159 |
161 } | 164 } |
162 | 165 |
163 INITIAL = "button" | 166 INITIAL = "button" |
164 | 167 |
165 def interact_without(self): | 168 def interact_without(self): |
166 contents = self.scene.things["machine.welder.slot"].get_data("contents") | 169 welder_slot = self.scene.things["machine.welder.slot"] |
170 contents = welder_slot.get_data("contents") | |
167 if not contents: | 171 if not contents: |
168 return Result("The laser welder doesn't currently contain anything weldable.") | 172 return Result("The laser welder doesn't currently contain" |
173 " anything weldable.") | |
169 elif len(contents) == 1: | 174 elif len(contents) == 1: |
170 if "can" in contents: | 175 if "can" in contents: |
171 return Result("The laser welder needs something to weld the can to.") | 176 return Result("The laser welder needs something to weld the" |
177 " can to.") | |
172 elif "tube" in contents: | 178 elif "tube" in contents: |
173 return Result("The laser welder needs something to weld the tube fragments to.") | 179 return Result("The laser welder needs something to weld the" |
180 " tube fragments to.") | |
174 else: | 181 else: |
175 self.scene.things["machine.welder.slot"].set_data("contents", set()) | 182 welder_slot.set_data("contents", set()) |
176 self.scene.things["machine.welder.slot"].update_contents() | 183 welder_slot.update_contents() |
177 if self.state.items["cryo_pipes_one"] in self.state.inventory: | 184 if self.state.items["cryo_pipes_one"] in self.state.inventory: |
178 self.state.replace_inventory_item("cryo_pipes_one", "cryo_pipes_two") | 185 self.state.replace_inventory_item("cryo_pipes_one", |
186 "cryo_pipes_two") | |
179 return Result("With high-precision spitzensparken, you weld" | 187 return Result("With high-precision spitzensparken, you weld" |
180 " together a second pipe. You bundle the two pipes together.", | 188 " together a second pipe. You bundle the two" |
189 " pipes together.", | |
181 soundfile='laser.ogg') | 190 soundfile='laser.ogg') |
182 elif self.state.items["cryo_pipes_two"] in self.state.inventory: | 191 elif self.state.items["cryo_pipes_two"] in self.state.inventory: |
183 self.state.replace_inventory_item("cryo_pipes_two", "cryo_pipes_three") | 192 self.state.replace_inventory_item("cryo_pipes_two", |
184 return Result("With high-precision spitzensparken, you create yet" | 193 "cryo_pipes_three") |
185 " another pipe. You store it with the other two.", | 194 return Result("With high-precision spitzensparken, you create" |
195 " yet another pipe. You store it with the other" | |
196 " two.", | |
186 soundfile='laser.ogg') | 197 soundfile='laser.ogg') |
187 elif self.state.items["cryo_pipes_three"] in self.state.inventory: | 198 elif self.state.items["cryo_pipes_three"] in self.state.inventory: |
188 # just for safety | 199 # just for safety |
189 return None | 200 return None |
190 else: | 201 else: |
191 self.state.add_inventory_item("cryo_pipes_one") | 202 self.state.add_inventory_item("cryo_pipes_one") |
192 return Result("With high-precision spitzensparken, the can and tube are welded" | 203 return Result("With high-precision spitzensparken, the can and" |
193 " into a whole greater than the sum of the parts.", | 204 " tube are welded into a whole greater than the" |
205 " sum of the parts.", | |
194 soundfile='laser.ogg') | 206 soundfile='laser.ogg') |
195 | 207 |
196 | 208 |
197 class LaserWelderPowerLights(Thing): | 209 class LaserWelderPowerLights(Thing): |
198 | 210 |
199 NAME = "machine.welder.lights" | 211 NAME = "machine.welder.lights" |
200 | 212 |
201 INTERACTS = { | 213 INTERACTS = { |
202 "lights": InteractAnimated(199, 273, ["power_lights_%d.png" % i for i in range(8) + range(6,0,-1)], 10) | 214 "lights": InteractAnimated(199, 273, ["power_lights_%d.png" % i for i |
215 in range(8) + range(6, 0, -1)], | |
216 10), | |
203 } | 217 } |
204 | 218 |
205 INITIAL = 'lights' | 219 INITIAL = 'lights' |
206 | 220 |
207 def get_description(self): | 221 def get_description(self): |
241 } | 255 } |
242 | 256 |
243 INITIAL = "grind" | 257 INITIAL = "grind" |
244 | 258 |
245 def interact_without(self): | 259 def interact_without(self): |
246 return Result("It looks like it eats fingers. Perhaps a different approach is in order?") | 260 return Result("It looks like it eats fingers. Perhaps a different" |
261 " approach is in order?") | |
247 | 262 |
248 def interact_with_titanium_leg(self, item): | 263 def interact_with_titanium_leg(self, item): |
249 self.state.replace_inventory_item(item.name, 'machete') | 264 self.state.replace_inventory_item(item.name, 'machete') |
250 return Result("After much delicate grinding and a few close calls with" | 265 return Result("After much delicate grinding and a few close calls with" |
251 " various body parts, the titanium femur now resembles" | 266 " various body parts, the titanium femur now resembles" |