aboutsummaryrefslogtreecommitdiff
path: root/clientmods/warp/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'clientmods/warp/init.lua')
-rw-r--r--clientmods/warp/init.lua39
1 files changed, 24 insertions, 15 deletions
diff --git a/clientmods/warp/init.lua b/clientmods/warp/init.lua
index d74e023c3..67f22a901 100644
--- a/clientmods/warp/init.lua
+++ b/clientmods/warp/init.lua
@@ -45,25 +45,34 @@ minetest.register_chatcommand("deletewarp", {
func = warp.delete,
})
+local function do_warp(param)
+ if param == "" then return false, "Missing parameter." end
+ local success, pos = minetest.parse_pos(param)
+ if not success then
+ local msg
+ success, msg, pos = warp.get(param)
+ if not success then
+ return false, msg
+ end
+ end
+ minetest.localplayer:set_pos(pos)
+ return true, "Warped to " .. minetest.pos_to_string(pos)
+end
+
minetest.register_chatcommand("warp", {
params = "<pos>|<warp>",
- description = "Warp to a set warp or a position. " .. (core.anticheat_protection and "You have to be attached for this to work (sitting in a boat or similar) and you will be disconnected and have to rejoin." or ""),
+ description = "Warp to a set warp or a position.",
+ func = do_warp
+})
+
+minetest.register_chatcommand("warpandexit", {
+ params = "<pos>|<warp>",
+ description = "Warp to a set warp or a position and exit.",
func = function(param)
- if param == "" then return false, "Missing parameter." end
- local success, pos = minetest.parse_pos(param)
- if not success then
- local msg
- success, msg, pos = warp.get(param)
- if not success then
- return false, msg
- end
- end
- minetest.localplayer:set_pos(pos)
- if core.anticheat_protection then
+ local s, m = do_warp(param)
+ if s then
minetest.disconnect()
end
- return true, "Warped to " .. minetest.pos_to_string(pos)
+ return s,m
end
})
-
-