aboutsummaryrefslogtreecommitdiff
path: root/advtrains/models/advtrains_dtrack_vst1_45.obj
blob: 8ff83435c19d1e8329d00e093ada2edc25817dea (plain)
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# Blender v2.78 (sub 0) OBJ File: 'rail_redo.blend'
# www.blender.org
o dtrack_vst1_45_Cube.033
v 0.111416 -0.221340 0.354093
v 0.111416 -0.057279 0.354093
v 0.354093 -0.342660 0.111416
v 0.354093 -0.178600 0.111416
v 0.205542 -0.221340 0.448220
v 0.205542 -0.057279 0.448220
v 0.448220 -0.342660 0.205543
v 0.448220 -0.178600 0.205543
v -0.208358 0.039814 0.791422
v 0.791423 -0.460000 -0.208357
v 0.896243 -0.460000 -0.103536
v -0.103538 0.039814 0.896242
v -0.164683 0.059814 0.835097
v 0.835098 -0.440000 -0.164682
v 0.852568 -0.440000 -0.147212
v -0.147213 0.059814 0.852567
v -0.164683 0.109814 0.835097
v 0.835098 -0.390000 -0.164682
v 0.852568 -0.390000 -0.147212
v -0.147213 0.109814 0.852567
v 0.874406 -0.385000 -0.125374
v -0.125375 0.114814 0.874405
v -0.186520 0.114814 0.813259
v 0.813260 -0.385000 -0.186519
v 0.874406 -0.360000 -0.125374
v -0.125375 0.139814 0.874405
v -0.186520 0.139814 0.813259
v 0.813260 -0.360000 -0.186519
v 0.476117 -0.186104 0.572089
v -0.572088 -0.186104 -0.476117
v -0.656942 -0.143684 -0.391265
v 0.391264 -0.143684 0.656941
v 0.476117 -0.236104 0.572089
v -0.572088 -0.236104 -0.476117
v -0.656941 -0.193684 -0.391265
v 0.391264 -0.193684 0.656942
v -0.508186 2.879001 0.491594
v 0.491594 2.379186 -0.508186
v -0.508186 2.900629 0.491593
v 0.491594 2.400814 -0.508186
v 0.508186 2.379186 -0.491594
v -0.491594 2.879001 0.508186
v 0.508186 2.400814 -0.491594
v -0.491594 2.900629 0.508186
v 0.208358 -0.460000 -0.791421
v -0.791423 0.039814 0.208357
v -0.896244 0.039814 0.103537
v 0.103537 -0.460000 -0.896242
v 0.164682 -0.440000 -0.835097
v -0.835099 0.059815 0.164682
v -0.852568 0.059814 0.147212
v 0.147212 -0.440000 -0.852567
v 0.164682 -0.390000 -0.835097
v -0.835099 0.109815 0.164682
v -0.852568 0.109814 0.147212
v 0.147212 -0.390000 -0.852567
v -0.874406 0.114814 0.125374
v 0.125375 -0.385000 -0.874404
v 0.186520 -0.385000 -0.813259
v -0.813261 0.114815 0.186520
v -0.874406 0.139814 0.125374
v 0.125375 -0.360000 -0.874404
v 0.186520 -0.360000 -0.813259
v -0.813261 0.139814 0.186520
v -0.230055 -0.407095 -0.818151
v 0.818151 -0.407095 0.230055
v 0.733298 -0.364675 0.314908
v -0.314908 -0.364675 -0.733299
v -0.230055 -0.357095 -0.818151
v 0.818151 -0.357095 0.230056
v 0.733298 -0.314675 0.314908
v -0.314908 -0.314675 -0.733298
v 0.314908 -0.105511 0.733298
v -0.733298 -0.105511 -0.314908
v -0.818151 -0.063091 -0.230056
v 0.230055 -0.063091 0.818151
v 0.314908 -0.155511 0.733298
v -0.733298 -0.155511 -0.314908
v -0.818151 -0.113091 -0.230055
v 0.230055 -0.113091 0.818151
v -0.391264 -0.326502 -0.656942
v 0.656941 -0.326502 0.391265
v 0.572089 -0.284082 0.476118
v -0.476117 -0.284082 -0.572089
v -0.391264 -0.276502 -0.656941
v 0.656942 -0.276502 0.391265
v 0.572088 -0.234082 0.476117
v -0.476117 -0.234082 -0.572089
v -0.354093 -0.221340 -0.111416
v -0.354093 -0.057279 -0.111416
v -0.111416 -0.342660 -0.354093
v -0.111416 -0.178600 -0.354093
v -0.448220 -0.221340 -0.205543
v -0.448220 -0.057279 -0.205543
v -0.205543 -0.342660 -0.448220
v -0.205543 -0.178600 -0.448220
v -0.069408 -0.487406 -0.978798
v 0.978798 -0.487406 0.069409
v 0.893945 -0.444986 0.154261
v -0.154261 -0.444986 -0.893945
v -0.069408 -0.437406 -0.978798
v 0.978798 -0.437406 0.069409
v 0.893945 -0.394986 0.154261
v -0.154261 -0.394986 -0.893945
v 0.069408 -0.032780 0.978798
v -0.978798 -0.032780 -0.069409
v -0.893945 -0.075200 -0.154261
v 0.154261 -0.075200 0.893945
v 0.069408 0.017220 0.978797
v -0.978798 0.017220 -0.069409
v -0.893945 -0.025200 -0.154261
v 0.154261 -0.025200 0.893945
v -0.029561 -0.500000 -1.029558
v 1.029558 -0.500000 0.029561
v -1.029558 -0.500000 -0.029561
v -1.029558 0.000000 -0.029561
v 0.029561 -0.500000 1.029558
v 0.029561 0.000000 1.029558
v -0.500000 0.000000 1.559119
v -1.559119 0.000000 0.500000
v -0.499999 0.000000 0.499999
v -1.559120 -0.500000 0.500000
v -0.500000 -0.500000 1.559119
v -0.500003 -0.500000 0.500000
vt 0.7427 0.1169
vt 0.7427 0.3317
vt 0.6400 0.3317
vt 0.6400 0.1169
vt 0.8260 0.3317
vt 0.8260 0.4343
vt 0.7427 0.4343
vt 0.8260 0.1169
vt 0.7427 0.0142
vt 0.8260 0.0142
vt 0.5691 0.2971
vt 0.5691 0.9229
vt 0.5378 0.9229
vt 0.5378 0.2971
vt 0.3413 0.2971
vt 0.3819 0.2971
vt 0.3819 0.9229
vt 0.3413 0.9229
vt 0.4291 0.9855
vt 0.4678 0.9730
vt 0.4833 0.9730
vt 0.5219 0.9855
vt 0.6097 0.9229
vt 0.6097 0.2971
vt 0.4678 0.2470
vt 0.4291 0.2345
vt 0.5219 0.2345
vt 0.4833 0.2470
vt 0.4833 0.2783
vt 0.4678 0.2783
vt 0.4132 0.2971
vt 0.4132 0.9229
vt 0.4678 0.9417
vt 0.4833 0.9417
vt 0.5182 0.9229
vt 0.5182 0.2971
vt 0.4328 0.2971
vt 0.4328 0.9229
vt 0.5026 0.9229
vt 0.5026 0.2971
vt 0.4485 0.2971
vt 0.4485 0.9229
vt 0.5026 0.2814
vt 0.4485 0.2814
vt 0.4485 0.9386
vt 0.5026 0.9386
vt 0.9588 0.9625
vt 0.9588 0.9938
vt 0.8837 0.9938
vt 0.8837 0.9625
vt 0.8524 0.0348
vt 0.8837 0.0348
vt 0.8524 0.9625
vt 0.9588 0.0035
vt 0.9588 0.0348
vt 0.8837 0.0035
vt 0.9901 0.9625
vt 0.9901 0.0348
vt 0.6554 0.3627
vt 0.6690 0.3627
vt 0.6690 0.9885
vt 0.6554 0.9885
vt 0.6972 0.9885
vt 0.6837 0.9885
vt 0.6837 0.3627
vt 0.6972 0.3627
vt 0.7119 0.3627
vt 0.7119 0.9885
vt 0.5691 0.2971
vt 0.5691 0.9229
vt 0.5378 0.9229
vt 0.5378 0.2971
vt 0.3413 0.2971
vt 0.3819 0.2971
vt 0.3819 0.9229
vt 0.3413 0.9229
vt 0.4291 0.9855
vt 0.4678 0.9730
vt 0.4833 0.9730
vt 0.5219 0.9855
vt 0.6097 0.9229
vt 0.6097 0.2971
vt 0.4678 0.2470
vt 0.4291 0.2345
vt 0.5219 0.2345
vt 0.4833 0.2470
vt 0.4833 0.2783
vt 0.4678 0.2783
vt 0.4132 0.2971
vt 0.4132 0.9229
vt 0.4678 0.9417
vt 0.4833 0.9417
vt 0.5182 0.9229
vt 0.5182 0.2971
vt 0.4328 0.2971
vt 0.4328 0.9229
vt 0.5026 0.9229
vt 0.5026 0.2971
vt 0.4485 0.2971
vt 0.4485 0.9229
vt 0.5026 0.2814
vt 0.4485 0.2814
vt 0.4485 0.9386
vt 0.5026 0.9386
vt 0.9588 0.9625
vt 0.8837 0.9625
vt 0.8837 0.0348
vt 0.9588 0.0348
vt 0.9901 0.9625
vt 0.9901 0.0348
vt 0.9588 0.0035
vt 0.8837 0.0035
vt 0.8524 0.0348
vt 0.8524 0.9625
vt 0.9588 0.9938
vt 0.8837 0.9938
vt 0.9588 0.9625
vt 0.9588 0.9938
vt 0.8837 0.9938
vt 0.8837 0.9625
vt 0.8524 0.0348
vt 0.8837 0.0348
vt 0.8524 0.9625
vt 0.9588 0.0035
vt 0.9588 0.0348
vt 0.8837 0.0035
vt 0.9901 0.9625
vt 0.9901 0.0348
vt 0.9588 0.9625
vt 0.8837 0.9625
vt 0.8837 0.0348
vt 0.9588 0.0348
vt 0.9901 0.9625
vt 0.9901 0.0348
vt 0.9588 0.0035
vt 0.8837 0.0035
vt 0.8524 0.0348
vt 0.8524 0.9625
vt 0.9588 0.9938
vt 0.8837 0.9938
vt 0.7427 0.1169
vt 0.6400 0.1169
vt 0.6400 0.3317
vt 0.7427 0.3317
vt 0.7427 0.4343
vt 0.8260 0.4343
vt 0.8260 0.3317
vt 0.8260 0.1169
vt 0.8260 0.0142
vt 0.7427 0.0142
vt 0.9588 0.9625
vt 0.8837 0.9625
vt 0.8837 0.0348
vt 0.9588 0.0348
vt 0.9901 0.9625
vt 0.9901 0.0348
vt 0.9588 0.0035
vt 0.8837 0.0035
vt 0.8524 0.0348
vt 0.8524 0.9625
vt 0.9588 0.9938
vt 0.8837 0.9938
vt 0.9588 0.9625
vt 0.8837 0.9625
vt 0.8837 0.0348
vt 0.9588 0.0348
vt 0.9901 0.9625
vt 0.9901 0.0348
vt 0.9588 0.0035
vt 0.8837 0.0035
vt 0.8524 0.0348
vt 0.8524 0.9625
vt 0.9588 0.9938
vt 0.8837 0.9938
vt -0.3235 0.5003
vt 0.6181 0.0296
vt 0.6181 0.5003
vt 0.6188 0.9848
vt -0.3228 0.5141
vt 0.6188 0.5141
vt 0.0669 1.0031
vt 0.0669 0.5045
vt 0.0669 0.0059
vt 1.1195 0.0059
vt 1.1195 1.0031
vt 0.1925 0.0071
vt 0.1925 0.5057
vt -0.3061 0.0071
vt -0.4317 1.0031
vt -0.4317 0.0059
vt 1.1341 0.0071
vt 1.1341 1.0043
vt 0.1925 1.0043
vt 1.1202 0.9906
vt 0.4151 0.9906
vt 0.4151 0.5199
vt 1.1202 0.5199
vt 0.4050 0.0285
vt 1.1101 0.0285
vt 1.1101 0.4992
vt 0.4050 0.4992
vt -0.3061 1.0043
vt 1.1174 0.5141
vt 1.1174 0.9848
vt 1.1167 0.0296
vt 1.1167 0.5003
vn -0.7071 0.0000 -0.7071
vn 0.7071 0.0000 -0.7071
vn -0.7071 0.0000 0.7071
vn 0.2357 0.9428 -0.2357
vn 0.7071 0.0000 0.7071
vn 0.0189 0.9017 -0.4319
vn 0.4319 0.9017 -0.0189
vn -0.1263 -0.9320 0.3397
vn -0.3397 -0.9320 0.1263
vn -0.2357 -0.9428 0.2357
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
g dtrack_vst1_45_Cube.033_SlopeRailMaterial
s off
f 2/1/1 4/2/1 3/3/1 1/4/1
f 4/2/2 8/5/2 7/6/2 3/7/2
f 6/8/3 2/1/3 1/9/3 5/10/3
f 6/8/4 8/5/4 4/2/4 2/1/4
f 16/11/5 15/12/5 19/13/5 20/14/5
f 9/15/6 13/16/6 14/17/6 10/18/6
f 10/19/2 14/20/2 15/21/2 11/22/2
f 11/23/7 15/12/7 16/11/7 12/24/7
f 13/25/3 9/26/3 12/27/3 16/28/3
f 20/29/3 17/30/3 13/25/3 16/28/3
f 13/16/1 17/31/1 18/32/1 14/17/1
f 15/21/2 14/20/2 18/33/2 19/34/2
f 20/14/8 19/13/8 21/35/8 22/36/8
f 18/32/9 17/31/9 23/37/9 24/38/9
f 22/36/5 21/35/5 25/39/5 26/40/5
f 24/38/1 23/37/1 27/41/1 28/42/1
f 25/39/4 28/42/4 27/41/4 26/40/4
f 17/30/3 20/29/3 22/43/3 26/40/3 27/41/3 23/44/3
f 18/33/2 24/45/2 28/42/2 25/39/2 21/46/2 19/34/2
f 32/47/5 36/48/5 33/49/5 29/50/5
f 34/51/2 30/52/2 29/50/2 33/53/2
f 35/54/1 31/55/1 30/52/1 34/56/1
f 36/57/3 32/47/3 31/55/3 35/58/3
f 32/47/4 29/50/4 30/52/4 31/55/4
f 37/59/1 39/60/1 40/61/1 38/62/1
f 41/63/5 43/64/5 44/65/5 42/66/5
f 37/67/10 38/68/10 41/63/10 42/66/10
f 39/60/4 44/65/4 43/64/4 40/61/4
f 52/69/1 51/70/1 55/71/1 56/72/1
f 45/73/7 49/74/7 50/75/7 46/76/7
f 46/77/3 50/78/3 51/79/3 47/80/3
f 47/81/6 51/70/6 52/69/6 48/82/6
f 49/83/2 45/84/2 48/85/2 52/86/2
f 56/87/2 53/88/2 49/83/2 52/86/2
f 49/74/5 53/89/5 54/90/5 50/75/5
f 51/79/3 50/78/3 54/91/3 55/92/3
f 56/72/9 55/71/9 57/93/9 58/94/9
f 54/90/8 53/89/8 59/95/8 60/96/8
f 58/94/1 57/93/1 61/97/1 62/98/1
f 60/96/5 59/95/5 63/99/5 64/100/5
f 61/97/4 64/100/4 63/99/4 62/98/4
f 53/88/2 56/87/2 58/101/2 62/98/2 63/99/2 59/102/2
f 54/91/3 60/103/3 64/100/3 61/97/3 57/104/3 55/92/3
f 69/105/4 72/106/4 71/107/4 70/108/4
f 65/109/2 69/105/2 70/108/2 66/110/2
f 66/111/5 70/108/5 71/107/5 67/112/5
f 67/113/3 71/107/3 72/106/3 68/114/3
f 69/105/1 65/115/1 68/116/1 72/106/1
f 76/117/5 80/118/5 77/119/5 73/120/5
f 78/121/2 74/122/2 73/120/2 77/123/2
f 79/124/1 75/125/1 74/122/1 78/126/1
f 80/127/3 76/117/3 75/125/3 79/128/3
f 76/117/4 73/120/4 74/122/4 75/125/4
f 85/129/4 88/130/4 87/131/4 86/132/4
f 81/133/2 85/129/2 86/132/2 82/134/2
f 82/135/5 86/132/5 87/131/5 83/136/5
f 83/137/3 87/131/3 88/130/3 84/138/3
f 85/129/1 81/139/1 84/140/1 88/130/1
f 90/141/5 89/142/5 91/143/5 92/144/5
f 92/144/2 91/145/2 95/146/2 96/147/2
f 94/148/3 93/149/3 89/150/3 90/141/3
f 94/148/4 90/141/4 92/144/4 96/147/4
f 101/151/4 104/152/4 103/153/4 102/154/4
f 97/155/2 101/151/2 102/154/2 98/156/2
f 98/157/5 102/154/5 103/153/5 99/158/5
f 99/159/3 103/153/3 104/152/3 100/160/3
f 101/151/1 97/161/1 100/162/1 104/152/1
f 109/163/4 112/164/4 111/165/4 110/166/4
f 105/167/3 109/163/3 110/166/3 106/168/3
f 106/169/1 110/166/1 111/165/1 107/170/1
f 107/171/2 111/165/2 112/164/2 108/172/2
f 109/163/5 105/173/5 108/174/5 112/164/5
g dtrack_vst1_45_Cube.033_SlopeGravelMaterial
f 114/175/5 118/176/5 117/177/5
f 116/178/1 113/179/1 115/180/1
f 116/181/4 121/182/4 118/183/4 114/184/4 113/185/4
f 115/186/11 124/187/11 122/188/11
f 116/181/12 120/189/12 121/182/12
f 118/183/12 121/182/12 119/190/12
f 113/191/11 114/192/11 117/193/11 124/187/11 115/186/11
f 121/194/13 120/195/13 122/196/13 124/197/13
f 119/198/14 121/199/14 124/200/14 123/201/14
f 123/202/11 124/187/11 117/193/11
f 116/178/1 115/180/1 122/203/1 120/204/1
f 117/177/5 118/176/5 119/205/5 123/206/5
com">vert1={ --you'll probably want to override mesh here } vert2={ --you'll probably want to override mesh here } ]]-- advtrains.all_tracktypes={} --definition preparation local function conns(c1, c2, r1, r2) return {{c=c1, y=r1}, {c=c2, y=r2}} end local function conns3(c1, c2, c3, r1, r2, r3) return {{c=c1, y=r1}, {c=c2, y=r2}, {c=c3, y=r3}} end advtrains.ap={} advtrains.ap.t_30deg_flat={ regstep=1, variant={ st={ conns = conns(0,8), desc = "straight", tpdouble = true, tpsingle = true, trackworker = "cr", }, cr={ conns = conns(0,7), desc = "curve", tpdouble = true, trackworker = "swlst", }, swlst={ conns = conns3(0,8,7), desc = "left switch (straight)", trackworker = "swrst", switchalt = "cr", switchmc = "on", switchst = "st", switchprefix = "swl", }, swlcr={ conns = conns3(0,7,8), desc = "left switch (curve)", trackworker = "swrcr", switchalt = "st", switchmc = "off", switchst = "cr", switchprefix = "swl", }, swrst={ conns = conns3(0,8,9), desc = "right switch (straight)", trackworker = "st", switchalt = "cr", switchmc = "on", switchst = "st", switchprefix = "swr", }, swrcr={ conns = conns3(0,9,8), desc = "right switch (curve)", trackworker = "st", switchalt = "st", switchmc = "off", switchst = "cr", switchprefix = "swr", }, }, regtp=true, tpdefault="st", trackworker={ ["swrcr"]="st", ["swrst"]="st", ["cr"]="swlst", ["swlcr"]="swrcr", ["swlst"]="swrst", }, rotation={"", "_30", "_45", "_60"}, } advtrains.ap.t_yturnout={ regstep=1, variant={ l={ conns = conns3(0,7,9), desc = "Y-turnout (left)", switchalt = "r", switchmc = "off", switchst = "l", switchprefix = "", }, r={ conns = conns3(0,9,7), desc = "Y-turnout (right)", switchalt = "l", switchmc = "on", switchst = "r", switchprefix = "", } }, regtp=true, tpdefault="l", rotation={"", "_30", "_45", "_60"}, } advtrains.ap.t_s3way={ regstep=1, variant={ l={ conns = { {c=0}, {c=7}, {c=8}, {c=9}, {c=0} }, desc = "3-way turnout (left)", switchalt = "s", switchst="l", switchprefix = "", }, s={ conns = { {c=0}, {c=8}, {c=7}, {c=9}, {c=0} }, desc = "3-way turnout (straight)", switchalt ="r", switchst = "s", switchprefix = "", }, r={ conns = { {c=0}, {c=9}, {c=8}, {c=7}, {c=0} }, desc = "3-way turnout (right)", switchalt = "l", switchst="r", switchprefix = "", } }, regtp=true, tpdefault="l", rotation={"", "_30", "_45", "_60"}, } advtrains.ap.t_30deg_slope={ regstep=1, variant={ vst1={conns = conns(8,0,0,0.5), rail_y = 0.25, desc = "steep uphill 1/2", slope=true}, vst2={conns = conns(8,0,0.5,1), rail_y = 0.75, desc = "steep uphill 2/2", slope=true}, vst31={conns = conns(8,0,0,0.33), rail_y = 0.16, desc = "uphill 1/3", slope=true}, vst32={conns = conns(8,0,0.33,0.66), rail_y = 0.5, desc = "uphill 2/3", slope=true}, vst33={conns = conns(8,0,0.66,1), rail_y = 0.83, desc = "uphill 3/3", slope=true}, }, regsp=true, slopeplacer={ [2]={"vst1", "vst2"}, [3]={"vst31", "vst32", "vst33"}, max=3,--highest entry }, slopeplacer_45={ [2]={"vst1_45", "vst2_45"}, max=2, }, rotation={"", "_30", "_45", "_60"}, trackworker={}, increativeinv={}, } advtrains.ap.t_30deg_straightonly={ regstep=1, variant={ st={ conns = conns(0,8), desc = "straight", tpdouble = true, tpsingle = true, trackworker = "st", }, }, regtp=true, tpdefault="st", rotation={"", "_30", "_45", "_60"}, } advtrains.ap.t_30deg_straightonly_noplacer={ regstep=1, variant={ st={ conns = conns(0,8), desc = "straight", tpdouble = true, tpsingle = true, trackworker = "st", }, }, tpdefault="st", rotation={"", "_30", "_45", "_60"}, } advtrains.ap.t_45deg={ regstep=2, variant={ st={ conns = conns(0,8), desc = "straight", tpdouble = true, tpsingle = true, trackworker = "cr", }, cr={ conns = conns(0,6), desc = "curve", tpdouble = true, trackworker = "swlst", }, swlst={ conns = conns3(0,8,6), desc = "left switch (straight)", trackworker = "swrst", switchalt = "cr", switchmc = "on", switchst = "st", }, swlcr={ conns = conns3(0,6,8), desc = "left switch (curve)", trackworker = "swrcr", switchalt = "st", switchmc = "off", switchst = "cr", }, swrst={ conns = conns3(0,8,10), desc = "right switch (straight)", trackworker = "st", switchalt = "cr", switchmc = "on", switchst = "st", }, swrcr={ conns = conns3(0,10,8), desc = "right switch (curve)", trackworker = "st", switchalt = "st", switchmc = "off", switchst = "cr", }, }, regtp=true, tpdefault="st", trackworker={ ["swrcr"]="st", ["swrst"]="st", ["cr"]="swlst", ["swlcr"]="swrcr", ["swlst"]="swrst", }, rotation={"", "_30", "_45", "_60"}, } advtrains.ap.t_perpcrossing={ regstep = 1, variant={ st={ conns = { {c=0}, {c=8}, {c=4}, {c=12} }, desc = "perpendicular crossing", tpdouble = true, tpsingle = true, trackworker = "st", }, }, regtp=true, tpdefault="st", rotation={"", "_30", "_45", "_60"}, } advtrains.ap.t_90plusx_crossing={ regstep = 1, variant={ ["30l"]={ conns = { {c=0}, {c=8}, {c=1}, {c=9} }, desc = "30/90 degree crossing (left)", tpdouble = true, tpsingle = true, trackworker = "45l" }, ["45l"]={ conns = { {c=0}, {c=8}, {c=2}, {c=10} }, desc = "45/90 degree crossing (left)", tpdouble = true, tpsingle = true, trackworker = "60l", }, ["60l"]={ conns = { {c=0}, {c=8}, {c=3}, {c=11}}, desc = "60/90 degree crossing (left)", tpdouble = true, tpsingle = true, trackworker = "60r", }, ["60r"]={ conns = { {c=0}, {c=8}, {c=5}, {c=13} }, desc = "60/90 degree crossing (right)", tpdouble = true, tpsingle = true, trackworker = "45r" }, ["45r"]={ conns = { {c=0}, {c=8}, {c=6}, {c=14} }, desc = "45/90 degree crossing (right)", tpdouble = true, tpsingle = true, trackworker = "30r", }, ["30r"]={ conns = { {c=0}, {c=8}, {c=7}, {c=15}}, desc = "30/90 degree crossing (right)", tpdouble = true, tpsingle = true, trackworker = "30l", }, }, regtp=true, tpdefault="30l", rotation={""}, trackworker = { ["30l"] = "45l", ["45l"] = "60l", ["60l"] = "60r", ["60r"] = "45r", ["45r"] = "30r", ["30r"] = "30l", } } advtrains.ap.t_diagonalcrossing = { regstep=1, variant={ ["30l45r"]={ conns = {{c=1}, {c=9}, {c=6}, {c=14}}, desc = "30left-45right diagonal crossing", tpdouble=true, tpsingle=true, trackworker="60l30l", }, ["60l30l"]={ conns = {{c=3}, {c=11}, {c=1}, {c=9}}, desc = "30left-60right diagonal crossing", tpdouble=true, tpsingle=true, trackworker="60l45r" }, ["60l45r"]={ conns = {{c=3}, {c=11}, {c=6}, {c=14}}, desc = "60left-45right diagonal crossing", tpdouble=true, tpsingle=true, trackworker="60l60r" }, ["60l60r"]={ conns = {{c=3}, {c=11}, {c=5}, {c=13}}, desc = "60left-60right diagonal crossing", tpdouble=true, tpsingle=true, trackworker="60r45l", }, --If 60l60r had a mirror image, it would be here, but it's symmetric. -- 60l60r is also equivalent to 30l30r but rotated 90 degrees. ["60r45l"]={ conns = {{c=5}, {c=13}, {c=2}, {c=10}}, desc = "60right-45left diagonal crossing", tpdouble=true, tpsingle=true, trackworker="60r30r", }, ["60r30r"]={ conns = {{c=5}, {c=13}, {c=7}, {c=15}}, desc = "60right-30right diagonal crossing", tpdouble=true, tpsingle=true, trackworker="30r45l", }, ["30r45l"]={ conns = {{c=7}, {c=15}, {c=2}, {c=10}}, desc = "30right-45left diagonal crossing", tpdouble=true, tpsingle=true, trackworker="30l45r", }, }, regtp=true, tpdefault="30l45r", rotation={""}, trackworker = { ["30l45r"] = "60l30l", ["60l30l"] = "60l45r", ["60l45r"] = "60l60r", ["60l60r"] = "60r45l", ["60r45l"] = "60r30r", ["60r30r"] = "30r45l", ["30r45l"] = "30l45r", } } advtrains.trackpresets = advtrains.ap --definition format: ([] optional) --[[{ nodename_prefix texture_prefix [shared_texture] models_prefix models_suffix (with dot) [shared_model] formats={ st,cr,swlst,swlcr,swrst,swrcr,vst1,vst2 (each a table with indices 0-3, for if to register a rail with this 'rotation' table entry. nil is assumed as 'all', set {} to not register at all) } common={} change something on common rail appearance } [18.12.17] Note on new connection system: In order to support real rail crossing nodes and finally make the trackplacer respect switches, I changed the connection system. There can be a variable number of connections available. These are specified as tuples {c=<connection>, y=<rely>} The table "at_conns" consists of {<conn1>, <conn2>...} the "at_rail_y" property holds the value that was previously called "railheight" Depending on the number of connections: 2 conns: regular rail 3 conns: switch: - when train passes in at conn1, will move out of conn2 - when train passes in at conn2 or conn3, will move out of conn1 4 conns: cross (or cross switch, depending on arrangement of conns): - conn1 <> conn2 - conn3 <> conn4 ]] function advtrains.register_tracks(tracktype, def, preset) advtrains.trackplacer.register_tracktype(def.nodename_prefix, preset.tpdefault) if preset.regtp then advtrains.trackplacer.register_track_placer(def.nodename_prefix, def.texture_prefix, def.description, def) end if preset.regsp then advtrains.slope.register_placer(def, preset) end for suffix, var in pairs(preset.variant) do for rotid, rotation in ipairs(preset.rotation) do if not def.formats[suffix] or def.formats[suffix][rotid] then local img_suffix = suffix..rotation local ndef = advtrains.merge_tables({ description=def.description.."("..(var.desc or "any")..rotation..")", drawtype = "mesh", paramtype="light", paramtype2="facedir", walkable = false, selection_box = { type = "fixed", fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, }, mesh = def.shared_model or (def.models_prefix.."_"..img_suffix..def.models_suffix), tiles = {def.shared_texture or (def.texture_prefix.."_"..img_suffix..".png"), def.second_texture}, groups = { attached_node=1, advtrains_track=1, ["advtrains_track_"..tracktype]=1, save_in_at_nodedb=1, dig_immediate=2, not_in_creative_inventory=1, not_blocking_trains=1, }, can_dig = advtrains.can_dig_or_modify_track, after_dig_node=function(pos) advtrains.ndb.update(pos) end, after_place_node=function(pos) advtrains.ndb.update(pos) end, at_nnpref = def.nodename_prefix, at_suffix = suffix, at_rotation = rotation, at_rail_y = var.rail_y }, def.common or {}) if preset.regtp then ndef.drop = def.nodename_prefix.."_placer" end if preset.regsp and var.slope then ndef.drop = def.nodename_prefix.."_slopeplacer" end --connections ndef.at_conns = advtrains.rotate_conn_by(var.conns, (rotid-1)*preset.regstep) local ndef_avt_table if var.switchalt and var.switchst then local switchfunc=function(pos, node, newstate) newstate = newstate or var.switchalt -- support for 3 (or more) state switches -- this code is only called from the internal setstate function, which -- ensures that it is safe to switch the turnout if newstate~=var.switchst then advtrains.ndb.swap_node(pos, {name=def.nodename_prefix.."_"..(var.switchprefix or "")..newstate..rotation, param2=node.param2}) advtrains.invalidate_all_paths(pos) end end ndef.on_rightclick = function(pos, node, player) if advtrains.check_turnout_signal_protection(pos, player:get_player_name()) then advtrains.setstate(pos, newstate, node) advtrains.log("Switch", player:get_player_name(), pos) end end if var.switchmc then ndef.mesecons = {effector = { ["action_"..var.switchmc] = function(pos, node) advtrains.setstate(pos, nil, node) end, rules=advtrains.meseconrules }} end ndef_avt_table = { getstate = var.switchst, setstate = switchfunc, } end local adef={} if def.get_additional_definiton then adef=def.get_additional_definiton(def, preset, suffix, rotation) end ndef = advtrains.merge_tables(ndef, adef) -- insert getstate/setstate functions after merging the additional definitions if ndef_avt_table then ndef.advtrains = advtrains.merge_tables(ndef.advtrains or {}, ndef_avt_table) end minetest.register_node(":"..def.nodename_prefix.."_"..suffix..rotation, ndef) --trackplacer if preset.regtp then local tpconns = {conn1=ndef.at_conns[1].c, conn2=ndef.at_conns[2].c} if var.tpdouble then advtrains.trackplacer.add_double_conn(def.nodename_prefix, suffix, rotation, tpconns) end if var.tpsingle then advtrains.trackplacer.add_single_conn(def.nodename_prefix, suffix, rotation, tpconns) end end advtrains.trackplacer.add_worked(def.nodename_prefix, suffix, rotation, var.trackworker) end end end advtrains.all_tracktypes[tracktype]=true end function advtrains.is_track_and_drives_on(nodename, drives_on_p) local drives_on = drives_on_p if not drives_on then drives_on = advtrains.all_tracktypes end local hasentry = false for _,_ in pairs(drives_on) do hasentry=true end if not hasentry then drives_on = advtrains.all_tracktypes end if not minetest.registered_nodes[nodename] then return false end local nodedef=minetest.registered_nodes[nodename] for k,v in pairs(drives_on) do if nodedef.groups["advtrains_track_"..k] then return true end end return false end function advtrains.get_track_connections(name, param2) local nodedef=minetest.registered_nodes[name] if not nodedef then atprint(" get_track_connections couldn't find nodedef for nodename "..(name or "nil")) return nil end local noderot=param2 if not param2 then noderot=0 end if noderot > 3 then atprint(" get_track_connections: rail has invaild param2 of "..noderot) noderot=0 end local tracktype for k,_ in pairs(nodedef.groups) do local tt=string.match(k, "^advtrains_track_(.+)$") if tt then tracktype=tt end end return advtrains.rotate_conn_by(nodedef.at_conns, noderot*AT_CMAX/4), (nodedef.at_rail_y or 0), tracktype end -- Function called when a track is about to be dug or modified by the trackworker -- Returns either true (ok) or false,"translated string describing reason why it isn't allowed" function advtrains.can_dig_or_modify_track(pos) if advtrains.get_train_at_pos(pos) then return false, attrans("Position is occupied by a train.") end -- interlocking: tcb, signal IP a.s.o. if advtrains.interlocking then -- TCB? if advtrains.interlocking.db.get_tcb(pos) then return false, attrans("There's a Track Circuit Break here.") end -- signal ip? if advtrains.interlocking.db.is_ip_at(pos) then return false, attrans("There's a Signal Influence Point here.") end end return true end -- slope placer. Defined in register_tracks. --crafted with rail and gravel local sl={} function sl.register_placer(def, preset) minetest.register_craftitem(":"..def.nodename_prefix.."_slopeplacer",{ description = attrans("@1 Slope", def.description), inventory_image = def.texture_prefix.."_slopeplacer.png", wield_image = def.texture_prefix.."_slopeplacer.png", groups={}, on_place = sl.create_slopeplacer_on_place(def, preset) }) end --(itemstack, placer, pointed_thing) function sl.create_slopeplacer_on_place(def, preset) return function(istack, player, pt) if not pt.type=="node" then minetest.chat_send_player(player:get_player_name(), attrans("Can't place: not pointing at node")) return istack end local pos=pt.above if not pos then minetest.chat_send_player(player:get_player_name(), attrans("Can't place: not pointing at node")) return istack end local node=minetest.get_node(pos) if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].buildable_to then minetest.chat_send_player(player:get_player_name(), attrans("Can't place: space occupied!")) return istack end if not advtrains.check_track_protection(pos, player:get_player_name()) then minetest.record_protection_violation(pos, player:get_player_name()) return istack end --determine player orientation (only horizontal component) --get_look_horizontal may not be available local yaw=player.get_look_horizontal and player:get_look_horizontal() or (player:get_look_yaw() - math.pi/2) --rounding unit vectors is a nice way for selecting 1 of 8 directions since sin(30°) is 0.5. dirvec={x=math.floor(math.sin(-yaw)+0.5), y=0, z=math.floor(math.cos(-yaw)+0.5)} --translate to direction to look up inside the preset table local param2, rot45=({ [-1]={ [-1]=2, [0]=3, [1]=3, }, [0]={ [-1]=2, [1]=0, }, [1]={ [-1]=1, [0]=1, [1]=0, }, })[dirvec.x][dirvec.z], dirvec.x~=0 and dirvec.z~=0 local lookup=preset.slopeplacer if rot45 then lookup=preset.slopeplacer_45 end --go unitvector forward and look how far the next node is local step=1 while step<=lookup.max do local node=minetest.get_node(vector.add(pos, dirvec)) --next node solid? if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].buildable_to or advtrains.is_protected(pos, player:get_player_name()) then