mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-29 04:37:31 +01:00
Prevent excessive vertical knockbacks if hit by a player from below
This commit is contained in:
parent
c9692c6224
commit
9b9747b3d8
@ -286,7 +286,7 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
|
||||
-- add vertical lift to knockback
|
||||
local v = player:get_velocity()
|
||||
local invul = player:get_meta():get_int("mcl_damage:invulnerable")
|
||||
if v and v.y <= 0.1 and v.y >= -0.1 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 then
|
||||
if mcl_enchanting.get_enchantment(wielditem, "knockback") == 0 then
|
||||
player:add_velocity({x = 0, y = 6.4, z = 0})
|
||||
@ -311,6 +311,9 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
|
||||
if knockback > 12.875 then
|
||||
knockback = 12.875
|
||||
end
|
||||
if knockback > 6.4375 and dir.y >= 0.3 then
|
||||
knockback = 6.4375
|
||||
end
|
||||
-- remove knockback if invulnerable
|
||||
if invul > 0 then
|
||||
knockback = 0
|
||||
|
Loading…
Reference in New Issue
Block a user