Difference between revisions of "TrainCarts/Signs/Switcher/zh-cn"
(Created page with "=== 无列车是切换 ===") |
(Created page with "要在红石激活时改变铁轨,而不需要火车先进入轨道,可以指定从和到的方向。例如:") |
||
Line 55: | Line 55: | ||
=== 无列车是切换 === | === 无列车是切换 === | ||
− | + | 要在红石激活时改变铁轨,而不需要火车先进入轨道,可以指定从和到的方向。例如: | |
− | |||
− | |||
{{sign|[+train]|switcher|n-e:redstone|n-w:default}} | {{sign|[+train]|switcher|n-e:redstone|n-w:default}} |
Revision as of 11:14, 2 September 2024
介绍
转辙器控制牌(以下简称道岔)可以读取上方列车或矿车的信息,并据此切换拉杆和铁轨。它还标记了路径查找路由网络的可切换节点。这使得道岔对于讲列车路由到目的地来说非常重要,无论是使用路径查找还是其他方式。
当条件匹配时,连接到道岔基础方块的拉杆会被切换为向下。当道岔激活,且条件匹配时,上方的铁轨也会切换到语句指定的方向。当道岔被红石激活,或使用 [+train] 时,道岔将根据语句切换铁轨。这可能会导致列车在直行轨道部分上倒车。如果道岔主要用于在语句条件匹配时切换拉杆,则应使用 [-train] 以避免发生这种情况。
默认情况下,只有充能的道岔才能根据路径查找逻辑来切换铁轨。这可以在 TC 的 config.yml 中作为旧版本支持的一部分进行修改,因为在过去的版本中情况并非如此。
语法
第一行:[-train] 只根据条件来切换拉杆,[+train] 或其他模式会切换铁轨。
第二行: switcher 或 tag。
第三行:何时向左切换轨道的语句(如果没有定义方向前缀)。
第四行:何时向右切换轨道的语句(如果没有定义方向前缀)。
对于语句,它可以读取矿车的标签、目的地、乘客、物品和其他几个状态。在最后两行使用数值时,也可以对矿车进行排序。按照这个逻辑你可以实现每3列车/矿车就有1列车/矿车发往不同的方向,default 语句是唯一的,因为只有当道岔上的其他语句都为 false 时,它才会为 true,无论顺序如何。它们从上到下进行判定。
方向前缀
语句左侧可包含方向前缀,例如 l: 或 f:,用于当语句条件为 true 时定义列车发往的方向。
语句
在第三行和第四行,你可以设置要判定的语句。你可以插入方向,后跟 :(英文冒号),然后设置要切换的方向的语句。例如:
会将所有多余5个矿车的列车送往左侧,将装有木头的列车送往右侧。道岔会从上到下解析语句,因此大于5个矿车的装有木头的列车也会送往左侧。
道岔目前仅在与标签和玩家名称匹配时支持通配符(但是,与列车名称匹配时不支持)。
语句条件
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.
无列车是切换
要在红石激活时改变铁轨,而不需要火车先进入轨道,可以指定从和到的方向。例如:
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