mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
Make vertical pvp knockbacks less floaty
This commit is contained in:
parent
e8ee9c4463
commit
0a8874ecad
1 changed files with 6 additions and 0 deletions
|
@ -291,13 +291,19 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
|
||||||
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
|
||||||
local regular_v = 6.4
|
local regular_v = 6.4
|
||||||
local enchant_v = 7
|
local enchant_v = 7
|
||||||
|
local added_v = 0
|
||||||
regular_v = regular_v * math.abs(dir.y - 1)
|
regular_v = regular_v * math.abs(dir.y - 1)
|
||||||
enchant_v = enchant_v * math.abs(dir.y - 1)
|
enchant_v = enchant_v * math.abs(dir.y - 1)
|
||||||
if enchant == 0 then
|
if enchant == 0 then
|
||||||
player:add_velocity({x = 0, y = regular_v, z = 0})
|
player:add_velocity({x = 0, y = regular_v, z = 0})
|
||||||
|
added_v = regular_v
|
||||||
else
|
else
|
||||||
player:add_velocity({x = 0, y = enchant_v, z = 0})
|
player:add_velocity({x = 0, y = enchant_v, z = 0})
|
||||||
|
added_v = enchant_v
|
||||||
end
|
end
|
||||||
|
minetest.after(0.25, function()
|
||||||
|
player:add_velocity({x = 0, y = -added_v * 0.375 , z = 0})
|
||||||
|
end)
|
||||||
-- add minimum knockback
|
-- add minimum knockback
|
||||||
if knockback <= 1.5 then
|
if knockback <= 1.5 then
|
||||||
knockback = knockback + 4.875
|
knockback = knockback + 4.875
|
||||||
|
|
Loading…
Reference in a new issue