1
0
Fork 0

Finish remaining excessive vertical pvp knockback prevention adjustments when hit from below

This commit is contained in:
Eliy21 2023-12-16 07:58:26 +00:00
parent f799596db9
commit 33e8337bbb
1 changed files with 7 additions and 6 deletions

View File

@ -286,13 +286,16 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
-- add vertical lift to knockback -- add vertical lift to knockback
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")
local enchant = mcl_enchanting.get_enchantment(wielditem, "knockback")
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.44 and distance <= 3 then if dir.y <= 0.3 then
if mcl_enchanting.get_enchantment(wielditem, "knockback") == 0 then if enchant == 0 then
player:add_velocity({x = 0, y = 6.4, z = 0}) player:add_velocity({x = 0, y = 6.4, z = 0})
else else
player:add_velocity({x = 0, y = 7, z = 0}) player:add_velocity({x = 0, y = 7, z = 0})
end 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
@ -311,10 +314,8 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
if knockback > 12.875 then if knockback > 12.875 then
knockback = 12.875 knockback = 12.875
end end
if knockback > 6.4375 and dir.y >= 0.3 then if knockback > 6.275 and dir.y >= 0.3 and v.y == 0 and enchant == 0 then
knockback = 6.4375 knockback = 6.275
elseif knockback <= 6.4375 and dir.y >= 0.3 then
knockback = 1
end end
-- remove knockback if invulnerable -- remove knockback if invulnerable
if invul > 0 then if invul > 0 then