Improved AutoSneak
This commit is contained in:
parent
82216e1476
commit
7d327def82
@ -1,15 +1,18 @@
|
||||
local function register_keypress_cheat(cheat, keyname)
|
||||
local function register_keypress_cheat(cheat, keyname, condition)
|
||||
local was_enabled = false
|
||||
core.register_globalstep(function()
|
||||
if core.settings:get_bool(cheat) then
|
||||
was_enabled = true
|
||||
local is_active = core.settings:get_bool(cheat)
|
||||
local condition_true = (not condition or condition())
|
||||
if is_active and condition_true then
|
||||
core.set_keypress(keyname, true)
|
||||
elseif was_enabled then
|
||||
was_enabled = false
|
||||
core.set_keypress(keyname, false)
|
||||
end
|
||||
was_enabled = is_active and condition_true
|
||||
end)
|
||||
end
|
||||
|
||||
register_keypress_cheat("autosneak", "sneak")
|
||||
register_keypress_cheat("autosneak", "sneak", function()
|
||||
return core.localplayer:is_touching_ground()
|
||||
end)
|
||||
register_keypress_cheat("autosprint", "special1")
|
||||
|
Loading…
x
Reference in New Issue
Block a user