comparison gamelib/scenes/cryo.py @ 67:6b0f7364f3bf

Inventory-related game state.
author Jeremy Thurgood <firxen@gmail.com>
date Mon, 23 Aug 2010 20:18:29 +0200
parents 3087be3463e0
children 6bfebfbce42e
comparison
equal deleted inserted replaced
66:05346a412b55 67:6b0f7364f3bf
33 33
34 INVENTORY_IMAGE = "titanium_leg.png" 34 INVENTORY_IMAGE = "titanium_leg.png"
35 35
36 36
37 class CryoUnitAlpha(Thing): 37 class CryoUnitAlpha(Thing):
38 pass 38 "Cryo unit containing titanium leg."
39
40 FOLDER = "cryo"
41 IMAGE = "cryo_unit_alpha"
42
43 INITIAL_DATA = {
44 'contains_titanium_leg': True,
45 }
46
47 def interact_without(self):
48 self.message("The corpse in this cryo unit has a prosthetic leg made out of titanium. You take it.")
49 self.state.add_inventory_item('titanium_leg')
50 self.set_data('contains_titanium_leg', False)
51
52 def is_interactive(self):
53 return self.get_data('contains_titanium_leg')
39 54
40 55
41 class CryoRoomDoor(Thing): 56 class CryoRoomDoor(Thing):
42 "Door to the cryo room." 57 "Door to the cryo room."
43 58
66 return not self.get_data('open') 81 return not self.get_data('open')
67 82
68 def open_door(self): 83 def open_door(self):
69 self.set_data('open', True) 84 self.set_data('open', True)
70 self.state.scenes['bridge'].set_data('accessible', True) 85 self.state.scenes['bridge'].set_data('accessible', True)
86 self.state.remove_inventory_item('titanium_leg')
71 87
72 def get_description(self): 88 def get_description(self):
73 if self.get_data('open'): 89 if self.get_data('open'):
74 return 'An open doorway leads to the rest of the ship' 90 return 'An open doorway leads to the rest of the ship'
75 return 'A rusty door. It is currently closed' 91 return 'A rusty door. It is currently closed'