diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-10-10 23:28:42 +0200 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-10-10 23:28:42 +0200 |
commit | e96cc188665384df96b89af35308716bbdc5ca37 (patch) | |
tree | 6c1c053c7df5d3903b81962eb55e1b250ad43da4 /advtrains/advtrains_luaautomation/passive_api.txt | |
parent | d1b1d6ab29afdb116dd7d3c6869bfec097bcb453 (diff) | |
parent | 5aad0930d1ddd63d9021d833a9379b4a01bd8414 (diff) | |
download | forks-modpack-e96cc188665384df96b89af35308716bbdc5ca37.tar.gz forks-modpack-e96cc188665384df96b89af35308716bbdc5ca37.tar.bz2 forks-modpack-e96cc188665384df96b89af35308716bbdc5ca37.zip |
Merge commit '5aad0930d1ddd63d9021d833a9379b4a01bd8414' as 'advtrains'
Diffstat (limited to 'advtrains/advtrains_luaautomation/passive_api.txt')
-rw-r--r-- | advtrains/advtrains_luaautomation/passive_api.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/advtrains/advtrains_luaautomation/passive_api.txt b/advtrains/advtrains_luaautomation/passive_api.txt new file mode 100644 index 0000000..9852e94 --- /dev/null +++ b/advtrains/advtrains_luaautomation/passive_api.txt @@ -0,0 +1,24 @@ +Lua Automation - Passive Component API + +Passive components are nodes that do not have code running in them. However, active components can query these and request actions from them. Examples: +Switches +Signals +Displays +Mesecon Transmitter +Those passive components can also be used inside interlocking systems. + +All passive components have a table called 'advtrains' in their node definition and have the group 'save_in_nodedb' set, so they work in unloaded chunks. +Example for a switch: +advtrains = { + getstate = function(pos, node) + return "st" + end, + -- OR + getstate = "st", + + setstate = function(pos, node, newstate) + if newstate=="cr" then + advtrains.ndb.swap_node(pos, <corresponding switch alt>) + end + end +}
\ No newline at end of file |