User Tools

Site Tools


usage:atlatc:events

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
usage:atlatc:events [2020-01-28 10:16]
orwell fix it
usage:atlatc:events [2023-10-29 16:30] (current)
orwell [approach]
Line 33: Line 33:
  
 ===== Event Types ===== ===== Event Types =====
 +
 +==== init ====
 +The ''event'' table of the [[usage:atlatc:environment#Initialization Code]] is always ''{type="init", init=true}''.
  
 ==== int ==== ==== int ====
Line 43: Line 46:
 } }
 </code> </code>
-Fired when an interrupt set by the ''[[#interrupt_time_message|interrupt]]'' function runs out. ''<message>'' is the message passed to the function.  +Fired when an interrupt set by the ''[[usage:atlatc:api#interrupt_time_message|interrupt]]'' function runs out. ''<message>'' is the message passed to the function.  
 For backwards compatibility reasons, the message is also contained in the ''event.message'' field. For backwards compatibility reasons, the message is also contained in the ''event.message'' field.
  
Line 54: Line 57:
 } }
 </code> </code>
-Fired when a node called ''[[#interrupt_pos_pos_message|interrupt_pos]]'' on this node's position. ''<message>'' is the message passed to the function.+Fired when a node called ''[[usage:atlatc:api#interrupt_pos_pos_message|interrupt_pos]]'' on this node's position. ''<message>'' is the message passed to the function. 
 + 
 +==== schedule ==== 
 +<code lua> 
 +event = { 
 +    type = "schedule", 
 +    schedule = true, 
 +    msg = <message>, 
 +
 +</code> 
 +Fired when an interrupt set by the ''[[usage:atlatc:api#schedule_rwtime_msg|schedule()]]'' (or ''schedule_in()'') function runs out. ''<message>'' is the message passed to the function.
  
 ==== digiline ==== ==== digiline ====
Line 66: Line 79:
 </code> </code>
 Fired when the component receives a [[usage:mods:digiline|Digiline]] message. Fired when the component receives a [[usage:mods:digiline|Digiline]] message.
 +
 +==== punch ====
 +**Applicable for:** LuaATC Operation Panel
 +<code lua>
 +event = {
 +    type = "punch",
 +    punch = true,
 +    name = name of puncher
 +}
 +</code>
 +Fired when a player punches the operation panel.
 +
 +Note: Nodes other than the operation panel don't emit the ''punch'' event.
  
 ==== train ==== ==== train ====
Line 77: Line 103:
 </code> </code>
 Fired when a train enters the rail. The field ''id'' is the unique ID of the train, which is a 6-digit random numerical string.   Fired when a train enters the rail. The field ''id'' is the unique ID of the train, which is a 6-digit random numerical string.  
-If the world contains trains from an older Advtrains version, the string may be longer and contain a dot (''.'').+If the world contains trains created in very early advtrains versions (<=2018), the string may be longer and contain a dot (''.'').
  
 ==== approach ==== ==== approach ====
Line 86: Line 112:
     approach = true,     approach = true,
     id = <train_id>,     id = <train_id>,
 +    has_entered = <boolean>, (latest development version only)
 } }
 </code> </code>
 Fired when a train approaches the rail. This event may be generated multiple times for the same train. Fired when a train approaches the rail. This event may be generated multiple times for the same train.
  
-  * **This function is available only in the ''[[http://git.bananach.space/advtrains.git/tree/?h=luaatc-extensions|luaatc-extensions]]'' branch of Advtrains.** 
   * **This function is available only when the [[#approach_callback_mechanism|approach callback mechanism]] is enabled.**   * **This function is available only when the [[#approach_callback_mechanism|approach callback mechanism]] is enabled.**
 +
 +`has_entered` is set to true when the tip of the train is already standing on the node, i.e. the "train" event has already fired.
  
 === Approach callback mechanism === === Approach callback mechanism ===
-The approach callback mechanism is a new feature that allows LuaAutomation ATC rails to hook into the approach callback system, which is used by the [[usage:nodes:npr|Point Speed Restriction Rails]] (from ''advtrains_interlocking'') or by [[usage:nodes:stoprail|Station/Stop Rails]] (by ''advtrains_line_automation''). Since it is relatively a recent feature, it needs to be explicitly enabled. 
  
-**At the time of writing (2019-12-18), this feature is available only in ''[[http://git.bananach.space/advtrains.git/tree/?h=luaatc-extensions|luaatc-extensions]]'' branch of Advtrains. To use this branch, clone the Git repo in the Minetest mods directory and then ''git checkout luaatc-extensions'' on the mod directory.**+//since version 2.3.0// 
 + 
 +The approach callback mechanism is a new feature that allows LuaAutomation ATC rails to hook into the approach callback system, which is used by the [[usage:nodes:npr|Point Speed Restriction Rails]] (from ''advtrains_interlocking'') or by [[usage:nodes:stoprail|Station/Stop Rails]] (by ''advtrains_line_automation''). Since it is relatively a recent feature, it needs to be explicitly enabled.
  
 To enable the feature, define the following global variable in the local environment of the ATC rail: To enable the feature, define the following global variable in the local environment of the ATC rail:
Line 118: Line 147:
     * ''[[#atc_set_text_inside_text|atc_set_text_inside(text)]]''/''[[#atc_set_text_outside_text|atc_set_text_outside(text)]]''     * ''[[#atc_set_text_inside_text|atc_set_text_inside(text)]]''/''[[#atc_set_text_outside_text|atc_set_text_outside(text)]]''
     * ''[[#atc_set_lzb_tsr_speed|atc_set_lzb_tsr(speed)]]''     * ''[[#atc_set_lzb_tsr_speed|atc_set_lzb_tsr(speed)]]''
 +    * ''[[#atc_set_ars_disable|atc_set_ars_disable(ars_disable)]]''
  
usage/atlatc/events.1580202974.txt.gz · Last modified: 2020-01-28 10:16 by orwell