autofly: fix autosprint preventing normal sprinting

wsc-master-rebase
cron 2020-11-08 17:34:26 +00:00 committed by Schmappie Eldress
parent e77a5f9e83
commit b7dcc4299d
1 changed files with 5 additions and 1 deletions

View File

@ -86,12 +86,16 @@ function round2(num, numDecimalPlaces)
return tonumber(string.format("%." .. (numDecimalPlaces or 0) .. "f", num))
end
local last_sprint = false
minetest.register_globalstep(function()
autofly.checkfall()
if minetest.settings:get_bool("autosprint") or (minetest.settings:get_bool("continuous_forward") and minetest.settings:get_bool("autofsprint")) then
core.set_keypress("special1", true)
else
last_sprint = true
elseif last_sprint then
core.set_keypress("special1", false)
last_sprint = false
end