TC插件/自動尋路

From BergerHealer Wiki
Jump to navigation Jump to search
This page is a translated version of the page TrainCarts/PathFinding and the translation is 51% complete.
Outdated translations are marked like this.
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