Mercurial > boomslang
annotate gamelib/scenes/map.py @ 217:146cec58ddd8
Highlight detailed view close button
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Thu, 26 Aug 2010 20:26:41 +0200 |
parents | 2b820b4ba3bf |
children | 8d8aef45db4e |
rev | line source |
---|---|
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
1 """Neurally implanted schematic for moving around on the ship. |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
2 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
3 It is illegal for prisoners in transit to activate such an |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
4 implant. Failure to comply carries a minimum sentence of |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
5 six months. |
51 | 6 |
7 Many parts of the ship are derelict and inaccessible. | |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
8 """ |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
9 |
131 | 10 from gamelib.state import Scene, Item, Thing, InteractText, Result |
212
2b820b4ba3bf
Add constant for player id. Make IDs uppercase
Neil Muller <neil@dip.sun.ac.za>
parents:
210
diff
changeset
|
11 from gamelib.scenes.game_constants import PLAYER_ID |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
12 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
13 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
14 class Map(Scene): |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
15 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
16 FOLDER = "map" |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
17 BACKGROUND = None # TODO |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
18 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
19 INITIAL_DATA = { |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
20 'accessible': True, |
203 | 21 'implant': True, |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
22 } |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
23 |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
24 def __init__(self, state): |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
25 super(Map, self).__init__(state) |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
26 self.add_thing(ToCryo()) |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
27 self.add_thing(ToBridge()) |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
28 self.add_thing(ToMess()) |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
29 self.add_thing(ToEngine()) |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
30 self.add_thing(ToMachine()) |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
31 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
32 def enter(self): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
33 for door_thing in self.things.values(): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
34 door_thing.check_dest() |
203 | 35 if self.get_data('implant'): |
36 self.set_data('implant', False) | |
37 return (Result( | |
38 "JIM say 'Under the terms of the emergency conscription " | |
39 "act, I have downloaded the ship schematics to your " | |
40 "neural implant to help you navigate around the ship. " | |
210
eb101b6fb3dd
Transparent message dialogs.
Jeremy Thurgood <firxen@gmail.com>
parents:
203
diff
changeset
|
41 "Please report to the bridge.'", style="JIM"), |
203 | 42 Result( |
212
2b820b4ba3bf
Add constant for player id. Make IDs uppercase
Neil Muller <neil@dip.sun.ac.za>
parents:
210
diff
changeset
|
43 "JIM continues 'Prisoner %s. You are classed " |
203 | 44 "as a class 1 felon. Obtaining access to the ship shematics " |
45 "consitutes a level 2 offence and carries a minimal penalty " | |
212
2b820b4ba3bf
Add constant for player id. Make IDs uppercase
Neil Muller <neil@dip.sun.ac.za>
parents:
210
diff
changeset
|
46 "of an additional 3 years on you sentence.'" % PLAYER_ID, |
2b820b4ba3bf
Add constant for player id. Make IDs uppercase
Neil Muller <neil@dip.sun.ac.za>
parents:
210
diff
changeset
|
47 style="JIM")) |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
48 |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
49 |
131 | 50 class DoorThing(Thing): |
51 | |
52 # name of destination | |
53 DEST = None | |
54 | |
55 def interact_without(self): | |
56 """Go to destination.""" | |
57 if self.DEST in self.state.scenes: | |
133
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
58 if self.state.scenes[self.DEST].get_data('accessible'): |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
59 self.state.set_current_scene(self.DEST) |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
60 return Result() |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
61 else: |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
62 return Result("You can't go there right now.") |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
63 else: |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
64 return Result("You *could* go there, but it doesn't actually exist.") |
131 | 65 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
66 def check_dest(self): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
67 if self.DEST in self.state.scenes: |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
68 if self.state.scenes[self.DEST].get_data('accessible'): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
69 self.set_interact('accessible') |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
70 else: |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
71 self.set_interact('inaccessible') |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
72 |
131 | 73 |
74 class ToCryo(DoorThing): | |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
75 "Way to cryo room." |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
76 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
77 NAME = "map.tocryo" |
131 | 78 DEST = "cryo" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
79 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
80 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
81 "inaccessible": InteractText(100, 200, "To Cryo"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
82 "accessible": InteractText(100, 200, "To Cryo", (0, 127, 0)), |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
83 } |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
84 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
85 INITIAL = "inaccessible" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
86 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
87 |
131 | 88 class ToBridge(DoorThing): |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
89 "Way to bridge room." |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
90 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
91 NAME = "map.tobridge" |
131 | 92 DEST = "bridge" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
93 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
94 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
95 "inaccessible": InteractText(300, 200, "To Bridge"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
96 "accessible": InteractText(300, 200, "To Bridge", (0, 127, 0)), |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
97 } |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
98 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
99 INITIAL = "inaccessible" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
100 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
101 |
131 | 102 class ToMess(DoorThing): |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
103 "Way to cryo room." |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
104 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
105 NAME = "map.tomess" |
131 | 106 DEST = "mess" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
107 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
108 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
109 "inaccessible": InteractText(100, 300, "To Mess"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
110 "accessible": InteractText(100, 300, "To Mess", (0, 127, 0)), |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
111 } |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
112 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
113 INITIAL = "inaccessible" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
114 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
115 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
116 class ToEngine(DoorThing): |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
117 "Way to engine room." |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
118 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
119 NAME = "map.toengine" |
131 | 120 DEST = "engine" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
121 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
122 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
123 "inaccessible": InteractText(300, 300, "To Engine"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
124 "accessible": InteractText(300, 300, "To Engine", (0, 127, 0)), |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
125 } |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
126 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
127 INITIAL = "inaccessible" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
128 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
129 |
131 | 130 class ToMachine(DoorThing): |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
131 "Way to machine room." |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
132 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
133 NAME = "map.tomachine" |
131 | 134 DEST = "machine" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
135 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
136 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
137 "inaccessible": InteractText(100, 400, "To Machine"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
138 "accessible": InteractText(100, 400, "To Machine", (0, 127, 0)), |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
139 } |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
140 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
141 INITIAL = "inaccessible" |
130
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
142 |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
143 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
144 SCENES = [Map] |