Mercurial > pyntnclick
comparison gamelib/scenes/machine.py @ 816:eed75a1d50c4 pyntnclick
Better Item handling.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sun, 27 Jan 2013 22:19:39 +0200 |
parents | bdaffaa8b6bf |
children |
comparison
equal
deleted
inserted
replaced
815:8f94fbf05ab9 | 816:eed75a1d50c4 |
---|---|
20 self.add_thing(LaserWelderSlot()) | 20 self.add_thing(LaserWelderSlot()) |
21 self.add_thing(LaserWelderButton()) | 21 self.add_thing(LaserWelderButton()) |
22 self.add_thing(LaserWelderPowerLights()) | 22 self.add_thing(LaserWelderPowerLights()) |
23 self.add_thing(Grinder()) | 23 self.add_thing(Grinder()) |
24 self.add_thing(ManualThing()) | 24 self.add_thing(ManualThing()) |
25 self.add_item(TitaniumMachete('machete')) | 25 self.add_item_factory(TitaniumMachete) |
26 self.add_item(CryoPipesOne('cryo_pipes_one')) | 26 self.add_item_factory(CryoPipesOne) |
27 self.add_item(CryoPipesTwo('cryo_pipes_two')) | 27 self.add_item_factory(CryoPipesTwo) |
28 self.add_item(CryoPipesThree('cryo_pipes_three')) | 28 self.add_item_factory(CryoPipesThree) |
29 self.add_item(Manual('manual')) | 29 self.add_item_factory(Manual) |
30 self.add_thing(GenericDescThing('machine.wires', 2, | 30 self.add_thing(GenericDescThing('machine.wires', 2, |
31 _("Wires run to all the machines in the room"), | 31 _("Wires run to all the machines in the room"), |
32 ( | 32 ( |
33 (250, 172, 252, 12), | 33 (250, 172, 252, 12), |
34 (388, 183, 114, 13), | 34 (388, 183, 114, 13), |
179 return Result(_("The laser welder needs something to weld the" | 179 return Result(_("The laser welder needs something to weld the" |
180 " tube fragments to.")) | 180 " tube fragments to.")) |
181 else: | 181 else: |
182 welder_slot.set_data("contents", []) | 182 welder_slot.set_data("contents", []) |
183 welder_slot.set_interact() | 183 welder_slot.set_interact() |
184 if self.game.is_in_inventory("cryo_pipes_one"): | 184 if self.game.is_in_inventory("cryo_pipes_one:"): |
185 self.game.replace_inventory_item("cryo_pipes_one", | 185 self.game.replace_inventory_item("cryo_pipes_one:", |
186 "cryo_pipes_two") | 186 "cryo_pipes_two") |
187 return Result(_("With high-precision spitzensparken, you weld" | 187 return Result(_("With high-precision spitzensparken, you weld" |
188 " together a second pipe. You bundle the two" | 188 " together a second pipe. You bundle the two" |
189 " pipes together."), soundfile='laser.ogg') | 189 " pipes together."), soundfile='laser.ogg') |
190 elif self.game.is_in_inventory("cryo_pipes_two"): | 190 elif self.game.is_in_inventory("cryo_pipes_two:"): |
191 self.game.replace_inventory_item("cryo_pipes_two", | 191 self.game.replace_inventory_item("cryo_pipes_two:", |
192 "cryo_pipes_three") | 192 "cryo_pipes_three") |
193 return Result(_("With high-precision spitzensparken, you" | 193 return Result(_("With high-precision spitzensparken, you" |
194 " create yet another pipe. You store it with" | 194 " create yet another pipe. You store it with" |
195 " the other two."), soundfile='laser.ogg') | 195 " the other two."), soundfile='laser.ogg') |
196 elif self.game.is_in_inventory("cryo_pipes_three"): | 196 elif self.game.is_in_inventory("cryo_pipes_three:"): |
197 # just for safety | 197 # just for safety |
198 return None | 198 return None |
199 else: | 199 else: |
200 self.game.add_inventory_item("cryo_pipes_one") | 200 self.game.add_inventory_item("cryo_pipes_one") |
201 return Result(_("With high-precision spitzensparken, the can" | 201 return Result(_("With high-precision spitzensparken, the can" |
221 | 221 |
222 | 222 |
223 class CryoPipesOne(Item): | 223 class CryoPipesOne(Item): |
224 "A single cryo pipe (made from a tube fragment and can)." | 224 "A single cryo pipe (made from a tube fragment and can)." |
225 | 225 |
226 NAME = 'cryo_pipes_one' | |
226 INVENTORY_IMAGE = "cryo_pipes_one.png" | 227 INVENTORY_IMAGE = "cryo_pipes_one.png" |
227 CURSOR = CursorSprite('cryo_pipes_one_cursor.png') | 228 CURSOR = CursorSprite('cryo_pipes_one_cursor.png') |
228 TOOL_NAME = "cryo_pipes_one" | 229 TOOL_NAME = "cryo_pipes_one" |
229 | 230 |
230 | 231 |
231 class CryoPipesTwo(Item): | 232 class CryoPipesTwo(Item): |
232 "Two cryo pipes (each made from a tube fragment and can)." | 233 "Two cryo pipes (each made from a tube fragment and can)." |
233 | 234 |
235 NAME = 'cryo_pipes_two' | |
234 INVENTORY_IMAGE = "cryo_pipes_two.png" | 236 INVENTORY_IMAGE = "cryo_pipes_two.png" |
235 CURSOR = CursorSprite('cryo_pipes_two_cursor.png') | 237 CURSOR = CursorSprite('cryo_pipes_two_cursor.png') |
236 TOOL_NAME = "cryo_pipes_two" | 238 TOOL_NAME = "cryo_pipes_two" |
237 | 239 |
238 | 240 |
239 class CryoPipesThree(Item): | 241 class CryoPipesThree(Item): |
240 "Three cryo pipes (each made from a tube fragment and can)." | 242 "Three cryo pipes (each made from a tube fragment and can)." |
241 | 243 |
244 NAME = 'cryo_pipes_three' | |
242 INVENTORY_IMAGE = "cryo_pipes_three.png" | 245 INVENTORY_IMAGE = "cryo_pipes_three.png" |
243 CURSOR = CursorSprite('cryo_pipes_three_cursor.png') | 246 CURSOR = CursorSprite('cryo_pipes_three_cursor.png') |
244 TOOL_NAME = "cryo_pipes_three" | 247 TOOL_NAME = "cryo_pipes_three" |
245 | 248 |
246 | 249 |
271 | 274 |
272 | 275 |
273 class TitaniumMachete(Item): | 276 class TitaniumMachete(Item): |
274 "Titanium machete, formerly a leg." | 277 "Titanium machete, formerly a leg." |
275 | 278 |
279 NAME = 'machete' | |
276 INVENTORY_IMAGE = "machete.png" | 280 INVENTORY_IMAGE = "machete.png" |
277 CURSOR = CursorSprite('machete_cursor.png', 23, 1) | 281 CURSOR = CursorSprite('machete_cursor.png', 23, 1) |
278 | 282 |
279 | 283 |
280 class ManualThing(TakeableThing): | 284 class ManualThing(TakeableThing): |
296 | 300 |
297 | 301 |
298 class Manual(Item): | 302 class Manual(Item): |
299 "A ship instruction manual." | 303 "A ship instruction manual." |
300 | 304 |
305 NAME = 'manual' | |
301 INVENTORY_IMAGE = "manual.png" | 306 INVENTORY_IMAGE = "manual.png" |
302 CURSOR = None | 307 CURSOR = None |
303 | 308 |
304 def is_interactive(self, tool=None): | 309 def is_interactive(self, tool=None): |
305 return True | 310 return True |