Difference between revisions of "TrainCarts/Signs/Switcher/zh-cn"
(Created page with "当条件匹配时,连接到道岔基础方块的拉杆会被切换为向下。当道岔激活,且条件匹配时,上方的铁轨也会切换到语句指定的方向。...") |
(Created page with "默认情况下,只有充能的道岔才能根据路径查找逻辑来切换铁轨。这可以在 TC 的 ''config.yml'' 中作为旧版本支持...") |
||
Line 9: | Line 9: | ||
当条件匹配时,连接到道岔基础方块的拉杆会被切换为向下。当道岔激活,且条件匹配时,上方的铁轨也会切换到语句指定的方向。当道岔被红石激活,或使用 [+train] 时,道岔将根据语句切换铁轨。这可能会导致列车在直行轨道部分上倒车。如果道岔主要用于在语句条件匹配时切换拉杆,则应使用 [-train] 以避免发生这种情况。 | 当条件匹配时,连接到道岔基础方块的拉杆会被切换为向下。当道岔激活,且条件匹配时,上方的铁轨也会切换到语句指定的方向。当道岔被红石激活,或使用 [+train] 时,道岔将根据语句切换铁轨。这可能会导致列车在直行轨道部分上倒车。如果道岔主要用于在语句条件匹配时切换拉杆,则应使用 [-train] 以避免发生这种情况。 | ||
− | + | 默认情况下,只有充能的道岔才能根据[[TrainCarts/PathFinding|路径查找]]逻辑来切换铁轨。这可以在 TC 的 ''config.yml'' 中作为旧版本支持的一部分进行修改,因为在过去的版本中情况并非如此。 | |
− | |||
− | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> |
Revision as of 08:24, 2 September 2024
介绍
转辙器控制牌(以下简称道岔)可以读取上方列车或矿车的信息,并据此切换拉杆和铁轨。它还标记了路径查找路由网络的可切换节点。这使得道岔对于讲列车路由到目的地来说非常重要,无论是使用路径查找还是其他方式。
当条件匹配时,连接到道岔基础方块的拉杆会被切换为向下。当道岔激活,且条件匹配时,上方的铁轨也会切换到语句指定的方向。当道岔被红石激活,或使用 [+train] 时,道岔将根据语句切换铁轨。这可能会导致列车在直行轨道部分上倒车。如果道岔主要用于在语句条件匹配时切换拉杆,则应使用 [-train] 以避免发生这种情况。
默认情况下,只有充能的道岔才能根据路径查找逻辑来切换铁轨。这可以在 TC 的 config.yml 中作为旧版本支持的一部分进行修改,因为在过去的版本中情况并非如此。
Syntax
First line: [-train] to toggle only the lever based on the conditions, [+train] or other modes for switching the track
Second line: switcher or tag
Third line: The statement for when to switch the track left (if no direction prefix is specified)
Fourth line: The statement for when to switch the track right (if no direction prefix is specified)
For statements it can read cart tags, destination, passengers, items and several other states. It is also possible to sort the carts when using numeric values on the last two lines. This way you can make 1 train or cart go left out of every 3 trains or carts. The default statement is unique, in that it will only be true if no other statement on the sign is true, regardless of order. They are evaluated top to bottom.
Direction Prefixes
Statements can include a direction prefix to the left, such as l: or f:, to define where to send the train when the statement condition is true.
Statements
On the third and fourth lines you can put the statements to evaluate. You can insert a direction followed up by : and then the statement to set the direction to switch to. For example:
Will send all trains larger than 5 carts to the left, and trains with wood in storage minecarts to the right. It parses the statements from top to bottom, so wood-bearing trains larger than 5 carts are also sent to the left.
Switcher signs currently support wildcards only when matching to tags and player names (but not, for example, to train names).
Statement Continuation
Statements continue on signs below, provided they are all prefixed by a direction. Otherwise they will be ignored by the switcher sign. If you are not switching the track and only want a lever to be toggled, then you can use any direction prefix here, such as f: - it will have no effect in that case. The Redstone powered switcher example down below uses this feature.
Functions
As a detector
The switcher sign toggles a lever in addition to switching track. By using [-train] track switching can be disabled so that the switcher sign only toggles the lever. This can then be used to automatically detect changes in the train above, for example, when players enter the train.
Switching without train
To change the rails when triggered by redstone, without requiring a train to enter the rails first, both from and to directions can be specified. For example:
Will switch the rails north-east when powered by redstone, and north-west otherwise. This also works with TC-Coasters, by specifying the junction names ( 1-2:redstone )
Path finding
The switcher sign is also used during path finding. If a train or cart has a destination set, and no statements on the sign match (or no statements were set), it will toggle the rails to make the train go to the requested destination. If you need to force an alternative route or need to send 'passing through' trains around, add a statement on this sign to do so.
Sorter
If you need to sort carts onto multiple tracks, you can use an internal counter:
Right now it will send 3 trains to the left and then 4 trains to the right direction, after which the cycle repeats itself. You can put multiple switcher signs in line to equally divide the trains onto multiple tracks. This is shown in the video below:
Splitting trains
A train can be split at an arbitrary cart using a [+cart] switcher. This will switch halfway the train sending each section of the train in a different direction. Instead of fixed number (1 cart left, 1 cart right) a percentage can be used (50%) which will split the train in half, regardless of train cart count.
Examples
Redstone powered switcher
By using the redstone statements on the sign, you can completely control what direction to send the train to:
Automatic launching
By using a [-train]
passengers switcher sign, the lever is automatically toggled down once a player enters the train. This signal activates an inverted station sign, causing the train to launch into the opposite side that is powered. In this setup this launches the train left once a player enters. A redstone repeater delay can be used to debounce this.
Cart splitter
By using a [+cart]
switcher sign using the counter syntax, a long train can be split into individual carts. Each cart is sent onto one of three tracks, equally. The extra sign below the cart switcher sign extends the number of switching rules. Statements: l:1 r:1 f:1