TrainCarts/Signs/Switcher [ja]

From BergerHealer Wiki
Jump to navigation Jump to search
(Created page with "レバーをSwitcherサインと同じブロックに繋げると、サインの内容に従って返り値としてオンオフを切り替えます。サインに電源が供給されている時は、条件文に従って上のレールの分岐も切り替えます。そのため、直線のレールでも列車が真逆の方向に進むかもしれません。もしもレールを切り替えずに、レバーだけを変化させたい場合には、''[-train]''...")
(Created page with "'''四行目''':分岐を右に切り替える際のステートメント。")
 
(3 intermediate revisions by the same user not shown)
Line 6: Line 6:
レバーをSwitcherサインと同じブロックに繋げると、サインの内容に従って返り値としてオンオフを切り替えます。サインに電源が供給されている時は、条件文に従って上のレールの分岐も切り替えます。そのため、直線のレールでも列車が真逆の方向に進むかもしれません。もしもレールを切り替えずに、レバーだけを変化させたい場合には、''[-train]''を利用してください。
レバーをSwitcherサインと同じブロックに繋げると、サインの内容に従って返り値としてオンオフを切り替えます。サインに電源が供給されている時は、条件文に従って上のレールの分岐も切り替えます。そのため、直線のレールでも列車が真逆の方向に進むかもしれません。もしもレールを切り替えずに、レバーだけを変化させたい場合には、''[-train]''を利用してください。


<div lang="en" dir="ltr" class="mw-content-ltr">
デフォルトでは、電源が供給されていないSwitcherサインは[[Special:MyLanguage/TrainCarts/PathFinding|経路探索]]においても線路を切り替えません。以前のバージョンでは仕様が異なっていたため、レガシーサポートとして''config.yml''から挙動を変更することができます。
By default only powered switcher signs switch the track using [[Special:MyLanguage/TrainCarts/PathFinding|path finding]] logic. This can be changed in Traincart's ''config.yml'' as part of legacy support, as in past versions this was not the case.
</div>


<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">
'''四行目''':分岐を右に切り替える際のステートメント。
'''Fourth line:''' ''The [[Special:MyLanguage/TrainCarts/Signs/Statements|statement]] for when to switch the track right (if no direction prefix is specified)''
</div>





Latest revision as of 02:18, 13 July 2026

Other languages:

概要

Swticherサインは列車やトロッコの情報を認識し、それに応じた分岐レールやレバーの切り替えを行います。経路探索においても、分岐を切り替えできるノードとして認識されます。経路探索などなどを活用して、列車をその目的地まで自動で進行させるのにとても役立ちます。

レバーをSwitcherサインと同じブロックに繋げると、サインの内容に従って返り値としてオンオフを切り替えます。サインに電源が供給されている時は、条件文に従って上のレールの分岐も切り替えます。そのため、直線のレールでも列車が真逆の方向に進むかもしれません。もしもレールを切り替えずに、レバーだけを変化させたい場合には、[-train]を利用してください。

デフォルトでは、電源が供給されていないSwitcherサインは経路探索においても線路を切り替えません。以前のバージョンでは仕様が異なっていたため、レガシーサポートとしてconfig.ymlから挙動を変更することができます。

記法

一行目:レバーだけ動作させる場合は[-train]を、レールも分岐させたいなら[+train]などを使います。

二行目switcherもしくはtag

三行目:分岐を左へ切り替える際に判定されるステートメント 。方向の前置詞が指定されていない場合のみです。

四行目:分岐を右に切り替える際のステートメント。


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


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:

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


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.

Signtemplate.png
[-train]
switcher
passengers


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:

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


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

Signtemplate.png
[+train]
switcher


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:

Signtemplate.png
[+train]
switcher
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:


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.

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


Examples

Redstone powered switcher

By using the redstone statements on the sign, you can completely control what direction to send the train to:

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