aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authorgpcf <gpcf@gpcf.eu>2024-08-08 23:53:29 +0200
committergpcf <gpcf@gpcf.eu>2024-08-08 23:53:29 +0200
commit45e5ad3b378b17be7e0ce314ba964e01792d673d (patch)
tree20802157fc7c0cbbbad9086fa3852971986c8ecc /advtrains
parent3526fc2e4afbc0b33269d061ff676dd8613f11a8 (diff)
downloadadvtrains-45e5ad3b378b17be7e0ce314ba964e01792d673d.tar.gz
advtrains-45e5ad3b378b17be7e0ce314ba964e01792d673d.tar.bz2
advtrains-45e5ad3b378b17be7e0ce314ba964e01792d673d.zip
Fix boardcom train id display, add command to teleport to train by id
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/init.lua15
-rw-r--r--advtrains/wagons.lua2
2 files changed, 16 insertions, 1 deletions
diff --git a/advtrains/init.lua b/advtrains/init.lua
index 33e5b1d..f7d3b13 100644
--- a/advtrains/init.lua
+++ b/advtrains/init.lua
@@ -738,6 +738,21 @@ minetest.register_chatcommand("at_whereis",
end
end,
})
+minetest.register_chatcommand("at_tp",
+ {
+ params = "<train id>",
+ description = "Teleports you to the position of the train with the given id",
+ privs = {train_operator = true, teleport = 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
+ minetest.get_player_by_name(name):set_pos(train.last_pos)
+ return true, "Teleporting to train "..param
+ end
+ end,
+})
minetest.register_chatcommand("at_disable_step",
{
params = "<yes/no>",
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua
index 730c623..677014a 100644
--- a/advtrains/wagons.lua
+++ b/advtrains/wagons.lua
@@ -970,7 +970,7 @@ function wagon:show_bordcom(pname)
local data = advtrains.wagons[self.id]
local linhei
- local form = "size[11,9]label[0.5,0;AdvTrains Boardcom v0.1 | "..attrans("Train ID")..": "..(minetest.formspec_escape(self.id or "")).."]"
+ local form = "size[11,9]label[0.5,0;AdvTrains Boardcom v0.1 | "..attrans("Train ID")..": "..(minetest.formspec_escape(train.id or "")).."]"
form=form.."textarea[0.5,1.5;7,1;text_outside;"..attrans("Text displayed outside on train")..";"..(minetest.formspec_escape(train.text_outside or "")).."]"
form=form.."textarea[0.5,3;7,1;text_inside;"..attrans("Text displayed inside train")..";"..(minetest.formspec_escape(train.text_inside or "")).."]"
form=form.."field[7.5,1.75;3,1;line;"..attrans("Line")..";"..(minetest.formspec_escape(train.line or "")).."]"