TrainCarts/Signs/Statements [ja]

From BergerHealer Wiki
Jump to navigation Jump to search
(Created page with "もしトロッコに乗客がいなければ、Destroyサインを起動するようにします。")
No edit summary
 
(15 intermediate revisions by the same user not shown)
Line 13: Line 13:
もしトロッコに乗客がいなければ、Destroyサインを起動するようにします。
もしトロッコに乗客がいなければ、Destroyサインを起動するようにします。


<div lang="en" dir="ltr" class="mw-content-ltr">
==== アイテムの積み込みが終わったら発車する ====
==== Send the train once it contains items ====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
トロッコにアイテムが積み込まれたとき、Stationサインを起動します。
Once the train contains an item, power a station sign.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
==== 特定のプレイヤーのもとへ列車を送る ====
==== Send a train to a certain player ====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
もしトロッコのオーナーにプレイヤーが指定されていれば、線路の分岐はそのプレイヤーのもとへ向かうように切り替わります。
If the cart is owned by a set player, the track is toggled to lead to that player.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
== 記法 ==
== Syntax ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
ビックリマークをステートメントの頭に入れると、NOT――つまり否定――として動作します。もし一行目に''[cart]''を利用する場合は、動作・判定の対象が列車の代わりに個別のトロッコになります。''name@<array>''形式のステートメントは'''配列ステートメント'''と呼ばれ、特定のプロパティの複数の要素を判定することができます。たとえば、''i@wood''は列車の中のアイテムを覗いて、そこに木材が含まれているかどうかを調べます。複数のアイテムを利用したいときには、セミコロンで区切ることが可能です。たとえば''ed@north;south''と書くと、北もしくは南に向かう列車のみを対象にします。
You can put a !-sign in front of the statement to act as a NOT. You can read 'the train' as 'the cart' if [cart] is used on the first line. Statements with the format ''name@<array>'' are called '''array statements''' and can operate on multiple of a certain property. For example, ''i@wood'' operates on the items in the train, and checks if there is wood in there. For multiple items, delimit using a semicolon ( ; ), for example ''ed@north;south'' will match trains moving towards north or south only.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
多くのステートメントは'''演算子'''を利用します。演算子は次のとおりです。
Most statements also support '''operators'''. Operators are:
* '''=''':イコール(〜と等しい)
* = equals
* '''!=''':ノットイコール(〜ではない)
* != not equals
* '''>=''':〜以上
* >= greater or equal than
* '''<=''':〜以下
* <= smaller or equal than
* '''>''':より大きい
* > greater than
* '''<''':より小さい
* < smaller than
演算子を使う際は、ステートメントの末尾に付け加えて使用します。たとえば''minecarts>=5''とすると、列車の中に通常のトロッコが五個以上含まれているか、という意味になります。''trainsize>=5''とすると、チェストつきやかまどつきのトロッコも含めて数えます。ほか、演算子は配列ステートメントにおいても利用でき、''i@stone=64''とすると、列車の中にちょうど一スタックの石が含まれているかをチェックします。トロッコに乗っているモブをチェックする''m@cow>5''など、数量を利用するすべてのステートメントは演算子が利用できます。もし演算子が書かれていない場合は、デフォルトで''>0''――ゼロより大きい――がついているものとしてみなされます。ただしアイテムの場合は、アイテム名の頭につけられた数量が使われます。
To use an operator, append it after the statement. For example, ''minecarts>=5'' will check if there are more than 5 minecarts in the train. ''trainsize>=5'' also counts storage and powered minecarts. You can even use it in arrays. Using ''i@stone=64'' you can check if there are exactly 64 stone in the train. All statements that can be interpreted as an amount have operator support, including counting the amount of mobs in the train: ''m@cow>5''. If no operator is given the default operator ''>0'' is used, or in the case of items, the amount that is specified in front of the item name.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{| class="wikitable"
{| class="wikitable"
|-
|-
! Statement
! ステートメント
! Meaning
! 意味
|-
|-
| passenger
| passenger
| The train has a passenger
| 列車に乗客がいるか。
|-
|-
| items
| items
| The train contains a chest and has items
| 列車がチェストを含み、中にアイテムがあるか。
|-
|-
| empty
| empty
| The train has no passenger and no items
| 列車には乗客もアイテムもない。
|-
|-
| fuel
| fuel
| The train contains a furnace which has fuel
| 列車には燃料の入ったかまどがあるか。
|-
|-
| trainsize
| trainsize
| The train cart count matches (e.g.: trainsize>=3)
| 列車に含まれるトロッコの数。たとえば''trainsize>=3''などです。
|-
|-
| chest_minecart
| chest_minecart
| The train has a number of chest minecarts (e.g.: chest_minecart>=1). Also works for hoppers/powered/etc. types.
| 列車に含まれるチェスト付きトロッコの数。たとえば''chest_minecart>=1''など。同じように、hopperやpoweredなどのトロッコのタイプでも動作します。
|-
|-
| velocity<br>speed
| velocity<br>speed
| The train velocity (movement speed) can be evaluated, or gets if the train is moving
| 列車の移動速度の数値や、移動しているかどうか。
|-
|-
| powered
| powered
| The train contains a powered minecart
| 列車にかまどつきトロッコがあるか。
|-
|-
| storage
| storage
| The train contains a storage minecart
| 列車にチェスト付きトロッコがあるか。
|-
|-
| minecart
| minecart
| The train contains a regular minecart
| 列車に普通のトロッコがあるか。
|-
|-
| redstone
| redstone
| The sign is powered by redstone
| このサインに信号が供給されているか。
|-
|-
| maxspeed
| maxspeed
| Evaluate the maximum speed set
| 最大速度。
|-
|-
| mobenter
| mobenter
| Checks the mob enter property
| mobenterのプロパティ。
|-
|-
| playerenter
| playerenter
| Checks the player enter property
| playerenterのプロパティ。
|-
|-
| playerexit
| playerexit
| Checks the player exit property
| playerexitのプロパティ。
|-
|-
| destination
| destination
| Checks if a destination is set on the train
| 列車に目的地が設定されているかどうか。
|-
|-
| random
| random
| Has a 50% chance of turning on
| 50%の確率。
|-
|-
| n@<names><br>name@<names>
| n@<names><br>name@<names>
| The train name equals one of the names specified
| 列車名が指定された複数の名前のどれかにマッチする。
|-
|-
| i@<items>
| i@<items>
| The train contains one of the items specified
| 列車が指定された複数のアイテムのどれかを格納している。
|-
|-
| o@<owner>
| o@<owner>
| The train contains this owner
| 列車に所有者が乗っている。
|-
|-
| d@<destination>
| d@<destination>
| One cart in the train has this destination set
| 列車のトロッコのひとつがその目的地を設定している。
|-
|-
| p@<player>
| p@<player>
| The train is occupied by this player
| 列車がそのプレイヤーに乗られている。
|-
|-
| m@<mobnames>
| m@<mobnames>
| The train is occupied by one of these mobs
| 列車がそれらのモブのどれかに乗られている。
|-
|-
| pi@<items>
| pi@<items>
| One of the players has one of the items in his inventory
| プレイヤーの一人が、インベントリにそのアイテムのひとつを持っている。
|-
|-
| ph@<items>
| ph@<items>
| One of the players has one of the items in his hand
| プレイヤーが手にそのアイテムのひとつを持っている。
|-
|-
| ed@<directions>
| ed@<directions>
|The minecart is moving into a given direction (switcher: upon entering the sign)
| 列車がその方向に動いている。Switcherサインの場合、列車がサインを起動した際の向きを参照します。
|-
|-
| rs@<directions>
| rs@<directions>
| The sign is powered from one of the directions specified
| サインの看板がその方向からレッドストーン信号を受けている。
|-
|-
| Has a 30% chance of turning on (instead of the default 50%) (1.0 is equivalent to 100%)
| 30%の起動確率。デフォルトは0.5(50%)。1.0は100%を表します。
|-
|-
| anything<br>t@<tags>
| anything<br>t@<tags>
| For anything else the plugin checks if the train has it set as a tag
| それ以外のことについては、列車にタグがあるかどうかをプラグインが確認します。
|}
|}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
=== AND演算 ===
== And logic ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
通常はすべてOR演算で評価されますが、両方の条件を満たしているか調べたい場合は、二つのステートメントを反転させ、反転したサインに信号を出力すると実装できます。
Since everything is evaluated as an OR, how can you check if the train has two of the same? The easiest method is to invert two statements, toggling a lever which powers an inverted sign. For example:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 157: Line 136:
| {{sign|[!cart]|chest in|||}}
| {{sign|[!cart]|chest in|||}}
|-
|-
|colspan="2"|  If '''not''' owned by 'me' or '''not''' has tag 'a' then '''not''' transfer items
|colspan="2"|  もしmeに所有されて'''いない'''、またはタグaを持って'''いない'''場合、アイテムを輸送'''しない'''
|-
|-
|colspan="2"|  If owned by 'me' and has tag 'a' transfer items
|colspan="2"|  もしmeに所有されており、かつタグaを持っている場合はアイテムを輸送します。
|}
|}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
もし三つ以上のステートメントを評価したい場合など、この方法では難しいのであれば、複数のSwitcherとレッドストーン回路を組み合わせて用いて実装する必要があります。
If this proves too hard to do (you need to evaluate more than 3 statements), you will have to use a redstone circuit and multiple switcher signs instead.
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
== タグ ==
== Tags ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
上記の記法にかかれていないステートメントは、すべて列車のタグと比較して評価が行われます。タグを検索する際は、ワイルドカードを利用することができます。
For all statements other than in the syntax table above, the name is compared to tags on the train. To find the tags, you can use wildcards to check for multiple tags at once:
   * - タグを所有している。
   * - has a tag
   !* - タグを所有していない。
   !* - has no tags
   *a - タグ名の最後がaで終わるタグを持っている。
   *a - has a tag ending with 'a'
   a* - タグ名の最初がaで始まるタグを持っている。
   a* - has a tag starting with 'a'
   *a* - タグ名のどこかにaが含まれるタグを持っている。
   *a* - has a tag containing 'a'
   *ab*cd* - タグ名のどこかにabとcdが含まれるタグを持っている。
   *ab*cd* - has a tag containing both 'ab' and 'cd'
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
たとえば、次のサインは線路を切り替える時にタグを利用します。もし''station''から始まるタグを所有しているなら左へ、''main''を含むタグを持っていれば右へ切り替わります。もしどちらも持っていれば、まっすぐ進みます。
For example, the following sign uses tags to switch tracks. If the train contains a tag starting with ''station'' it goes left, if it contains a tag containing ''main'' it will go right. If it contains both, it will go straight ahead.
</div>


{{sign|[!train]|switcher|station*|*main*}}
{{sign|[!train]|switcher|station*|*main*}}

Latest revision as of 03:23, 23 July 2026

Other languages:

概要

SwitcherサインDetectorサインSkipサインはそれぞれの動作のためにステートメント、つまり条件文を利用します。基本的に三行目と四行目にステートメントを書きますが、場合によっては行数を拡張するため、サインの看板の下にさらに看板を追加することもできます。

ユースケース

列車をワールドの中でさまざまな場所にナビゲーションするとき、経路探索システムが向いています。もしそれぞれのトロッコを何らかの状態で識別したり、条件に応じて動作させるサインを選択したりしたいときには、ステートメントを利用できます。次にいくつかの利用例を掲載します。

空き車両を破壊する

もしトロッコに乗客がいなければ、Destroyサインを起動するようにします。

アイテムの積み込みが終わったら発車する

トロッコにアイテムが積み込まれたとき、Stationサインを起動します。

特定のプレイヤーのもとへ列車を送る

もしトロッコのオーナーにプレイヤーが指定されていれば、線路の分岐はそのプレイヤーのもとへ向かうように切り替わります。

記法

ビックリマークをステートメントの頭に入れると、NOT――つまり否定――として動作します。もし一行目に[cart]を利用する場合は、動作・判定の対象が列車の代わりに個別のトロッコになります。name@<array>形式のステートメントは配列ステートメントと呼ばれ、特定のプロパティの複数の要素を判定することができます。たとえば、i@woodは列車の中のアイテムを覗いて、そこに木材が含まれているかどうかを調べます。複数のアイテムを利用したいときには、セミコロンで区切ることが可能です。たとえばed@north;southと書くと、北もしくは南に向かう列車のみを対象にします。

多くのステートメントは演算子を利用します。演算子は次のとおりです。

  • =:イコール(〜と等しい)
  • !=:ノットイコール(〜ではない)
  • >=:〜以上
  • <=:〜以下
  • >:より大きい
  • <:より小さい

演算子を使う際は、ステートメントの末尾に付け加えて使用します。たとえばminecarts>=5とすると、列車の中に通常のトロッコが五個以上含まれているか、という意味になります。trainsize>=5とすると、チェストつきやかまどつきのトロッコも含めて数えます。ほか、演算子は配列ステートメントにおいても利用でき、i@stone=64とすると、列車の中にちょうど一スタックの石が含まれているかをチェックします。トロッコに乗っているモブをチェックするm@cow>5など、数量を利用するすべてのステートメントは演算子が利用できます。もし演算子が書かれていない場合は、デフォルトで>0――ゼロより大きい――がついているものとしてみなされます。ただしアイテムの場合は、アイテム名の頭につけられた数量が使われます。

ステートメント 意味
passenger 列車に乗客がいるか。
items 列車がチェストを含み、中にアイテムがあるか。
empty 列車には乗客もアイテムもない。
fuel 列車には燃料の入ったかまどがあるか。
trainsize 列車に含まれるトロッコの数。たとえばtrainsize>=3などです。
chest_minecart 列車に含まれるチェスト付きトロッコの数。たとえばchest_minecart>=1など。同じように、hopperやpoweredなどのトロッコのタイプでも動作します。
velocity
speed
列車の移動速度の数値や、移動しているかどうか。
powered 列車にかまどつきトロッコがあるか。
storage 列車にチェスト付きトロッコがあるか。
minecart 列車に普通のトロッコがあるか。
redstone このサインに信号が供給されているか。
maxspeed 最大速度。
mobenter mobenterのプロパティ。
playerenter playerenterのプロパティ。
playerexit playerexitのプロパティ。
destination 列車に目的地が設定されているかどうか。
random 50%の確率。
n@<names>
name@<names>
列車名が指定された複数の名前のどれかにマッチする。
i@<items> 列車が指定された複数のアイテムのどれかを格納している。
o@<owner> 列車に所有者が乗っている。
d@<destination> 列車のトロッコのひとつがその目的地を設定している。
p@<player> 列車がそのプレイヤーに乗られている。
m@<mobnames> 列車がそれらのモブのどれかに乗られている。
pi@<items> プレイヤーの一人が、インベントリにそのアイテムのひとつを持っている。
ph@<items> プレイヤーが手にそのアイテムのひとつを持っている。
ed@<directions> 列車がその方向に動いている。Switcherサインの場合、列車がサインを起動した際の向きを参照します。
rs@<directions> サインの看板がその方向からレッドストーン信号を受けている。
[email protected] 30%の起動確率。デフォルトは0.5(50%)。1.0は100%を表します。
anything
t@<tags>
それ以外のことについては、列車にタグがあるかどうかをプラグインが確認します。

AND演算

通常はすべてOR演算で評価されますが、両方の条件を満たしているか調べたい場合は、二つのステートメントを反転させ、反転したサインに信号を出力すると実装できます。

Signtemplate.png
[cart]
switcher
!o@me
!a
Signtemplate.png
[!cart]
chest in
もしmeに所有されていない、またはタグaを持っていない場合、アイテムを輸送しない
もしmeに所有されており、かつタグaを持っている場合はアイテムを輸送します。

もし三つ以上のステートメントを評価したい場合など、この方法では難しいのであれば、複数のSwitcherとレッドストーン回路を組み合わせて用いて実装する必要があります。


タグ

上記の記法にかかれていないステートメントは、すべて列車のタグと比較して評価が行われます。タグを検索する際は、ワイルドカードを利用することができます。

 * - タグを所有している。
 !* - タグを所有していない。
 *a - タグ名の最後がaで終わるタグを持っている。
 a* - タグ名の最初がaで始まるタグを持っている。
 *a* - タグ名のどこかにaが含まれるタグを持っている。
 *ab*cd* - タグ名のどこかにabとcdが含まれるタグを持っている。

たとえば、次のサインは線路を切り替える時にタグを利用します。もしstationから始まるタグを所有しているなら左へ、mainを含むタグを持っていれば右へ切り替わります。もしどちらも持っていれば、まっすぐ進みます。

Signtemplate.png
[!train]
switcher
station*
*main*