From ff882707def990b5e30eede831a7f4aa43626a1d Mon Sep 17 00:00:00 2001 From: Eliy21 Date: Tue, 19 Dec 2023 16:15:41 +0000 Subject: [PATCH] Rework moving majority of the added velocity knockbacks into sprinting --- mods/ITEMS/mcl_enchanting/enchantments.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_enchanting/enchantments.lua b/mods/ITEMS/mcl_enchanting/enchantments.lua index c26df61d9..7744f2c7e 100644 --- a/mods/ITEMS/mcl_enchanting/enchantments.lua +++ b/mods/ITEMS/mcl_enchanting/enchantments.lua @@ -307,12 +307,15 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool end end -- add player velocity to knockback + local h_name = hitter:get_player_name() local hv = hitter:get_velocity() local dir_dot = (hv.x * dir.x) + (hv.z * dir.z) local hitter_mag = math.sqrt((hv.x * hv.x) + (hv.z * hv.z)) local player_mag = math.sqrt((v.x * v.x) + (v.z * v.z)) - if dir_dot > 0 then + if dir_dot > 0 and mcl_sprint.is_sprinting(h_name) then knockback = knockback + hitter_mag * 0.6875 + elseif dir_dot > 0 then + knockback = knockback + hitter_mag * 0.34375 end -- reduce floatiness minetest.after(0.25, function()