Wiki source code of Track Environment
Last modified by stu114754 on 2025/01/30 12:19
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | == Inputs == | ||
2 | |||
3 | (% class="relative-table wrapped" style="width: 99.8862%;" %) | ||
4 | |=((( | ||
5 | Name | ||
6 | )))|=(% colspan="1" %)(% colspan="1" %) | ||
7 | ((( | ||
8 | Type | ||
9 | )))|=((( | ||
10 | Range | ||
11 | )))|=((( | ||
12 | Short description | ||
13 | ))) | ||
14 | |((( | ||
15 | TrackSpeeds | ||
16 | )))|(% colspan="1" %)(% colspan="1" %) | ||
17 | ((( | ||
18 | int[48] | ||
19 | )))|((( | ||
20 | [ -255 , 255 ] | ||
21 | )))|((( | ||
22 | The speed per track. Track names can be used as indices. (e.g. KH_ST_0) | ||
23 | ))) | ||
24 | |((( | ||
25 | Points | ||
26 | )))|(% colspan="1" %)(% colspan="1" %) | ||
27 | ((( | ||
28 | int[30] | ||
29 | )))|((( | ||
30 | {BRANCH, STRAIGHT} | ||
31 | )))|((( | ||
32 | The numbered values of the switchable intersection points. (e.g. 23) | ||
33 | ))) | ||
34 | |(% colspan="1" %)(% colspan="1" %) | ||
35 | ((( | ||
36 | TrackSignals | ||
37 | )))|(% colspan="1" %)(% colspan="1" %) | ||
38 | ((( | ||
39 | bool[40][2] | ||
40 | )))|(% colspan="1" %)(% colspan="1" %) | ||
41 | ((( | ||
42 | {true, false} | ||
43 | )))|(% colspan="1" %)(% colspan="1" %) | ||
44 | ((( | ||
45 | The signals on each track. If the track contains signals it's always two. Track names can be used as indices. (e.g. KH_ST_1) | ||
46 | ))) | ||
47 | |||
48 | == Outputs == | ||
49 | |||
50 | (% class="relative-table wrapped" style="width: 99.8359%;" %) | ||
51 | |=((( | ||
52 | Name | ||
53 | )))|=((( | ||
54 | Type | ||
55 | )))|=(% colspan="1" %)(% colspan="1" %) | ||
56 | ((( | ||
57 | Range | ||
58 | )))|=((( | ||
59 | Short description | ||
60 | ))) | ||
61 | |((( | ||
62 | TrainPositions | ||
63 | )))|((( | ||
64 | int[15] | ||
65 | )))|(% colspan="1" %)(% colspan="1" %) | ||
66 | ((( | ||
67 | [ 0 , 47 ] | ||
68 | )))|((( | ||
69 | The position, that a given train currently occupies. (e.g. Train TRAIN_KH_ST_0 occupies KH_ST_0 on startup) | ||
70 | ))) | ||
71 | |(% colspan="1" %)(% colspan="1" %) | ||
72 | ((( | ||
73 | TrainSpeeds | ||
74 | )))|(% colspan="1" %)(% colspan="1" %) | ||
75 | ((( | ||
76 | int[15] | ||
77 | )))|(% colspan="1" %)(% colspan="1" %) | ||
78 | ((( | ||
79 | [ -255 , 255 ] | ||
80 | )))|(% colspan="1" %)(% colspan="1" %) | ||
81 | ((( | ||
82 | The speed, that a given train currently occupies (e.g. Train TRAIN_KH_ST_0 has speed 100) | ||
83 | ))) | ||
84 | |(% colspan="1" %)(% colspan="1" %) | ||
85 | ((( | ||
86 | ForwardNext | ||
87 | )))|(% colspan="1" %)(% colspan="1" %) | ||
88 | ((( | ||
89 | int[48][5] | ||
90 | )))|(% colspan="1" %)(% colspan="1" %) | ||
91 | ((( | ||
92 | [ 0, 48 ] (-1 means invalid) | ||
93 | )))|(% colspan="1" %)(% colspan="1" %) | ||
94 | ((( | ||
95 | The next lines in the main direction. Each track can have at most 5 possible lines. -1 for all entries, that are not valid lines. (e.g. ForwardNext[KH_ST_1][0] == KH_ST_6, ForwardNext[KH_ST_1][1] == -1,...) | ||
96 | ))) | ||
97 | |(% colspan="1" %)(% colspan="1" %) | ||
98 | ((( | ||
99 | ReverseNext | ||
100 | )))|(% colspan="1" %)(% colspan="1" %) | ||
101 | ((( | ||
102 | int[48][5] | ||
103 | )))|(% colspan="1" %)(% colspan="1" %) | ||
104 | ((( | ||
105 | [ 0, 48 ] (-1 means invalid) | ||
106 | )))|(% colspan="1" %)(% colspan="1" %) | ||
107 | ((( | ||
108 | Same behaviour as ForwardNext, but in the secondary direction. If the secondary direction is not permitted all values are -1. | ||
109 | ))) | ||
110 | |=(% colspan="1" %)(% colspan="1" %) | ||
111 | ((( | ||
112 | Error | ||
113 | )))|=(% colspan="1" %)(% colspan="1" %) | ||
114 | ((( | ||
115 | string | ||
116 | )))|=(% colspan="1" %)(% colspan="1" %) | ||
117 | ((( | ||
118 | \\ | ||
119 | )))|=(% colspan="1" %)(% colspan="1" %) | ||
120 | ((( | ||
121 | Error messages. (e.g. If a required track signal did not trigger) | ||
122 | ))) | ||
123 | |||
124 | == Requirements == | ||
125 | |||
126 | For two directly connected Tracks the IDs of the Points that need to be passed (if any) including their direction (branch, straight). | ||
127 | |||
128 | Idea: A big matrix in the form of PointPositions[48][48][2][2]. So for each set of tracks the points (if any) and as value either branch or straight. | ||
129 | |||
130 | {{code}} | ||
131 | PointPositions[KH_LN_5][KH_LN_7][0] = {14, BRANCH} | ||
132 | PointPositions[KH_LN_5][KH_LN_7][1] = {null, null} | ||
133 | |||
134 | PointPositions[KH_ST_4][KH_ST_0][0] = {1, BRANCH} | ||
135 | PointPositions[KH_ST_4][KH_ST_0][1] = {2, BRANCH} | ||
136 | |||
137 | PointPositions[KH_LN_5][KH_LN_6][0] = {null, null} | ||
138 | |||
139 | ... | ||
140 | {{/code}} |