User Tools

Site Tools


usage:atlatc:api

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
usage:atlatc:api [2021-03-02 20:15]
orwell commit 6135f8a2
usage:atlatc:api [2022-08-07 20:21]
62.138.2.14 ↷ Links adapted because of a move operation
Line 78: Line 78:
 === interrupt_safe(time, message) === === interrupt_safe(time, message) ===
  
-//since version 3.0//+//since version 2.3.0//
  
-Like ''interrupt()'', but does not add an interrupt and returns false when an interrupt (of any type) is already present for this component. Returns true when interrupt was successfully added.+Like ''interrupt()'', but returns false when an interrupt (of any type) is already present for this component and does not add an interrupt. Returns true when interrupt was successfully added.
  
 ===interrupt_pos(pos, message) === ===interrupt_pos(pos, message) ===
Line 88: Line 88:
 === clear_interrupts() === === clear_interrupts() ===
  
-//since version 3.0//+//since version 2.3.0//
  
 Removes any pending interrupts (both of type 'int' and 'ext_int') set on this node. Removes any pending interrupts (both of type 'int' and 'ext_int') set on this node.
Line 94: Line 94:
 ==== Remote ATC ==== ==== Remote ATC ====
  
-//since version 3.0//+//since version 2.3.0//
  
 In addition to ''atc_send()'' described below, LuaATC provides the possibility to send ATC commands to any train in the world knowing its train ID, by means of the following function. In addition to ''atc_send()'' described below, LuaATC provides the possibility to send ATC commands to any train in the world knowing its train ID, by means of the following function.
Line 110: Line 110:
 When ''advtrains_line_automation'' is enabled, all Railway time functions are exposed as rwt.* and can safely be used in LuaATC code. When ''advtrains_line_automation'' is enabled, all Railway time functions are exposed as rwt.* and can safely be used in LuaATC code.
  
-For the available functions, see [[dev:lines:rwt]].+For the available functions, see [[dev:api:railway_time_api]].
  
 <code> <code>
Line 153: Line 153:
 === digiline_send(channel, message) === === digiline_send(channel, message) ===
  
-Sends a [[usage:mods:digilines|digiline]] message on the specified ''channel''.+Sends a [[https://content.minetest.net/packages/Jeija/digilines/|digiline]] message on the specified ''channel''.
  
 This function is not available in init code. This function is not available in init code.
Line 222: Line 222:
 === atc_set_text_inside(text) === === atc_set_text_inside(text) ===
 Sets the text shown inside the train and returns ''true''. If there is no train, returns ''false'' and does nothing. Sets the text shown inside the train and returns ''true''. If there is no train, returns ''false'' and does nothing.
 +
 +=== atc_get_text_outside() / atc_get_text_inside() ===
 +Gets the outside/inside text currently set on the train.
  
 === get_line() === === get_line() ===
Line 237: Line 240:
 Sets the line property of the train, as a string. Sets the line property of the train, as a string.
  
-On [[usage:trains:subway_train|subway trains]] bundled with Advtrains, the line is automatically displayed on the outside of the trains, if the first character is a number between 0 and 9 (where 0 is displayed as "Line 10").+On [[usage:trains:basic_trains:advtrains_subway|subway trains]], in the Basic Trains modpack, the line is automatically displayed on the outside of the trains, if the first character is a number between 0 and 9 (where 0 is displayed as "Line 10").
  
 If there is no train, same behavior as [[#get_line()]] applies. If there is no train, same behavior as [[#get_line()]] applies.
Line 250: Line 253:
  
 If there is no train, same behavior as [[#get_line()]] applies. If there is no train, same behavior as [[#get_line()]] applies.
 +
 +=== train_length() === 
 +Returns the number of wagons in a train.
  
 === set_shunt() === === set_shunt() ===
Line 259: Line 265:
  
 === atc_set_ars_disable(value) === === atc_set_ars_disable(value) ===
 +
 +//since version 2.3.0//
 +
 Enables (''value == false'') or disables (''value == true'') interlocking for this train. The train will not trigger automatic route setting on signals based on ARS. Enables (''value == false'') or disables (''value == true'') interlocking for this train. The train will not trigger automatic route setting on signals based on ARS.
  
 This function has essentially the same effect as the ATC command ''[[usage:nodes:atc_controller#a_enable_ARS|A<enable_ARS>]]''. This function has essentially the same effect as the ATC command ''[[usage:nodes:atc_controller#a_enable_ARS|A<enable_ARS>]]''.
- 
-**This function is experimental and currently available only in the ''[[http://git.bananach.space/advtrains.git/tree/?h=luaatc-extensions|luaatc-extensions]]'' branch of Advtrains.** 
  
 === atc_set_lzb_tsr(speed) === === atc_set_lzb_tsr(speed) ===
 +
 +//since version 2.3.0//
  
 Adds a Temporary Speed Restriction at the current rail, so that the train is passing the rail at the specified ''speed'', or at a lower speed. Adds a Temporary Speed Restriction at the current rail, so that the train is passing the rail at the specified ''speed'', or at a lower speed.
Line 274: Line 283:
   * This function is only accessible during ''approach'' events   * This function is only accessible during ''approach'' events
  
-**This function is experimental and currently available only in the ''[[http://git.bananach.space/advtrains.git/tree/?h=luaatc-extensions|luaatc-extensions]]'' branch of Advtrains.**+=== set_autocouple() === 
 + 
 +Enables Autocouple mode. When the train hits another standing train, it couples to it and continues with its current ATC target speed in the same direction. 
 + 
 +In contrast to the ''Cpl'' ATC command, the autocouple property does not reset after coupling. It needs to be explicitly disabled using ''unset_autocouple()''. Note that the ATC ''Cpl'' command and the LuaATC autocouple flag are independent and can be used at the same time. 
 + 
 +//since version 2.4.0:// 
 + 
 +The train that is initiating the coupling (that is, the train that is driving and whose mode is set to autocouple) is guaranteed to retain its Train ID. 
 + 
 +=== unset_autocouple() === 
 + 
 +Disables the Autocouple mode.
  
 ==== Fields ==== ==== Fields ====
usage/atlatc/api.txt · Last modified: 2023-07-05 17:48 by maverick2797