aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/client/chatcommands.lua43
-rw-r--r--builtin/client/cheats/init.lua1
-rw-r--r--builtin/client/cheats/movement.lua27
-rw-r--r--builtin/settingtypes.txt2
-rw-r--r--src/defaultsettings.cpp1
5 files changed, 46 insertions, 28 deletions
diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua
index 8090b2bef..ec8fed652 100644
--- a/builtin/client/chatcommands.lua
+++ b/builtin/client/chatcommands.lua
@@ -134,21 +134,6 @@ core.register_chatcommand("set", {
end,
})
-core.register_chatcommand("findnodes", {
- description = "Scan for one or multible nodes in a radius around you",
- param = "<radius> <node1>[,<node2>...]",
- func = function(param)
- local radius = tonumber(param:split(" ")[1])
- local nodes = param:split(" ")[2]:split(",")
- local pos = core.localplayer:get_pos()
- local fpos = core.find_node_near(pos, radius, nodes, true)
- if fpos then
- return true, "Found " .. table.concat(nodes, " or ") .. " at " .. core.pos_to_string(fpos)
- end
- return false, "None of " .. table.concat(nodes, " or ") .. " found in a radius of " .. tostring(radius)
- end,
-})
-
core.register_chatcommand("place", {
params = "<X>,<Y>,<Z>",
description = "Place wielded item",
@@ -174,3 +159,31 @@ core.register_chatcommand("dig", {
return false, pos
end,
})
+
+core.register_chatcommand("setyaw", {
+ params = "<yaw>",
+ description = "Set your yaw",
+ func = function(param)
+ local yaw = tonumber(param)
+ if yaw then
+ core.localplayer:set_yaw(yaw)
+ return true
+ else
+ return false, "Invalid usage (See /help setyaw)"
+ end
+ end
+})
+
+core.register_chatcommand("setpitch", {
+ params = "<pitch>",
+ description = "Set your pitch",
+ func = function(param)
+ local pitch = tonumber(param)
+ if pitch then
+ core.localplayer:set_pitch(pitch)
+ return true
+ else
+ return false, "Invalid usage (See /help setpitch)"
+ end
+ end
+})
diff --git a/builtin/client/cheats/init.lua b/builtin/client/cheats/init.lua
index 2c67e0ebf..2307c7aec 100644
--- a/builtin/client/cheats/init.lua
+++ b/builtin/client/cheats/init.lua
@@ -18,6 +18,7 @@ core.cheats = {
["Jesus"] = "jesus",
["NoSlow"] = "no_slow",
["AutoSneak"] = "autosneak",
+ ["AutoSprint"] = "autosprint",
},
["Render"] = {
["Xray"] = "xray",
diff --git a/builtin/client/cheats/movement.lua b/builtin/client/cheats/movement.lua
index bd9b995ad..9737662b2 100644
--- a/builtin/client/cheats/movement.lua
+++ b/builtin/client/cheats/movement.lua
@@ -1,14 +1,15 @@
--- autosneak
+local function register_keypress_cheat(cheat, keyname)
+ local was_enabled = false
+ core.register_globalstep(function()
+ if core.settings:get_bool(cheat) then
+ was_enabled = true
+ core.set_keypress(keyname, true)
+ elseif was_enabled then
+ was_enabled = false
+ core.set_keypress(keyname, false)
+ end
+ end)
+end
-local autosneak_was_enabled = false
-
-core.register_globalstep(function()
- if core.settings:get_bool("autosneak") then
- core.set_keypress("sneak", true)
- autosneak_was_enabled = true
- elseif autosneak_was_enabled then
- autosneak_was_enabled = false
- core.set_keypress("sneak", false)
- end
-end)
-
+register_keypress_cheat("autosneak", "sneak")
+register_keypress_cheat("autosprint", "special1")
diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt
index 4006cc62b..6e683c025 100644
--- a/builtin/settingtypes.txt
+++ b/builtin/settingtypes.txt
@@ -2353,3 +2353,5 @@ enable_node_tracers (NodeTracers) bool false
node_esp_nodes (NodeESP Nodes) string
only_trace_players (OnlyTracePlayers) bool false
+
+autosprint (AutoSprint) bool false
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 75e02f0c9..6775fdcd4 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -135,6 +135,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("enable_node_tracers", "false");
settings->setDefault("node_esp_nodes", "");
settings->setDefault("only_trace_players", "false");
+ settings->setDefault("autosprint", "false");
// Keymap
settings->setDefault("remote_port", "30000");