Mercurial > pyntnclick
annotate gamelib/scenes/map.py @ 203:12c66793db8f
Add neural implant text
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Thu, 26 Aug 2010 10:55:02 +0200 |
parents | 0530547a131f |
children | eb101b6fb3dd |
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, |
203 | 20 'implant': True, |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
21 } |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
22 |
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
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 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
|
29 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
|
30 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
31 def enter(self): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
32 for door_thing in self.things.values(): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
33 door_thing.check_dest() |
203 | 34 if self.get_data('implant'): |
35 self.set_data('implant', False) | |
36 return (Result( | |
37 "JIM say 'Under the terms of the emergency conscription " | |
38 "act, I have downloaded the ship schematics to your " | |
39 "neural implant to help you navigate around the ship. " | |
40 "Please report to the bridge.'"), | |
41 Result( | |
42 "JIM continues 'Prisoner 84c7-d10dcfda0878. You are classed " | |
43 "as a class 1 felon. Obtaining access to the ship shematics " | |
44 "consitutes a level 2 offence and carries a minimal penalty " | |
45 "of an additional 3 years on you sentence.'")) | |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
46 |
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
|
47 |
131 | 48 class DoorThing(Thing): |
49 | |
50 # name of destination | |
51 DEST = None | |
52 | |
53 def interact_without(self): | |
54 """Go to destination.""" | |
55 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
|
56 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
|
57 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
|
58 return Result() |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
59 else: |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
60 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
|
61 else: |
0530547a131f
Better map handling, detail_view stuff in Result.
Jeremy Thurgood <firxen@gmail.com>
parents:
132
diff
changeset
|
62 return Result("You *could* go there, but it doesn't actually exist.") |
131 | 63 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
64 def check_dest(self): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
65 if self.DEST in self.state.scenes: |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
66 if self.state.scenes[self.DEST].get_data('accessible'): |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
67 self.set_interact('accessible') |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
68 else: |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
69 self.set_interact('inaccessible') |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
70 |
131 | 71 |
72 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
|
73 "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
|
74 |
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 NAME = "map.tocryo" |
131 | 76 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
|
77 |
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 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
79 "inaccessible": InteractText(100, 200, "To Cryo"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
80 "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
|
81 } |
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 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
83 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
|
84 |
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 |
131 | 86 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
|
87 "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
|
88 |
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 NAME = "map.tobridge" |
131 | 90 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
|
91 |
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 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
93 "inaccessible": InteractText(300, 200, "To Bridge"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
94 "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
|
95 } |
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 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
97 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
|
98 |
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 |
131 | 100 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
|
101 "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
|
102 |
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 NAME = "map.tomess" |
131 | 104 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
|
105 |
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 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
107 "inaccessible": InteractText(100, 300, "To Mess"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
108 "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
|
109 } |
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 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
111 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
|
112 |
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 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
114 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
|
115 "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
|
116 |
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 NAME = "map.toengine" |
131 | 118 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
|
119 |
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 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
121 "inaccessible": InteractText(300, 300, "To Engine"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
122 "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
|
123 } |
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 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
125 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
|
126 |
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 |
131 | 128 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
|
129 "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
|
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 NAME = "map.tomachine" |
131 | 132 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
|
133 |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
134 INTERACTS = { |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
135 "inaccessible": InteractText(100, 400, "To Machine"), |
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
136 "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
|
137 } |
11afefc4aeaf
InteractText for mocking up scenes. Allow backgrounds to be None. Mock up map.
Simon Cross <hodgestar+bzr@gmail.com>
parents:
51
diff
changeset
|
138 |
132
686bb74a52f8
Map shows accessible areas.
Jeremy Thurgood <firxen@gmail.com>
parents:
131
diff
changeset
|
139 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
|
140 |
47
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
141 |
8f1fccb8cadf
Skeletons for scenes in plot outline.
Simon Cross <simon@simonx>
parents:
diff
changeset
|
142 SCENES = [Map] |