From 549db4737f5f07d8a99236766a93a545fe39169a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez-Cerezo?= Date: Mon, 27 Jul 2020 21:50:22 +0200 Subject: [PATCH] add train_length command to luaatc --- advtrains_luaautomation/atc_rail.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/advtrains_luaautomation/atc_rail.lua b/advtrains_luaautomation/atc_rail.lua index 04e2f85..88203ae 100644 --- a/advtrains_luaautomation/atc_rail.lua +++ b/advtrains_luaautomation/atc_rail.lua @@ -73,8 +73,15 @@ function r.fire_event(pos, evtdata) if new_id then minetest.after(1,advtrains.atc.train_set_command,advtrains.trains[new_id], cmd, atc_arrow) end + if fc == "" then + return nil + end return fc end, + train_length = function () + if not train_id then return false end + return #train.trainparts + end, step_fc = function() if not train_id then return false end advtrains.train_step_fc(train)