Mercurial > pyntnclick
annotate gamelib/scenes/map.py @ 193:738608e90e9c
CloneableItem tweaks and a usable laser welder. zOMG!
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Wed, 25 Aug 2010 21:59:26 +0200 |
parents | 0530547a131f |
children | 12c66793db8f |
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 |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
11 |
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 class Map(Scene): |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
14 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
15 FOLDER = "map" |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
16 BACKGROUND = None # TODO |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
17 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
18 INITIAL_DATA = { |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
19 'accessible': True, |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
20 } |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
21 |
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
|
22 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
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 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
|
29 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
30 def enter(self): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
31 for door_thing in self.things.values(): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
32 door_thing.check_dest() |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
33 |
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
|
34 |
131 | 35 class DoorThing(Thing): |
36 | |
37 # name of destination | |
38 DEST = None | |
39 | |
40 def interact_without(self): | |
41 """Go to destination.""" | |
42 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
|
43 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
|
44 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
|
45 return Result() |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
46 else: |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
47 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
|
48 else: |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
49 return Result("You *could* go there, but it doesn't actually exist.") |
131 | 50 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
51 def check_dest(self): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
52 if self.DEST in self.state.scenes: |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
53 if self.state.scenes[self.DEST].get_data('accessible'): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
54 self.set_interact('accessible') |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
55 else: |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
56 self.set_interact('inaccessible') |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
57 |
131 | 58 |
59 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
|
60 "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
|
61 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
62 NAME = "map.tocryo" |
131 | 63 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
|
64 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
65 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
66 "inaccessible": InteractText(100, 200, "To Cryo"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
67 "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
|
68 } |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
69 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
70 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
|
71 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
72 |
131 | 73 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
|
74 "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
|
75 |
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 NAME = "map.tobridge" |
131 | 77 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
|
78 |
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 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
80 "inaccessible": InteractText(300, 200, "To Bridge"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
81 "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
|
82 } |
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 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
84 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
|
85 |
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 |
131 | 87 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
|
88 "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
|
89 |
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 NAME = "map.tomess" |
131 | 91 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
|
92 |
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 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
94 "inaccessible": InteractText(100, 300, "To Mess"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
95 "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
|
96 } |
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 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
98 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
|
99 |
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 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
101 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
|
102 "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
|
103 |
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 NAME = "map.toengine" |
131 | 105 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
|
106 |
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 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
108 "inaccessible": InteractText(300, 300, "To Engine"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
109 "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
|
110 } |
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 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
112 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
|
113 |
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 |
131 | 115 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
|
116 "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
|
117 |
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 NAME = "map.tomachine" |
131 | 119 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
|
120 |
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 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
122 "inaccessible": InteractText(100, 400, "To Machine"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
123 "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
|
124 } |
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 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
126 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
|
127 |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
128 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
129 SCENES = [Map] |