From 6135f8a23b4f507870dab481f4db466e6be0ac7d Mon Sep 17 00:00:00 2001 From: orwell96 Date: Tue, 2 Mar 2021 19:51:56 +0100 Subject: LuaATC: add sending atc command to train by ID, and getters for in/out text (solves #124 and #166) --- advtrains_luaautomation/environment.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'advtrains_luaautomation/environment.lua') diff --git a/advtrains_luaautomation/environment.lua b/advtrains_luaautomation/environment.lua index 9ef320c..63aa68d 100644 --- a/advtrains_luaautomation/environment.lua +++ b/advtrains_luaautomation/environment.lua @@ -153,6 +153,17 @@ local static_env = { local pos=atlatc.pcnaming.resolve_pos(parpos) atlatc.interrupt.add(0, pos, {type="ext_int", ext_int=true, message=imesg}) end, + -- sends an atc command to train regardless of where it is in the world + atc_send_to_train = function(train_id, command) + assertt(command, "string") + local train = advtrains.trains[train_id] + if train then + advtrains.atc.train_set_command(train, command, true) + return true + else + return false + end + end, } -- If interlocking is present, enable route setting functions -- cgit v1.2.3