2c656ec24f
* add digistuff * add digiterms * add missions * add morelights * add nixie_tubes * add mob_horse * change digiterms: add cyrillic letter, change recipes for scifi monitors * add missing recipe for decatron * add craft recipes for digistuff * Separate mod for missing craft recipes * new mod: bees * add advtrains_luaautomation with craft recipes * add ham_radio * add christmas_decor * jumpdrive: ham_radio compat * fix christmas decor
24 lines
717 B
Plaintext
24 lines
717 B
Plaintext
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
|
|
} |