From 9dd0313b710e537ec7bc1285111ff0c8bd43089d Mon Sep 17 00:00:00 2001 From: Gabriel PĂ©rez-Cerezo Date: Sat, 10 Apr 2021 12:26:47 +0200 Subject: Add /at_whereis command to check the position of a train. --- advtrains/init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/advtrains/init.lua b/advtrains/init.lua index 7cc0ccd..96352df 100644 --- a/advtrains/init.lua +++ b/advtrains/init.lua @@ -706,6 +706,20 @@ minetest.register_chatcommand("at_reroute", end, }) +minetest.register_chatcommand("at_whereis", + { + params = "", + description = "Returns the position of the train with the given id", + privs = {train_operator = true}, + func = function(name,param) + local train = advtrains.trains[param] + if not train or not train.last_pos then + return false, "Train "..param.." does not exist or is invalid" + else + return true, "Train "..param.." is at "..minetest.pos_to_string(train.last_pos) + end + end, +}) minetest.register_chatcommand("at_disable_step", { params = "", -- cgit v1.2.3