forked from VoxeLibre/VoxeLibre
Add maximum pvp knockback limit & approximate enchant knockback distance to be similar to MC
This commit is contained in:
parent
bf9e487fa9
commit
6b439fd1de
|
@ -282,7 +282,7 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
|
|||
end
|
||||
if hitter and hitter:is_player() and distance <= 3 then
|
||||
local wielditem = hitter:get_wielded_item()
|
||||
knockback = knockback + 5 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||
knockback = knockback + 3 * mcl_enchanting.get_enchantment(wielditem, "knockback")
|
||||
-- add vertical lift to knockback
|
||||
local v = player:get_velocity()
|
||||
if v and v.y <= 0.1 and v.y >= -0.1 and dir.y <= 0.44 then
|
||||
|
@ -304,6 +304,10 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
|
|||
if dir_dot > 0 and player_mag <= hitter_mag * 0.625 then
|
||||
knockback = knockback + hitter_mag * 0.375
|
||||
end
|
||||
-- add maximum knockback limit
|
||||
if knockback > 12.875 then
|
||||
knockback = 12.875
|
||||
end
|
||||
elseif hitter and hitter:is_player() and distance > 3 then
|
||||
knockback = 0
|
||||
elseif luaentity and luaentity._knockback then
|
||||
|
|
Loading…
Reference in New Issue