diff options
author | Maverick2797 <git.maverick2797@gmail.com> | 2024-08-30 17:25:01 +0800 |
---|---|---|
committer | orwell <orwell@bleipb.de> | 2024-09-02 22:25:05 +0200 |
commit | 852e2f4219c4e7a9bebf7b27bb1c026f98719f97 (patch) | |
tree | dfab3ab77527853c19c8f28f2ae45b89dd7b82e3 /advtrains_luaautomation/environment.lua | |
parent | 55108ae38e467e190abd6f9bf087a9a73f953a08 (diff) | |
download | advtrains-852e2f4219c4e7a9bebf7b27bb1c026f98719f97.tar.gz advtrains-852e2f4219c4e7a9bebf7b27bb1c026f98719f97.tar.bz2 advtrains-852e2f4219c4e7a9bebf7b27bb1c026f98719f97.zip |
LuaATC add trainparts(train_id)
Returns a copy of the trainparts table to allow tracking individual wagon ids
Also fixed a couple of file permissions from previous commits
Diffstat (limited to 'advtrains_luaautomation/environment.lua')
-rw-r--r-- | advtrains_luaautomation/environment.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/advtrains_luaautomation/environment.lua b/advtrains_luaautomation/environment.lua index ee7628d..b54d45c 100644 --- a/advtrains_luaautomation/environment.lua +++ b/advtrains_luaautomation/environment.lua @@ -153,6 +153,12 @@ local static_env = { local pos=atlatc.pcnaming.resolve_pos(parpos, "interrupt_pos") atlatc.interrupt.add(0, pos, {type="ext_int", ext_int=true, message=imesg}) end, + train_parts = function(train_id) + if not train_id then return false end + local train = advtrains.trains[train_id] + if not train then return false end + return table.copy(train.trainparts or {}) + 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") |