Difference between revisions of "TrainCarts/PathFinding/zh"

From BergerHealer Wiki
Jump to navigation Jump to search
(Created page with "== 配置方法 ==")
(Updating to match new version of source page)
 
(21 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
==简介==
 
==简介==
  
[[Special:MyLanguage/Image:Pathfinding.png|thumb|right|Setup of 3 destinations and a switcher sign to route trains between them]]
+
<div class="mw-translate-fuzzy">
 +
<gallery mode="slideshow">
 +
File:Pathfinding.png|设置三个路径点,switcher控制牌会将列车按照各自的destination属性调度到不同轨道上。
 +
</gallery>
 +
</div>
  
 
我们可以通过TC插件的switcher、blocker和destination控制牌的相互配合,实现一个复杂的铁路系统,让不同列车前往不同的目的地。在本页面中将介绍自动寻路系统的工作原理以及配置方式。
 
我们可以通过TC插件的switcher、blocker和destination控制牌的相互配合,实现一个复杂的铁路系统,让不同列车前往不同的目的地。在本页面中将介绍自动寻路系统的工作原理以及配置方式。
  
TC插件可以在路网中设定路径点,同时通过列车自身的路径点属性将列车导向不同的方向。配置路径点的信息请参阅[[Special:MyLanguage/TrainCarts/Signs/Destination|此界面]]。在路网中,[[Special:MyLanguage/TrainCarts/Signs/Destination|道岔]]以及路径点的位置被称为“节点”。为了避免列车冲突,可以使用[[Special:MyLanguage/TrainCarts/Signs/Blocker|路阻]]来限制自动寻路的方向。
+
TC插件可以在路网中设定路径点,同时通过列车自身的路径点属性将列车导向不同的方向。配置路径点的信息请参阅[[Special:MyLanguage/TrainCarts/Signs/Destination|此界面]]。在路网中,[[Special:MyLanguage/TrainCarts/Signs/Destination|道岔]]以及路径点的位置被称为“节点”。为了避免列车冲突,[[Special:MyLanguage/TrainCarts/Signs/Blocker|路阻]]控制牌能限制自动寻路的方向。
  
  
Line 17: Line 21:
 
=== 设定路径点 ===
 
=== 设定路径点 ===
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
首先将destination控制牌放置在轨道下方,在第三行写上这个路径点的名称。第四行可以为经过的列车设置一个新的路径点(这一行可以留空,列车经过此路径点之后destination属性清空)。
Start by placing down destination signs with a name for the destination on the third line. The fourth line can be used to set a new destination to go to once a train goes over the sign, but can be left empty.
 
 
<gallery mode="slideshow">
 
<gallery mode="slideshow">
File:Pathfinding_Destination.png|Station with destination sign. Trains can go here, are stopped for 30 seconds, then move on to the right.
+
File:Pathfinding_Destination.png|一个拥有destination控制牌的车站,自动寻路系统会将对应的列车导向这个车站。列车停靠30秒之后向右发车。
 
</gallery>
 
</gallery>
</div>
 
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 设置新的道岔节点 ===
=== Designate the switched nodes ===
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
在道岔处放置一个一直激活的switcher控制牌,TC插件会将道岔识别为路网节点。当一列火车驶入道岔时,插件会根据线路情况自动计算出一条路径,并按照此路径切换轨道,把列车引导到对应的轨道上。需要注意的是,这个节点和现实中的道岔并不完全相同。如果给列车设定的路径点在驶入方向的后方,列车会被“弹回去”。
Places where the track should be switched need to have an always-powered switcher sign placed. Now when a train moves over it that has a destination set, a route will be calculated and then the track is switched.
 
 
<gallery mode="slideshow">
 
<gallery mode="slideshow">
File:Pathfinding_Switcher.png|Switcher sign will automatically switch the track to go from/to any of the 3 directions.
+
File:Pathfinding_Switcher.png|switcher控制牌会将列车调度至三个方向的轨道上。
 
</gallery>
 
</gallery>
</div>
 
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 设置单行线路 ===
=== Enforce one direction ===
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
因为插件在自动寻路时会设定最短路径,但有时候这个路径会造成进路冲突。所以我们需要在某些路段人为规定行车方向。例如,如果我们希望列车在复线轨道上只朝一个方向行驶,这时可以使用blocker控制牌,让插件计算路径时把可能造成反向行车的路径排除在外。
When it is desirable that trains only ever go in one direction over a piece of track, an always-powered blocker sign can be used. This is useful when having two tracks side-by-side, each going in opposing directions. The path finding system will automatically ignore paths that are blocked by blocker signs.
 
 
<gallery mode="slideshow">
 
<gallery mode="slideshow">
File:Pathfinding_Blocker.png|With ''[+train:left]'' trains coming from the left are blocked, only allowing movement from right to left. Similarly, ''[+train:right]'' and other directions can be used.
+
File:Pathfinding_Blocker.png|在第一行写入 ''[+train:left]'' 可以阻挡左侧开过来的列车,只让列车从右往左走。同样地, ''[+train:right]'' 就是让列车只能从左往右走,阻挡右侧开过来的列车。
 
</gallery>
 
</gallery>
</div>
 
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 来试试吧 ===
=== Test it out ===
 
</div>
 
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
首先,将矿车放在轨道上,然后输入[[Special:MyLanguage/TrainCarts/Commands#Destination|路径点指令]]来为其设置一个路径点:
Place down a minecart on the track, and use the [[Special:MyLanguage/TrainCarts/Commands#Destination|Destination command]] to set a destination:
+
<pre>/train destination [路径点名称]
<pre>/train destination [name]
 
 
/train destination output</pre>
 
/train destination output</pre>
Now give the minecart a push towards the switcher sign, and observe how it will automatically switch the track to send the train towards the destination. You can change the destination again and send it to the switcher again. Continue to experiment with multiple switchers, blockers and destinations.
+
之后,手动把列车推向下方有switcher控制牌的道岔,您现在能观察到插件是如何自动地改变轨道方向,并将列车调度到不同轨道上的。同样,您可以继续使用之前提到过的命令为列车设置新的路径点,然后再将它们推向道岔,重复观察自动寻路系统的运作机制。当您熟悉了以后,您可以在轨道上加入更多的switcher,blocker和destination控制牌并进行大规模试验。
</div>
 
  
 
<div lang="en" dir="ltr" class="mw-content-ltr">
 
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 70: Line 60:
 
{{sign|[+train]|property|destination|outpost}}
 
{{sign|[+train]|property|destination|outpost}}
  
 +
 +
== 高级功能 ==
 +
 +
上面介绍的是基础功能,接下来还有更多高级功能值得我们讨论。
 +
 +
<div lang="en" dir="ltr" class="mw-content-ltr">
 +
=== Useful Side-Features ===
 +
</div>
  
 
<div lang="en" dir="ltr" class="mw-content-ltr">
 
<div lang="en" dir="ltr" class="mw-content-ltr">
== Advanced ==
+
==== Keep Chunks Loaded ====
 +
Prevent trains unloading when no player is nearby or in the train, by enabling the train [[TrainCarts/Signs/Property|keep chunks loaded property]].
 
</div>
 
</div>
  
 
<div lang="en" dir="ltr" class="mw-content-ltr">
 
<div lang="en" dir="ltr" class="mw-content-ltr">
Once the basic system is understood, there are some more complicated features to discuss.
+
You can use this property sign to set it:
 +
{{sign|[+train]|property|keepchunksloaded|true}}
 
</div>
 
</div>
  
 +
<div lang="en" dir="ltr" class="mw-content-ltr">
 +
Or you can create your train, use <code>/train keeploaded true</code> and save it under a saved train name using <code>/train save name</code>. You can then automatically spawn it by this name using the [[TrainCarts/Signs/Spawner#Automated_spawning|spawner sign]].
 +
</div>
  
 
<div lang="en" dir="ltr" class="mw-content-ltr">
 
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Debugger ===
+
==== Wait Distance ====
 +
To maintain distance between trains and avoid collisions over long stretches, use the [[TrainCarts/Signs/Property#Wait_Property|wait distance property]].
 
</div>
 
</div>
  
 
<div lang="en" dir="ltr" class="mw-content-ltr">
 
<div lang="en" dir="ltr" class="mw-content-ltr">
[[File:Pathfinding_Debug_Destinations.png|thumb|Displays the destinations with a distance to them]]
+
==== Mutex Zones ====
The plugin offers a ''debug stick'' with which path finding information can be displayed. Use the stick item to click on rails to show information about the route(s) that can be taken. Sneak (shift) while clicking performs a ''reroute'', which recalculates the track reachable from where you clicked. If you have multiple smaller rail networks, this can be more efficient than executing the global reroute command.
+
Protects intersections against collisions with [[TrainCarts/Signs/Mutex|mutex zones]].
 
</div>
 
</div>
  
 +
<div lang="en" dir="ltr" class="mw-content-ltr">
 +
==== Station Routing ====
 +
[[TrainCarts/Signs/Station|Station signs]] can launch the train into the direction of the next destination.
 +
</div>
  
 
<div lang="en" dir="ltr" class="mw-content-ltr">
 
<div lang="en" dir="ltr" class="mw-content-ltr">
==== All destinations ====
+
{{sign|[!train]|station||route}}
 +
</div>
 +
 
 +
 
 +
=== 故障处理 ===
 +
 
 +
<div class="mw-translate-fuzzy">
 +
[[File:Pathfinding_Debug_Destinations.png|thumb|Displays the destinations with a distance to them]]
 +
TC插件提供了可以在游戏界面显示路径信息的"调试棒"。手持调试棒右键轨道,轨道上方就会为每条路径生成不同颜色的粒子效果。当潜行时手持调试棒右键轨道,插件就会重新计算以点击位置为起点,前往各个可达路径点的路径。如果服务器中有多个小规模铁路网络,这么做可以比手动输入/train reroute更有效率,因为这个指令是将全地图的整个路网都重新计算一次。
 
</div>
 
</div>
 +
 +
 +
==== 所有路径点 ====
  
 
<div lang="en" dir="ltr" class="mw-content-ltr">
 
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 101: Line 120:
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
==== 单一路径点 ====
==== A single destination ====
 
</div>
 
  
 
<div lang="en" dir="ltr" class="mw-content-ltr">
 
<div lang="en" dir="ltr" class="mw-content-ltr">
[[File:Pathfinding_Debug_Destination_Specific.png|thumb|Displays the precise route to one destination]]
+
[[File:Pathfinding_Debug_Destination_Specific_One.png|thumb|Displays the precise route to one destination]]
 
Use the following command to debug a specific destination:
 
Use the following command to debug a specific destination:
 
<pre>/train debug destination [destination]</pre>
 
<pre>/train debug destination [destination]</pre>
Line 113: Line 130:
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
=== 路径管理 ===
=== Route Manager ===
 
</div>
 
  
 
<div lang="en" dir="ltr" class="mw-content-ltr">
 
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 122: Line 137:
  
  
<div lang="en" dir="ltr" class="mw-content-ltr">
+
==== 指令 ====
==== Commands ====
 
</div>
 
  
 
<div lang="en" dir="ltr" class="mw-content-ltr">
 
<div lang="en" dir="ltr" class="mw-content-ltr">

Latest revision as of 15:47, 12 January 2024

Other languages:
English • ‎中文 • ‎中文(中国大陆)‎

« 返回上一页


简介

我们可以通过TC插件的switcher、blocker和destination控制牌的相互配合,实现一个复杂的铁路系统,让不同列车前往不同的目的地。在本页面中将介绍自动寻路系统的工作原理以及配置方式。

TC插件可以在路网中设定路径点,同时通过列车自身的路径点属性将列车导向不同的方向。配置路径点的信息请参阅此界面。在路网中,道岔以及路径点的位置被称为“节点”。为了避免列车冲突,路阻控制牌能限制自动寻路的方向。


配置方法

设定路径点

首先将destination控制牌放置在轨道下方,在第三行写上这个路径点的名称。第四行可以为经过的列车设置一个新的路径点(这一行可以留空,列车经过此路径点之后destination属性清空)。


设置新的道岔节点

在道岔处放置一个一直激活的switcher控制牌,TC插件会将道岔识别为路网节点。当一列火车驶入道岔时,插件会根据线路情况自动计算出一条路径,并按照此路径切换轨道,把列车引导到对应的轨道上。需要注意的是,这个节点和现实中的道岔并不完全相同。如果给列车设定的路径点在驶入方向的后方,列车会被“弹回去”。


设置单行线路

因为插件在自动寻路时会设定最短路径,但有时候这个路径会造成进路冲突。所以我们需要在某些路段人为规定行车方向。例如,如果我们希望列车在复线轨道上只朝一个方向行驶,这时可以使用blocker控制牌,让插件计算路径时把可能造成反向行车的路径排除在外。


来试试吧

首先,将矿车放在轨道上,然后输入路径点指令来为其设置一个路径点:

/train destination [路径点名称]
/train destination output

之后,手动把列车推向下方有switcher控制牌的道岔,您现在能观察到插件是如何自动地改变轨道方向,并将列车调度到不同轨道上的。同样,您可以继续使用之前提到过的命令为列车设置新的路径点,然后再将它们推向道岔,重复观察自动寻路系统的运作机制。当您熟悉了以后,您可以在轨道上加入更多的switcher,blocker和destination控制牌并进行大规模试验。

If you run into a problem where the switcher appears to make a mistake, use the Reroute command to force a recalculation of all routing information:

/train reroute

It is also possible to use the property sign to set a destination:

Signtemplate.png
[+train]
property
destination
outpost


高级功能

上面介绍的是基础功能,接下来还有更多高级功能值得我们讨论。

Useful Side-Features

Keep Chunks Loaded

Prevent trains unloading when no player is nearby or in the train, by enabling the train keep chunks loaded property.

You can use this property sign to set it:

Signtemplate.png
[+train]
property
keepchunksloaded
true

Or you can create your train, use /train keeploaded true and save it under a saved train name using /train save name. You can then automatically spawn it by this name using the spawner sign.

Wait Distance

To maintain distance between trains and avoid collisions over long stretches, use the wait distance property.

Mutex Zones

Protects intersections against collisions with mutex zones.

Station Routing

Station signs can launch the train into the direction of the next destination.

Signtemplate.png
[!train]
station
route


故障处理

Displays the destinations with a distance to them

TC插件提供了可以在游戏界面显示路径信息的"调试棒"。手持调试棒右键轨道,轨道上方就会为每条路径生成不同颜色的粒子效果。当潜行时手持调试棒右键轨道,插件就会重新计算以点击位置为起点,前往各个可达路径点的路径。如果服务器中有多个小规模铁路网络,这么做可以比手动输入/train reroute更有效率,因为这个指令是将全地图的整个路网都重新计算一次。


所有路径点

Use the following command to get a stick item that displays all destinations reached from a given track:

/train debug destination

The track clicked is followed until a node of the track network is found, after which all routeable destinations are listed. For every destination the total distance to it is listed, and particles are displayed leading into it. If you find that a certain destination is not listed that should be, you can move further along the track clicking occasionally to find where the break is.


单一路径点

Displays the precise route to one destination

Use the following command to debug a specific destination:

/train debug destination [destination]

Now when you click on the track, particles are displayed what route is taken to reach the destination. This is useful when debugging a specific destination so no particles are displayed for routes and destinations that aren't relevant to you.


路径管理

Normally only one destination is set at a time. It is possible to set the next destination to go to on the destination sign itself, but that means you can only have one possible route. With the route manager a list of destinations to visit can be configured, and then applied to trains. Trains will then go down this list, advancing it every time they pass by a destination on it.


指令

First, edit a train, then use the following commands to set a list of destinations:

/train route set [destination1] ([destination2] [destination3...])
/train route set outpost hillfort dungeon

File:Pathfinding_routes_set.png

To add additional destinations to the existing route, or to remove them, use these commands:

/train route add [destination1] ([destination2] [destination3...])
/train route remove [destination1] ([destination2] [destination3...])

You can then use the destination command or property to start the route at a desired destination. Otherwise, the route is started from the beginning the moment the train hits a destination sign. To inspect the route of a train, use the base route command. The current destination the train has is highlighted green.

/train route

File:Pathfinding_route_info.png


Persistence

The route of a train can be saved globally under a name so it can later be applied to other trains instantly.

/train route save [name]

To load a saved route, this command can be used:

/train route load [name]

Alternatively, it can be done using a property sign as well:

Signtemplate.png
[+train]
property
loadroute
myroute