comparison gamelib/scenes/map.py @ 466:af2a23b9787d

You can now use doors while wielding things.
author Jeremy Thurgood <firxen@gmail.com>
date Sun, 29 Aug 2010 01:43:55 +0200
parents b1e38ac3abb1
children a9925aaf5f61 821b322e903b
comparison
equal deleted inserted replaced
465:03dcb25d8370 466:af2a23b9787d
19 19
20 FOLDER = "map" 20 FOLDER = "map"
21 BACKGROUND = 'map.png' 21 BACKGROUND = 'map.png'
22 22
23 INITIAL_DATA = { 23 INITIAL_DATA = {
24 'accessible': True,
25 'implant': True, 24 'implant': True,
26 } 25 }
27 26
28 def __init__(self, state): 27 def __init__(self, state):
29 super(Map, self).__init__(state) 28 super(Map, self).__init__(state)
54 class DoorThing(Thing): 53 class DoorThing(Thing):
55 54
56 # name of destination 55 # name of destination
57 DEST = None 56 DEST = None
58 57
59 def interact_without(self): 58 def interact(self, _item):
60 """Go to destination.""" 59 """Go to destination."""
61 if self.DEST in self.state.scenes: 60 if self.DEST in self.state.scenes:
62 if self.state.scenes[self.DEST].get_data('accessible'): 61 self.state.set_current_scene(self.DEST)
63 self.state.set_current_scene(self.DEST)
64 return Result()
65 else:
66 return Result("You can't go there right now.")
67 else:
68 return Result("You *could* go there, but it doesn't actually exist.")
69 62
70 63
71 class ToCryo(DoorThing): 64 class ToCryo(DoorThing):
72 "Way to cryo room." 65 "Way to cryo room."
73 66
129 )) 122 ))
130 } 123 }
131 124
132 INITIAL = 'door' 125 INITIAL = 'door'
133 126
134 def interact_without(self): 127 def interact(self, item):
135 if not self.state.is_in_inventory('helmet'): 128 if not self.state.is_in_inventory('helmet'):
136 return Result('The airlock refuses to open. The automated' 129 return Result('The airlock refuses to open. The automated'
137 ' voice says: "Hull breach beyond this door. Personnel' 130 ' voice says: "Hull breach beyond this door. Personnel'
138 ' must be equipped for vacuum before entry."') 131 ' must be equipped for vacuum before entry."')
139 else: 132 else:
140 return super(ToEngine, self).interact_without() 133 return super(ToEngine, self).interact(item)
141 134
142 135
143 class ToMachine(DoorThing): 136 class ToMachine(DoorThing):
144 "Way to machine room." 137 "Way to machine room."
145 138
185 )) 178 ))
186 } 179 }
187 180
188 INITIAL = 'areas' 181 INITIAL = 'areas'
189 182
190 def interact_without(self): 183 def interact(self, _item):
191 return Result("You look in the door, but just see empty space: " 184 return Result("You look in the door, but just see empty space: "
192 "that room appears to have been obliterated by meteors.") 185 "that room appears to have been obliterated by meteors.")
193 186
194 187
195 class HydroponicsArea(Thing): 188 class HydroponicsArea(Thing):
202 )) 195 ))
203 } 196 }
204 197
205 INITIAL = 'areas' 198 INITIAL = 'areas'
206 199
207 def interact_without(self): 200 def interact(self, _item):
208 return Result("Peering in through the window, you see that the entire " 201 return Result("Peering in through the window, you see that the entire "
209 "chamber is overgrown with giant broccoli. It would " 202 "chamber is overgrown with giant broccoli. It would "
210 "take you years to cut a path through that.") 203 "take you years to cut a path through that.")
211 204
212 205