comparison gamelib/scenes/cryo.py @ 120:48d24a48d0ce

Enter and leave hooks
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 24 Aug 2010 17:24:54 +0200
parents d5f7cccfdb6c
children d3ca34a664fd
comparison
equal deleted inserted replaced
119:d5f7cccfdb6c 120:48d24a48d0ce
13 FOLDER = "cryo" 13 FOLDER = "cryo"
14 BACKGROUND = "cryo_room.png" 14 BACKGROUND = "cryo_room.png"
15 15
16 INITIAL_DATA = { 16 INITIAL_DATA = {
17 'accessible': True, 17 'accessible': True,
18 'greet' : True
18 } 19 }
19 20
20 def __init__(self, state): 21 def __init__(self, state):
21 super(Cryo, self).__init__(state) 22 super(Cryo, self).__init__(state)
22 self.add_item(Triangle("triangle")) 23 self.add_item(Triangle("triangle"))
23 self.add_item(TitaniumLeg("titanium_leg")) 24 self.add_item(TitaniumLeg("titanium_leg"))
24 self.add_thing(CryoUnitAlpha()) 25 self.add_thing(CryoUnitAlpha())
25 self.add_thing(CryoRoomDoor()) 26 self.add_thing(CryoRoomDoor())
26 self.add_thing(CryoComputer()) 27 self.add_thing(CryoComputer())
27 28
29 def enter(self):
30 if self.get_data('greet'):
31 self.set_data('greet', False)
32 return Result("Greetings Prisoner id. You have woken early under"
33 " the terms of the emergency conscription act to help with"
34 " repairs to the ship. Your behaviour during this time will"
35 " be added to your record and will be relayed to "
36 " prison officials when we reach the destination."
37 " Please report to the bridge.")
28 38
29 class Triangle(Item): 39 class Triangle(Item):
30 "Test item. Needs to go away at some point." 40 "Test item. Needs to go away at some point."
31 41
32 INVENTORY_IMAGE = "triangle.png" 42 INVENTORY_IMAGE = "triangle.png"