usage:nodes:atc_rail
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| usage:nodes:atc_rail [2019-07-02 10:55] – created 82.67.173.193 | usage:nodes:atc_rail [2023-12-12 01:41] (current) – name was changed in some version or another blockhead | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | {{ http:// | + | {{ :usage: |
| - | //Do anything you want with ATC rails.// | + | |
| - | + | ||
| - | ---- | + | |
| - | FIXME This is a draft. Please improve this page by creating relevant pages, adding information and references to internal or external sources. | + | |
| - | ---- | + | |
| - | + | ||
| - | //Note: this page has been written for Advtrains 2.0.1 TSS and Minetest 5.1.0. Examples and practices described in this page don't take advantage of improvements introduced in later releases.// | + | |
| ===== Properties ===== | ===== Properties ===== | ||
| - | Mod: '' | + | Mod: '' |
| Node name: '' | Node name: '' | ||
| Other names: | Other names: | ||
| Line 31: | Line 24: | ||
| * This node is an [[usage: | * This node is an [[usage: | ||
| - | ===== Environments | + | ===== Operation |
| - | + | ||
| - | Each active component is assigned to an environment. This is where all data are held. Components in different environments can't interfere with each other. | + | |
| - | + | ||
| - | **Note: the [[# | + | |
| - | + | ||
| - | ==== Creating an environment ===== | + | |
| - | //Main article: [[usage: | + | |
| - | + | ||
| - | + | ||
| - | An environment is created by using '' | + | |
| - | + | ||
| - | ==== Setting up an environment ==== | + | |
| - | //Main article: [[usage: | + | |
| - | + | ||
| - | + | ||
| - | You've created your first LuaATC environment! If you execute ''/ | + | |
| - | + | ||
| - | {{: | + | |
| - | + | ||
| - | It allows you to edit your environment initialization code. | + | |
| - | + | ||
| - | * The button "Run InitCode" | + | |
| - | * The button "Clear S" removes all elements from the '' | + | |
| - | * The button " | + | |
| - | * The button " | + | |
| - | When the init code fails to execute, the '' | + | |
| - | + | ||
| - | More information on how to use that initialization code to do amazing things is given below. | + | |
| - | + | ||
| - | ===== Coding guide ===== | + | |
| - | ==== Predefined global variables ==== | + | |
| - | + | ||
| - | The following global variables are available inside a LuaAutomation ATC rail: | + | |
| - | + | ||
| - | === S === | + | |
| - | + | ||
| - | A table shared between all components of an environment. Its contents are persistent over server restarts. Any value is allowed, except functions: | + | |
| - | + | ||
| - | **Do not store functions in this table. Calling them from another component may work, but they will be discarded on server shutdown and this may lead to unexpected results.** | + | |
| - | + | ||
| - | === F === | + | |
| - | + | ||
| - | A table shared between all components of an environment. Its contents are discarded on server shutdown or when the init code gets re-run. Any value is allowed, **even functions**. | + | |
| - | + | ||
| - | This table is not made to store data, but to provide static value and function definitions. This table should be populated by the initialization code. | + | |
| - | + | ||
| - | ==== Available Lua functions ==== | + | |
| - | + | ||
| - | The standard Lua globals are available in the LuaATC environment: | + | |
| - | + | ||
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | + | ||
| - | The standard Lua functions are available in the LuaATC environment: | + | |
| - | + | ||
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | + | ||
| - | ==== LuaAutomation-specific functions ==== | + | |
| - | + | ||
| - | In the following functions, all parameters named '' | + | |
| - | + | ||
| - | * a default Minetest position vector (like '' | + | |
| - | * the '' | + | |
| - | * a string, the name of a [[# | + | |
| - | + | ||
| - | === POS(x, y, z) === | + | |
| - | + | ||
| - | A shorthand function to designate a Minetest position vector like '' | + | |
| - | + | ||
| - | === getstate(pos) === | + | |
| - | + | ||
| - | Gets the state of a passive component at position '' | + | |
| - | + | ||
| - | === setstate(pos, | + | |
| - | + | ||
| - | Sets the state of a passive component at position '' | + | |
| - | + | ||
| - | === is_passive(pos) === | + | |
| - | + | ||
| - | Checks whether there is a passive component at position '' | + | |
| - | + | ||
| - | === interrupt(time, | + | |
| - | + | ||
| - | Causes the LuaAutomation mod to trigger an '' | + | |
| - | + | ||
| - | This function is not available in init code. | + | |
| - | + | ||
| - | === interrupt_pos(pos, | + | |
| - | Triggers immediately | + | The LuaATC Rail is an active |
| - | **Use with care! This may lead to expotential growth of interrupts.** | + | Every LuaATC rail must belong |
| - | === digiline_send(channel, | + | //Note: you have to create an environment before LuaATC components can be used. See [[usage: |
| - | Sends a [[usage: | + | ===== API ===== |
| - | This function is not available in init code. | + | For details how to program LuaATC rails, refer to the [[usage: |
| + | {{indexmenu> | ||
| ===== Trivia ===== | ===== Trivia ===== | ||
| - | The LuaAutomation ATC rail has the same texture as the [[usage: | + | The LuaAutomation ATC rail has the same texture as the [[usage: |
usage/nodes/atc_rail.1562064912.txt.gz · Last modified: by 82.67.173.193
