User Tools

Site Tools


usage:nodes:atc_rail

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision Both sides next revision
usage:nodes:atc_rail [2019-07-02 12:55]
82.67.173.193 created
usage:nodes:atc_rail [2019-07-02 17:06]
82.67.173.193 added information to wiki article (2/4)
Line 10: Line 10:
  
 ===== Properties ===== ===== Properties =====
-Mod: ''advtrains_luaautomation'' \\ +Mod: ''[[usage:mods#advtrains_luaautomation|advtrains_luaautomation]]'' \\ 
 Node name: ''advtrains_luaautomation:dtrack_placer'' \\  Node name: ''advtrains_luaautomation:dtrack_placer'' \\ 
 Other names: Other names:
Line 141: Line 141:
  
 This function is not available in init code. This function is not available in init code.
 +
 +==== Interlocking functions ====
 +
 +Interlocking functions are available when the ''[[usage:mods#advtrains_interlocking|advtrains_interlocking]]'' mod is enabled.
 +
 +=== can_set_route(pos, route_name) ===
 +
 +Checks whether it is possible to set the route designated by ''route_name'' from the signal at position ''pos''.
 +
 +It emits a warning and halts execution of Lua code in the following cases:
 +
 +  * the node at specified position is not a signal:
 +
 +> 2019-01-01 15:00:00: WARNING[Server]: [advtrains]LuaAutomation ATC interface rail at (0,0,0) : LUA Error: ...ds/advtrains/advtrains_luaautomation/environment.lua:168: There's no signal at (0,0,0)
 +
 +  * ''pos'' is a string, and the named passive component does not exist:
 +
 +> 2019-01-01 15:00:00: WARNING[Server]: [advtrains]LuaAutomation ATC interface rail at (0,0,0) : LUA Error: .../mods/advtrains/advtrains_luaautomation/pcnaming.lua:22: Invalid position supplied to ???: "invalid_pcnaming"
 +
 +  * the specified route does not exist:
 +
 +> 2019-01-01 15:00:00: WARNING[Server]: [advtrains]LuaAutomation ATC interface rail at (0,0,0) : LUA Error: ...ds/advtrains/advtrains_luaautomation/environment.lua:185: No route called B at (0,0,0)
 +
 +=== set_route(pos, route_name) ===
 +
 +Requests the route designated by ''route_name'' from the signal at position ''pos''. Has the same effect as clicking the "Set Route" in the formspec from the designated signal.
 +
 +Same warnings apply as for ''[[#can_set_route_pos_route_name|can_set_route]]''.
 +
 +If the route can't be set, the signal remains red and waits for conflicting problems to be solved. Execution continues **immediately**.
 +
 +=== cancel_route(pos, route_name) ===
 +
 +Cancels the route designated by ''route_name'' that is set from the signal at position ''pos''. Has the same effect as clicking the "Cancel Route" in the formspec from the designated signal.
 +
 +Same warnings apply as for ''[[#can_set_route_pos_route_name|can_set_route]]''.
 +
 +If the route has already been canceled, nothing happens.
 +
 +=== get_aspect(pos) ===
 +
 +Gets the aspect of the signal at ''pos''. The aspect format is described in the [[usage:nodes:signal#aspect_format|Signal]] page.
 +
 +Same warnings apply as for ''[[#can_set_route_pos_route_name|can_set_route]]''.
 +
 +==== Events ====
 +
 +In a LuaAutomation ATC controller, an event has the following format:
 +<code lua>
 +event = {
 +    type = "<type>",
 +    <type> = true,
 +    -- additional content
 +}
 +</code>
 +
 +
  
 ===== Trivia ===== ===== Trivia =====
  
 The LuaAutomation ATC rail has the same texture as the [[usage:nodes:atc_controller|ATC controller rail]], but its functions are different. The LuaAutomation ATC rail has the same texture as the [[usage:nodes:atc_controller|ATC controller rail]], but its functions are different.
usage/nodes/atc_rail.txt · Last modified: 2023-12-12 02:41 by blockhead