aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains_luaautomation')
-rw-r--r--advtrains_luaautomation/README.txt8
-rw-r--r--advtrains_luaautomation/atc_rail.lua10
2 files changed, 15 insertions, 3 deletions
diff --git a/advtrains_luaautomation/README.txt b/advtrains_luaautomation/README.txt
index 279b07d..2963192 100644
--- a/advtrains_luaautomation/README.txt
+++ b/advtrains_luaautomation/README.txt
@@ -173,8 +173,14 @@ atc_set_text_outside(text)
Set text shown on the outside of the train. Pass nil to show no text.
atc_set_text_inside(text)
Set text shown to train passengers. Pass nil to show no text.
+get_line()
+ Returns the "Line" property of the train (a string).
+ This can be used to distinguish between trains of different lines and route them appropriately.
+ The interlocking system also uses this property for Automatic Routesetting.
set_line(number)
- Only for subway wagons: Display a line number (1-9) on the train.
+ Sets the "Line" property of the train (a string).
+ If the first digit of this string is a number (0-9), any subway wagons on the train will have this one displayed as line number
+ (where "0" is actually shown as Line 10 on the train)
# Operator panel
This simple node executes its actions when punched. It can be used to change a switch and update the corresponding signals or similar applications.
diff --git a/advtrains_luaautomation/atc_rail.lua b/advtrains_luaautomation/atc_rail.lua
index 1fab620..6a3959c 100644
--- a/advtrains_luaautomation/atc_rail.lua
+++ b/advtrains_luaautomation/atc_rail.lua
@@ -54,8 +54,14 @@ function r.fire_event(pos, evtdata)
return true
end,
set_line = function(line)
- train.line = line
- return true
+ if type(line)~="string" and type(line)~="number" then
+ return false
+ end
+ train.line = line .. ""
+ return true
+ end,
+ get_line = function()
+ return train.line
end,
atc_reset = function(cmd)
if not train_id then return false end