TrainCarts/控制牌/转辙器

From BergerHealer Wiki
Revision as of 03:09, 3 September 2024 by Halogly (talk | contribs)
Jump to navigation Jump to search
Other languages:
English • ‎中文(中国大陆)‎

« 返回


介绍

转辙器控制牌(以下简称道岔)可以读取上方列车或矿车的信息,并据此切换拉杆和铁轨。它还标记了路径查找路由网络的可切换节点。这使得道岔对于讲列车路由到目的地来说非常重要,无论是使用路径查找还是其他方式。

当条件匹配时,连接到道岔基础方块的拉杆会被切换为向下。当道岔激活,且条件匹配时,上方的铁轨也会切换到语句指定的方向。当道岔被红石激活,或使用 [+train] 时,道岔将根据语句切换铁轨。这可能会导致列车在直行轨道部分上倒车。如果道岔主要用于在语句条件匹配时切换拉杆,则应使用 [-train] 以避免发生这种情况。

默认情况下,只有充能的道岔才能根据路径查找逻辑来切换铁轨。这可以在 TC 的 config.yml 中作为旧版本支持的一部分进行修改,因为在过去的版本中情况并非如此。

语法

第一行:[-train] 只根据条件来切换拉杆,[+train] 或其他模式会切换铁轨。

第二行: switchertag

第三行:何时向左切换轨道的语句(如果没有定义方向前缀)

第四行:何时向右切换轨道的语句(如果没有定义方向前缀)


Signtemplate.png
[train]
switcher
t@mytag
r:default


对于语句,它可以读取矿车的标签、目的地、乘客、物品和其他几个状态。在最后两行使用数值时,也可以对矿车进行排序。按照这个逻辑你可以实现每3列车/矿车就有1列车/矿车发往不同的方向,default 语句是唯一的,因为只有当道岔上的其他语句都为 false 时,它才会为 true,无论顺序如何。它们从上到下进行判定。

方向前缀

语句左侧可包含方向前缀,例如 l:f:,用于当语句条件为 true 时定义列车发往的方向。

语句

在第三行和第四行,你可以设置要判定的语句。你可以插入方向,后跟 :(英文冒号),然后设置要切换的方向的语句。例如:

Signtemplate.png
[!train]
switcher
1:<trainsize>
r:i@wood


会将所有多余5个矿车的列车送往左侧,将装有木头的列车送往右侧。道岔会从上到下解析语句,因此大于5个矿车的装有木头的列车也会送往左侧。

道岔目前仅在与标签和玩家名称匹配时支持通配符(但是,与列车名称匹配时不支持)。

语句条件

要在下方的控制牌继续使用语句,必须带有方向前缀,否则道岔会忽略它们。如果你只想切换拉杆而不切换轨道,那么你可以在这里添加任何方向前缀,比如 f:,在这种情况下不会产生任何效果。红石充能切换器示例使用了这一功能。

功能

作为检测器

道岔除了可以切换轨道外还可以切换拉杆。使用 [-train] 可以关闭切换轨道的功能,让道岔只能切换拉杆。该功能可用于自动检测上方列车的变化,举个例子,当玩家进入列车时。

Signtemplate.png
[-train]
switcher
passengers


无列车切换

要在红石激活时改变铁轨,而不需要火车先进入轨道,可以指定从和到的方向。例如:

Signtemplate.png
[+train]
switcher
n-e:redstone
n-w:default


当由红石激活时,将铁轨转向东北,否则转向西北。这也适用于 TC-Coasters,通过指定连接点名称(1-2:redstone)


路径查找

Signtemplate.png
[+train]
switcher

道岔也可用于路径查找。如果列车或矿车设置了目的地,并且道岔上没有匹配的语句(或没有设置任何语句),它将切换轨道以使火车前往请求的目的地。如果你需要强制选择替代路线或需要让'通过'的列车绕行,请在此道岔上添加一条语句来执行此操作。


分配

如果你需要将矿车分配到多条轨道上,则可以使用计数器:

Signtemplate.png
[+train]
switcher
3
4


这个示例中,道岔将向左发送 3 列车,然后向右发送 4 列车,之后循环重复。您可以将多个道岔排成一线,以将列车均匀地划分到多条轨道上。以下视频显示了这一点:

https://www.youtube.com/watch?v=8KCfenk3Vi8


拆分列车

可以使用 [+cart] 道岔将列车在任意的车厢位置分开。这会在列出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.

Signtemplate.png
[+cart]
switcher
50%
50%


示例

红石充能切换器

当在控制牌上使用红石语句时,你可以完全决定将列车发往哪个方向:

3-way redstone switcher


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.

Switcher sign lever powers the station to automatically launch the train


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

Cart switcher sign splits a train into individual carts onto three lanes