aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2021-04-10 12:26:47 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2021-04-10 12:26:47 +0200
commit9dd0313b710e537ec7bc1285111ff0c8bd43089d (patch)
tree067da5d0cf1cc2bd7b2defa3ebcb59ecb87bfb18
parent5ee8c0e39b6dffc5437e1b48b08cfbeb6ea414d1 (diff)
downloadadvtrains-9dd0313b710e537ec7bc1285111ff0c8bd43089d.tar.gz
advtrains-9dd0313b710e537ec7bc1285111ff0c8bd43089d.tar.bz2
advtrains-9dd0313b710e537ec7bc1285111ff0c8bd43089d.zip
Add /at_whereis command to check the position of a train.
-rw-r--r--advtrains/init.lua14
1 files changed, 14 insertions, 0 deletions
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 = "<train id>",
+ 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 = "<yes/no>",