1
0
Fork 0

Fix crash when guarding TNT explosions

This commit is contained in:
Eliy21 2024-01-28 16:16:40 +00:00
parent 3c6b334df1
commit 4b20ab689e
1 changed files with 2 additions and 1 deletions

View File

@ -347,7 +347,8 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
mcl_util.deal_damage(obj, damage, { type = "explosion", direct = direct, source = source })
if obj:is_player() or ent.tnt_knockback then
local shield_dot = vector.dot(obj:get_look_dir(), vector.subtract(pos, opos))
local player_dir = obj:get_look_dir() or opos
local shield_dot = vector.dot(player_dir, vector.subtract(pos, opos))
if obj:is_player() and mcl_shields and mcl_shields.is_blocking and mcl_shields.is_blocking(obj) and shield_dot >= 0 then
obj:add_velocity(vector.multiply(punch_dir, impact * 10))
else