Fixes constantly resetting player physics when player isn't sprinting

master
shivajiva101 2020-09-26 22:57:22 +01:00 committed by GitHub
parent 2599bd6928
commit a27872af29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -3,13 +3,13 @@ local players = {}
minetest.register_globalstep(function(dtime)
for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
players[name] = true
local control = player:get_player_control()
local sprint = control.aux1 and control.up
if sprint and players[name] then
if sprint then
players[name] = true
player:set_physics_override({speed = 1.3})
player:set_fov(1.2, true, 0.1)
else
elseif players[name] then
player:set_physics_override({speed = 1})
player:set_fov(1, true, 0.1)
players[name] = nil