Mercurial > boomslang
diff gamelib/scenes/cryo.py @ 219:326300c218a6
Choppable cryopipes and can refactoring.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Thu, 26 Aug 2010 20:53:19 +0200 |
parents | 6ad6575b501c |
children | 8d8aef45db4e |
line wrap: on
line diff
--- a/gamelib/scenes/cryo.py Thu Aug 26 20:34:57 2010 +0200 +++ b/gamelib/scenes/cryo.py Thu Aug 26 20:53:19 2010 +0200 @@ -6,7 +6,7 @@ from gamelib import speech from gamelib.sound import get_sound from gamelib.cursor import CursorSprite -from gamelib.state import Scene, Item, Thing, Result, \ +from gamelib.state import Scene, Item, CloneableItem, Thing, Result, \ InteractImage, InteractNoImage, InteractRectUnion, \ InteractAnimated from gamelib.statehelpers import GenericDescThing @@ -40,6 +40,8 @@ self.add_thing(CryoUnitAlpha()) self.add_thing(CryoRoomDoor()) self.add_thing(CryoComputer()) + self.add_thing(CryoPipeLeft()) + self.add_thing(CryoPipeRight()) # Flavour items # pipes @@ -151,6 +153,53 @@ change_playlist(None) +class CryoPipeBase(Thing): + "Base class for cryo pipes that need to be stolen." + + INITIAL = "fixed" + + INITIAL_DATA = { + 'fixed': True, + } + + def interact_with_machete(self, item): + self.set_data('fixed', False) + pipe = CryoPipe('cryopipe') + self.state.add_item(pipe) + self.state.add_inventory_item(pipe.name) + self.set_interact("chopped") + + def is_interactive(self): + return self.get_data('fixed') + + +class CryoPipe(CloneableItem): + "After emptying the full can." + + INVENTORY_IMAGE = "triangle.png" + CURSOR = CursorSprite('triangle.png', 20, 30) + + +class CryoPipeLeft(CryoPipeBase): + "Left cryo pipe." + + NAME = "cryo.pipe.left" + INTERACTS = { + "fixed": InteractNoImage(125, 192, 27, 258), + "chopped": InteractImage(125, 192, "triangle.png"), + } + + +class CryoPipeRight(CryoPipeBase): + "Left cryo pipe." + + NAME = "cryo.pipe.right" + INTERACTS = { + "fixed": InteractNoImage(643, 199, 38, 233), + "chopped": InteractImage(643, 199, "triangle.png"), + } + + class TitaniumLeg(Item): "Titanium leg, found on a piratical corpse."