tiny refactor.

This commit is contained in:
trans_soup 2023-10-13 08:30:25 +02:00
parent 3c25192944
commit 732a8cb88a

View file

@ -22,6 +22,7 @@ local function handle_speed (player, delta_time)
data.duration = data.duration - delta_time * (slowdown_factor + 1) data.duration = data.duration - delta_time * (slowdown_factor + 1)
end end
if data.duration < 0 then data.duration = 0 end if data.duration < 0 then data.duration = 0 end
if data.duration > walk_time + speedup_time then data.duration = walk_time + speedup_time end
local duration = data.duration local duration = data.duration
@ -33,7 +34,6 @@ local function handle_speed (player, delta_time)
else else
local run_time = duration - walk_time local run_time = duration - walk_time
local t = run_time / speedup_time local t = run_time / speedup_time
if t > 1 then t = 1 end
local factor = (run_factor - 1) * t + 1 local factor = (run_factor - 1) * t + 1
if factor > run_factor then factor = run_factor end if factor > run_factor then factor = run_factor end