mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 08:29:34 +01:00
Counteract self forward velocity when hit by players in pvp
This commit is contained in:
parent
e19de85990
commit
96fa6c251e
1 changed files with 5 additions and 0 deletions
|
@ -308,6 +308,11 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool
|
|||
knockback = knockback + 0.609375
|
||||
end
|
||||
end
|
||||
-- counteract forward velocity when hit
|
||||
local self_dir_dot = (v.x * dir.x) + (v.z * dir.z)
|
||||
if self_dir_dot < 0 then
|
||||
player:add_velocity({x = v.x * -1, y = 0, z = v.z * -1})
|
||||
end
|
||||
-- add player velocity to knockback
|
||||
local h_name = hitter:get_player_name()
|
||||
local hv = hitter:get_velocity()
|
||||
|
|
Loading…
Reference in a new issue