Remove obsolete work-around code

This commit is contained in:
Eliy21 2023-12-16 12:58:58 +00:00
parent 32e91b45ae
commit e8ee9c4463
1 changed files with 8 additions and 18 deletions

View File

@ -289,20 +289,14 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
local v = player:get_velocity() local v = player:get_velocity()
local invul = player:get_meta():get_int("mcl_damage:invulnerable") local invul = player:get_meta():get_int("mcl_damage:invulnerable")
if v and v.y <= 0.01 and v.y >= -0.01 and invul == 0 then if v and v.y <= 0.01 and v.y >= -0.01 and invul == 0 then
if dir.y <= 0.3 then local regular_v = 6.4
local regular_v = 6.4 local enchant_v = 7
local enchant_v = 7 regular_v = regular_v * math.abs(dir.y - 1)
if dir.y <= 0.27 then enchant_v = enchant_v * math.abs(dir.y - 1)
regular_v = regular_v * math.abs(dir.y - 1) if enchant == 0 then
enchant_v = enchant_v * math.abs(dir.y - 1) player:add_velocity({x = 0, y = regular_v, z = 0})
end else
if enchant == 0 then player:add_velocity({x = 0, y = enchant_v, z = 0})
player:add_velocity({x = 0, y = regular_v, z = 0})
else
player:add_velocity({x = 0, y = enchant_v, z = 0})
end
elseif dir.y <= 0.44 and dir.y > 0.3 and enchant > 0 then
knockback = knockback + 3
end end
-- add minimum knockback -- add minimum knockback
if knockback <= 1.5 then if knockback <= 1.5 then
@ -317,10 +311,6 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
if dir_dot > 0 and player_mag <= hitter_mag * 0.625 then if dir_dot > 0 and player_mag <= hitter_mag * 0.625 then
knockback = knockback + hitter_mag * 0.6875 knockback = knockback + hitter_mag * 0.6875
end end
-- add vertical knockback limit on angled hit
if knockback > 6.275 and dir.y >= 0.3 and v.y == 0 and enchant == 0 then
knockback = 6.275
end
-- remove knockback if invulnerable -- remove knockback if invulnerable
if invul > 0 then if invul > 0 then
knockback = 0 knockback = 0