]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Added setpitch & setyaw commands; AutoSprint
authorElias Fleckenstein <eliasfleckenstein@web.de>
Mon, 23 Nov 2020 12:26:51 +0000 (13:26 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Mon, 23 Nov 2020 12:26:51 +0000 (13:26 +0100)
builtin/client/chatcommands.lua
builtin/client/cheats/init.lua
builtin/client/cheats/movement.lua
builtin/settingtypes.txt
src/defaultsettings.cpp

index 8090b2befdfb58c3854a94df11a3682179b427e3..ec8fed652193e9291d0f955b91847e6ab2129455 100644 (file)
@@ -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
+})
index 2c67e0ebf916e67ca2e2856905a4cba196fce9ef..2307c7aec901b884c7d42dbd5fe8c4767f408ca2 100644 (file)
@@ -18,6 +18,7 @@ core.cheats = {
                ["Jesus"] = "jesus",
                ["NoSlow"] = "no_slow",
                ["AutoSneak"] = "autosneak",
+               ["AutoSprint"] = "autosprint",
        },
        ["Render"] = {
                ["Xray"] = "xray",
index bd9b995ad60fc842ad68b660c60229cdddfc9a51..9737662b2076d6583fea9f742e248139bedc32db 100644 (file)
@@ -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")
index 4006cc62b586d8ef3df2e30c4ca7f37f65ebf19b..6e683c025f2f3343c3dd8feaebed3d87803fe7a8 100644 (file)
@@ -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
index 75e02f0c90df79707919b540a9476717444c5578..6775fdcd417249a3c754d2963f571847d31ef61c 100644 (file)
@@ -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");