-
Notifications
You must be signed in to change notification settings - Fork 1
/
railways.py
267 lines (239 loc) · 6.79 KB
/
railways.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
subwayRailways = {}
subwayRailways["overworld"] = [
# Center
{"color": "blue", "way": [
{"station": "Creeper Station", "y": 57},
{"x": 278, "z": -112, "y": 57},
{"x": 278, "z": -104, "y": 51},
{"x": 278, "z": -98, "y": 51},
{"x": 278, "z": -71, "y": 25},
{"x": 278, "z": -12, "y": 25},
{"x": 195, "z": -12, "y": 25},
{"x": 195, "z": -4, "y": 25},
{"x": 123, "z": -4, "y": 25},
{"x": 123, "z": -12, "y": 25},
{"x": 120, "z": -12, "y": 25},
{"x": 104, "z": -12, "y": 40},
{"x": -329, "z": -12, "y": 40},
{"station": "West Outpost", "y": 40}
]},
{"color": "blue", "way": [
{"station": "Creeper Station", "y": 57},
{"x": 280, "z": -112, "y": 57},
{"x": 280, "z": -104, "y": 51},
{"x": 280, "z": -98, "y": 51},
{"x": 280, "z": -71, "y": 25},
{"x": 280, "z": 159, "y": 25},
{"x": 217, "z": 159, "y": 25},
{"x": 202, "z": 159, "y": 11},
{"x": 188, "z": 159, "y": 11},
{"x": 188, "z": 154, "y": 11},
{"x": 82, "z": 154, "y": 11},
{"x": 82, "z": 293, "y": 11},
{"x": 81, "z": 293, "y": 11},
{"station": "Stone House", "y": 11}
]},
{"color": "blue", "way": [
{"station": "Creeper Station", "y": 57},
{"x": 282, "z": -112, "y": 57},
{"x": 282, "z": -104, "y": 51},
{"x": 282, "z": -98, "y": 51},
{"x": 282, "z": -71, "y": 25},
{"x": 282, "z": -63, "y": 25},
{"x": 293, "z": -63, "y": 25},
{"x": 293, "z": -95, "y": 25},
{"x": 170, "z": -95, "y": 25},
{"x": 170, "z": -381, "y": 25},
{"x": 171, "z": -381, "y": 25},
{"station": "Fake North Station", "y": 25}
]},
{"color": "blue", "way": [
{"station": "Creeper Station", "y": 57},
{"x": 284, "z": -112, "y": 57},
{"x": 284, "z": -104, "y": 51},
{"x": 284, "z": -98, "y": 51},
{"x": 284, "z": -71, "y": 25},
{"x": 284, "z": -68, "y": 25},
{"x": 286, "z": -68, "y": 25},
{"x": 302, "z": -68, "y": 10},
{"x": 304, "z": -68, "y": 10},
{"x": 304, "z": -105, "y": 10},
{"x": 770, "z": -105, "y": 10},
{"station": "East Outpost", "y": 10}
]},
# Blue
{"color": "blue", "way": [
{"station": "Stone House", "y": 11},
{"station": "Stone House Catacombs", "y": 11},
]},
{"color": "blue", "way": [
{"station": "Stone House Catacombs", "y": 11},
{"station": "Diamond Shaft", "y": 11},
]},
{"color": "blue", "way": [
{"station": "Diamond Shaft", "y": 11},
{"station": "Diamond Shaft - Far Side", "y": 11},
]},
{"color": "blue", "way": [
{"station": "Diamond Shaft - Far Side", "y": 11},
{"station": "South Outpost", "y": 11},
]},
{"color": "blue", "way": [
{"station": "Fake North Station", "y": 25},
{"station": "Underground Canyon Station", "y": 25},
]},
{"color": "blue", "way": [
{"station": "Underground Canyon Station", "y": 25},
{"station": "Deep North Shaft", "y": 25},
]},
{"color": "blue", "way": [
{"station": "Deep North Shaft", "y": 25},
{"station": "North Harbor", "y": 25},
]},
{"color": "blue", "way": [
{"station": "North Harbor", "y": 25},
{"x": 170, "z": -1500, "y": 25},
{"station": "North Outpost", "y": 25},
]},
# White
{"color": "white", "way": [
{"station": "South Outpost", "y": 51},
{"x": 83, "z": 832, "y": 51},
{"station": "Lucky's House", "y": 51},
]},
{"color": "white", "way": [
{"station": "Lucky's House", "y": 51},
{"x": 137, "z": 747, "y": 51},
{"x": 137, "z": 715, "y": 19},
{"x": 137, "z": 705, "y": 19},
{"x": 620, "z": 705, "y": 19},
{"x": 630, "z": 705, "y": 20},
{"x": 789, "z": 705, "y": 20},
{"x": 789, "z": 500, "y": 20},
{"station": "TK's House", "y": 62},
]},
{"color": "white", "way": [
{"station": "TK's House", "y": 62},
{"x": 789, "z": 408, "y": 12},
{"station": "East Outpost", "y": 12},
]},
{"color": "white", "way": [
{"station": "East Outpost", "y": 12},
{"x": 802, "z": -135, "y": 25},
{"station": "Spider Nest", "y": 25},
]},
{"color": "white", "way": [
{"station": "Spider Nest", "y": 25},
{"x": 802, "z": -1340, "y": 25},
{"station": "North-East Watchtower", "y": 25},
]},
{"color": "white", "way": [
{"station": "North-East Watchtower", "y": 25},
{"x": 512, "z": -1500, "y": 25},
{"station": "North Outpost", "y": 25},
]},
{"color": "white", "way": [
{"station": "North Outpost", "y": 25},
{"x": 210, "z": -1500, "y": 25},
{"x": 210, "z": -1489, "y": 14},
{"x": 210, "z": -1333, "y": 14},
{"station": "North Harbor", "y": 14},
]},
{"color": "white", "way": [
{"station": "North Harbor", "y": 14},
{"station": "North Bridge", "y": 14},
]},
{"color": "white", "way": [
{"station": "North Bridge", "y": 14},
{"station": "Nyan Cat Base", "y": 14},
]},
{"color": "white", "way": [
{"station": "Nyan Cat Base", "y": 14},
{"x": -336, "z": -1340, "y": 25},
{"station": "Pole of Cold", "y": 25},
]},
{"color": "white", "way": [
{"station": "Pole of Cold", "y": 25},
{"station": "West Outpost", "y": 25},
]},
{"color": "white", "way": [
{"station": "West Outpost", "y": 25},
{"station": "Spawn Station", "y": 25},
]},
{"color": "white", "way": [
{"station": "Spawn Station", "y": 25},
{"x": -336, "z": 717, "y": 25},
{"station": "South Outpost", "y": 51},
]},
]
subwayRailways["nether"] = [
{"color": "red", "way": [
{"station": "Nether Residence", "y": 60},
{"x": 172, "z": 4, "y": 60},
{"station": "Cliff's Edge", "y": 60},
]},
]
subwayRailways["end"] = []
import sys
from stations import subwayStations
def colorToRgb(color):
predefinedColors = {
"white": "#CCCCCC",
"red": "#DD5858",
"cyan": "#53CCC1",
"blue": "#5369AF",
}
if color in predefinedColors:
return predefinedColors[color]
else:
return color
def wayToPolyline(way, stations):
calculatedPoints = []
for point in way:
if "station" in point:
if point["station"] in stations:
calculatedPoints.append({
"x": stations[point["station"]]["x"],
"y": point["y"],
"z": stations[point["station"]]["z"],
})
else:
raise KeyError("There's no subway station named " + point["station"])
else:
calculatedPoints.append({
"x": point["x"],
"y": point["y"],
"z": point["z"],
})
return tuple(calculatedPoints)
def normalizePolyline(polyline):
calculatedPoints = []
for point in polyline:
calculatedPoints.append({
"x": point["x"],
"y": 64,
"z": point["z"],
})
return tuple(calculatedPoints)
def subwayRailwayToPois(dimension):
stations = subwayStations[dimension]
def _subwayRailwayToPois(railway):
pois = []
polyline = wayToPolyline(railway["way"], stations)
# pois = heightPoisFromPolyline(polyline)
polyline = normalizePolyline(polyline)
pois.append({
"id": "subways/" + dimension,
"x": sys.maxsize,
"y": sys.maxsize,
"z": sys.maxsize,
"text": "",
"color": colorToRgb(railway["color"]),
"polyline": polyline,
})
return pois
return _subwayRailwayToPois
def railwaysPois(dimension):
return [poi for pois in
map(subwayRailwayToPois(dimension), subwayRailways[dimension])
for poi in pois]