From 24e0bb55e312fd2047ed0f5453a426237a3488c3 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 15 Nov 2021 19:19:31 +0100 Subject: [PATCH] Initial commit --- README | 2 ++ init.lua | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mod.conf | 3 +++ 3 files changed, 61 insertions(+) create mode 100644 README create mode 100644 init.lua create mode 100644 mod.conf diff --git a/README b/README new file mode 100644 index 0000000..f84fc41 --- /dev/null +++ b/README @@ -0,0 +1,2 @@ +# simpletp +A dragonfire CSM that includes some simple exploits to teleport to the nether, end or go back to the spawn location. diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..ab755dd --- /dev/null +++ b/init.lua @@ -0,0 +1,56 @@ +local function tp_func(y, goal) + return function() + local player = minetest.localplayer + local pos = player:get_pos() + + if pos.y < y then + return false, "Can't teleport to " .. goal .. " from this location." + end + + pos.y = y + player:set_pos(pos) + return true + end +end + +local function disconnect_wrapper(func) + return function() + local success, msg = func() + if success then + minetest.after(0, minetest.disconnect) + end + return success, msg + end +end + +local function menu_wrapper(func) + return function() + local _, msg = func() + if msg then + minetest.display_chat_message(msg) + end + end +end + +local end_func = tp_func(-27000, "End") +local nether_func = tp_func(-29000, "Nether") +local spawn_func = disconnect_wrapper(tp_func(-32000, "Spawn")) + +minetest.register_chatcommand("end", { + description = "Teleport to the end (works in the overworld only). This may drop you above the void, so make sure you have Fly or Jetpack enabled.", + func = end_func, +}) + +minetest.register_chatcommand("nether", { + description = "Teleport to the nether (works in the overworld or the end). This may move you into solid blocks, so make sure you have a pickaxe ready or Noclip enabled.", + func = nether_func, +}) + +minetest.register_chatcommand("spawn", { + description = "Teleport to your spawn location. This will disconnect you, you have to reconnect afterwards.", + func = spawn_func, +}) + +minetest.register_cheat("End", "Exploit", menu_wrapper(end_func)) +minetest.register_cheat("Nether", "Exploit", menu_wrapper(nether_func)) +minetest.register_cheat("Spawn", "Exploit", menu_wrapper(spawn_func)) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..b29b51d --- /dev/null +++ b/mod.conf @@ -0,0 +1,3 @@ +name = simpletp +author = Fleckenstein +description = A dragonfire CSM that includes some simple exploits to teleport to the nether, end or go back to the spawn location.