From 067f1f0d22231d1006f71699d3ef9006a1c38064 Mon Sep 17 00:00:00 2001 From: 1F616EMO Date: Fri, 30 Jan 2026 17:52:54 +0800 Subject: Aadd get_wagon_train_id for retrieving train ID from wagon ID Context: https://chatlog.1f616emo.xyz/chat/1f616emoluanti/2026/01/30/#L147 --- advtrains_luaautomation/environment.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/advtrains_luaautomation/environment.lua b/advtrains_luaautomation/environment.lua index 50eca7c..4d4ac47 100644 --- a/advtrains_luaautomation/environment.lua +++ b/advtrains_luaautomation/environment.lua @@ -161,6 +161,10 @@ local static_env = { if not train then return false end return table.copy(train.trainparts or {}) end, + get_wagon_train_id = function(wagon_id) + local wagon = advtrains.wagons[wagon_id] + return wagon and wagon.train_id or false + 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") -- cgit v1.2.3