Difference between revisions of "TrainCarts/Signs/Switcher/zh-cn"

From BergerHealer Wiki
Jump to navigation Jump to search
(Created page with "默认情况下,只有充能的道岔才能根据路径查找逻辑来切换铁轨。这可以在 TC 的 ''config.yml'' 中作为旧版本支持...")
 
(67 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
== 介绍 ==
 
== 介绍 ==
  
转辙器控制牌(以下简称道岔)可以读取上方列车或矿车的信息,并据此切换拉杆和铁轨。它还标记了[[TrainCarts/PathFinding|路径查找]]路由网络的可切换节点。这使得道岔对于讲列车路由到目的地来说非常重要,无论是使用路径查找还是其他方式。
+
转辙器可以读取上方列车或矿车的信息,并以此判断来切换拉杆和铁轨。它还标记了[[TrainCarts/PathFinding|路线查找]]路由网络的切换节点。这使得转辙器对于将列车调度到目的地来说非常重要,无论是使用路线查找还是其他方式。
  
当条件匹配时,连接到道岔基础方块的拉杆会被切换为向下。当道岔激活,且条件匹配时,上方的铁轨也会切换到语句指定的方向。当道岔被红石激活,或使用 [+train] 时,道岔将根据语句切换铁轨。这可能会导致列车在直行轨道部分上倒车。如果道岔主要用于在语句条件匹配时切换拉杆,则应使用 [-train] 以避免发生这种情况。
+
当条件匹配时,附着在与转辙器相同方块的拉杆会被切换为开启状态。当转辙器处于工作状态且条件匹配时,上方的铁轨也会切换到语句指定的方向。当转辙器被红石激活或使用 [+train] 时,转辙器将根据语句切换铁轨。这可能会导致列车在直行轨道上倒车。如果只想让转辙器在语句条件匹配时只切换拉杆,则应使用 [-train] 以避免发生这种情况。
  
默认情况下,只有充能的道岔才能根据[[TrainCarts/PathFinding|路径查找]]逻辑来切换铁轨。这可以在 TC 的 ''config.yml'' 中作为旧版本支持的一部分进行修改,因为在过去的版本中情况并非如此。
+
默认情况下,只有激活的转辙器才能根据[[TrainCarts/PathFinding|路线查找]]逻辑来切换铁轨。这可以在 TC 的 ''config.yml'' 文件中进行修改(部分旧版本支持),因为在过去的版本中情况并非如此。
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
== 语法 ==
== Syntax ==
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
'''第一行:'''''[-train]'' 只根据条件来切换拉杆,''[+train]'' 或其他模式会切换铁轨。
'''First line:''' ''[-train]'' to toggle only the lever based on the conditions, ''[+train]'' or other modes for switching the track
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
'''第二行:''' ''switcher'' ''tag''
'''Second line:''' ''switcher'' or ''tag''
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
'''第三行:'''''何时向左切换轨道的[[Special:MyLanguage/TrainCarts/Signs/Statements|语句]](如果没有定义方向前缀)''
'''Third line:''' ''The [[Special:MyLanguage/TrainCarts/Signs/Statements|statement]] for when to switch the track left (if no direction prefix is specified)''
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
'''第四行:'''''何时向右切换轨道的[[Special:MyLanguage/TrainCarts/Signs/Statements|语句]](如果没有定义方向前缀)''
'''Fourth line:''' ''The [[Special:MyLanguage/TrainCarts/Signs/Statements|statement]] for when to switch the track right (if no direction prefix is specified)''
 
</div>
 
  
  
Line 35: Line 25:
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
[[Special:MyLanguage/TrainCarts/Signs/Statements|语句]]可以读取矿车的标签、目的地、乘客、物品和其他状态。在最后两行使用数值时,也可以对矿车进行排序。按照这个逻辑你可以实现每 3 辆列车/矿车就有 1 辆列车/矿车发往不同的方向,''default'' 语句是唯一的,因为只有当转辙器上的其他语句都为 false 时,它才会为 true,无论顺序如何。语句从上到下进行判定。
For [[Special:MyLanguage/TrainCarts/Signs/Statements|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.
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 方向前缀 ===
=== Direction Prefixes ===
+
语句左侧可包含方向前缀,例如 ''l:'' ''f:'',用于当语句条件为 true 时定义列车发往的方向。
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.
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 语句 ===
=== Statements ===
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
在第三行和第四行,你可以设置要评估的语句。你可以输入[[Special:MyLanguage/TrainCarts/Signs/Direction|方向]],后跟 ''':'''(英文冒号),然后设置要切换的方向语句。例如:
On the third and fourth lines you can put the statements to evaluate. You can insert a [[Special:MyLanguage/TrainCarts/Signs/Direction|direction]] followed up by ''':''' and then the statement to set the direction to switch to. For example:
 
</div>
 
  
 
{{sign|[!train]|switcher|1:<trainsize>|r:i@wood}}
 
{{sign|[!train]|switcher|1:<trainsize>|r:i@wood}}
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
会将所有超过 5 个车厢的列车发往左侧,装有木头的列车发往右侧。转辙器会从上到下解析语句,因此超过 5 辆车厢且装有木头的列车也会发往左侧。
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.
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
转辙器目前仅支持标签和玩家名称使用通配符(例如列车名称就不支持通配符)。
Switcher signs currently support wildcards only when matching to tags and player names (but not, for example, to train names).
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 语句条件 ===
=== Statement Continuation ===
+
要在下方的控制牌继续使用语句,则必须带有方向前缀,否则转辙器会忽略它们。如果你只想切换拉杆而不切换轨道,那你可以在这里添加任何方向前缀,比如 ''f:'' ,不过不会产生任何效果。[[#Redstone powered switcher|红石充能切换器]]示例使用了这一功能。
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|Redstone powered switcher]] example down below uses this feature.
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
== 功能 ==
== Functions ==
+
=== 作为检测器 ===
=== As a detector ===
+
转辙器除了可以切换铁轨外还可以切换拉杆。使用 [-train] 可以关闭切换铁轨的功能,让转辙器只能切换拉杆。该功能可用于检测上方列车的变化。例如,当玩家进入列车时。
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.
 
</div>
 
  
 
{{sign|[-train]|switcher|passengers|}}
 
{{sign|[-train]|switcher|passengers|}}
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 无列车切换 ===
=== Switching without train ===
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
要在红石激活时切换轨道,而不需要火车先进入轨道,可以指定从和到的方向。例如:
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:
 
</div>
 
  
 
{{sign|[+train]|switcher|n-e:redstone|n-w:default}}
 
{{sign|[+train]|switcher|n-e:redstone|n-w:default}}
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
当由红石激活时,将铁轨转向东北,否则转向西北。这也适用于 TC-Coasters,通过指定连接点名称(1-2:redstone)
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 )
 
</div>
 
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 路线查找 ===
=== Path finding ===
 
</div>
 
  
 
{{sign|[+train]|switcher}}
 
{{sign|[+train]|switcher}}
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
转辙器也可用于[[TrainCarts/PathFinding|路线查找]]。如果列车或矿车设置了目的地,并且转辙器上没有与之匹配的语句(或没有设置任何语句),它将切换轨道以使列车前往指定的目的地。如果你需要强制选择替代路线或需要让'通过'的列车绕行,请在该转辙器上添加一条语句来执行此操作。
The switcher sign is also used during [[TrainCarts/PathFinding|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.
 
</div>
 
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 分配 ===
=== Sorter ===
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
如果你需要将矿车分配到多条轨道上,则可以使用计数逻辑:
If you need to sort carts onto multiple tracks, you can use an internal counter:
 
</div>
 
  
 
{{sign|[+train]|switcher|3|4}}
 
{{sign|[+train]|switcher|3|4}}
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
这个示例中,转辙器将向左发送 3 辆列车,然后向右发送 4 辆列车,之后不断循环。您可以将多个转辙器排成一排,将列车均匀地划分到多条轨道上。以下视频展示了这一点:
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:
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
 
 
https://www.youtube.com/watch?v=8KCfenk3Vi8
 
https://www.youtube.com/watch?v=8KCfenk3Vi8
</div>
 
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 拆分列车 ===
=== Splitting trains ===
+
使用 [+cart] 的转辙器可以将列车在任意一个车厢的位置分开。这会在列车的中间部分驶进转辙器时切换轨道,将分开的部分发往不同的方向。可以使用百分比(比如50%),而不是整数值(比如左边一辆,右边一辆),无论列车中矿车的数量多少,都会将列车分成两半。
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.
 
 
{{sign|[+cart]|switcher|50%|50%}}
 
{{sign|[+cart]|switcher|50%|50%}}
</div>
 
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
== 示例 ==
== Examples ==
+
=== 红石充能切换器 ===
=== Redstone powered switcher ===
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
当在控制牌上使用 redstone 语句时,你可以完全控制将列车发往哪个方向:
By using the redstone statements on the sign, you can completely control what direction to send the train to:
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
[[File:TrainCarts Redstone Switcher.png|600px|一个丁字路口红石转辙器示例。]]
[[File:TrainCarts Redstone Switcher.png|600px|3-way redstone switcher]]
 
</div>
 
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 自动启动 ===
=== Automatic launching ===
+
使用<code>[-train]</code>passengers 转辙器时,一旦玩家进入列车,拉杆就会自动切换为开启状态,这个红石信号激活了一个相反的车站牌,使列车会向着有动力的一侧方向启动。在这里,一旦玩家进入,列车就会向左侧启动。红石中继器可用于延迟。
By using a <code>[-train]</code> 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.
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
[[File:Tc_switcher_station.png|600px|转辙器通过拉杆激活车站来自动启动列车。]]
[[File:Tc_switcher_station.png|600px|Switcher sign lever powers the station to automatically launch the train]]
 
</div>
 
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 矿车分割器 ===
=== Cart splitter ===
+
<code>[+cart]</code>转辙器使用计数逻辑,一辆长列车就会被分割为一个个矿车。每辆矿车被平均分至 3 条轨道中的其中一条。单矿车转辙器下方的扩展控制牌增加了调车规则的数量。语句为:<code>l:1 r:1 f:1</code>
By using a <code>[+cart]</code> 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: <code>l:1 r:1 f:1</code>
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
[[File:Tc_cart_switcher_sorter.png|600px|单矿车模式的转辙器将列车每每分成三辆矿车,发往三条轨道。]]
[[File:Tc_cart_switcher_sorter.png|600px|Cart switcher sign splits a train into individual carts onto three lanes]]
 
</div>
 

Latest revision as of 08:53, 6 September 2024

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] 的转辙器可以将列车在任意一个车厢的位置分开。这会在列车的中间部分驶进转辙器时切换轨道,将分开的部分发往不同的方向。可以使用百分比(比如50%),而不是整数值(比如左边一辆,右边一辆),无论列车中矿车的数量多少,都会将列车分成两半。

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


示例

红石充能切换器

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

一个丁字路口红石转辙器示例。


自动启动

使用[-train]passengers 转辙器时,一旦玩家进入列车,拉杆就会自动切换为开启状态,这个红石信号激活了一个相反的车站牌,使列车会向着有动力的一侧方向启动。在这里,一旦玩家进入,列车就会向左侧启动。红石中继器可用于延迟。

转辙器通过拉杆激活车站来自动启动列车。


矿车分割器

[+cart]转辙器使用计数逻辑,一辆长列车就会被分割为一个个矿车。每辆矿车被平均分至 3 条轨道中的其中一条。单矿车转辙器下方的扩展控制牌增加了调车规则的数量。语句为:l:1 r:1 f:1

单矿车模式的转辙器将列车每每分成三辆矿车,发往三条轨道。