aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-07-27 21:50:22 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-07-27 21:50:22 +0200
commit549db4737f5f07d8a99236766a93a545fe39169a (patch)
tree8c2f757378f464d44f3ab8a7023de69f559b41b2 /advtrains_luaautomation
parent45413ee5c031d9d44342a09f4ac8b412a75568be (diff)
downloadadvtrains-549db4737f5f07d8a99236766a93a545fe39169a.tar.gz
advtrains-549db4737f5f07d8a99236766a93a545fe39169a.tar.bz2
advtrains-549db4737f5f07d8a99236766a93a545fe39169a.zip
add train_length command to luaatc
Diffstat (limited to 'advtrains_luaautomation')
-rw-r--r--advtrains_luaautomation/atc_rail.lua7
1 files changed, 7 insertions, 0 deletions
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)