From 2b5e3b5123505b943395ddf7cd2f6d2ca8a7f73a Mon Sep 17 00:00:00 2001 From: Sumyjkl Date: Tue, 2 Aug 2022 00:14:24 +1000 Subject: [PATCH] code quality: combine add_velocity calls into one --- mods/PLAYER/mcl_playerplus/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 94ebef52d..726d05151 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -344,7 +344,8 @@ minetest.register_globalstep(function(dtime) -- NOTE: do not set this higher than about 0.7 or the game will get the wrong vel and it will be broken -- this is far from ideal, but there's no good way to set_velocity on the player player_vel = vector.multiply(player_vel, -0.4) - player:add_velocity(player_vel) + new_vel = vector.add(new_vel, player_vel) + new_vel.y = new_vel.y - (200 / math.max(speed_mult, 2)) * dtime new_vel.y = new_vel.y - fall_speed * dtime player:add_velocity(new_vel)