This commit is contained in:
Jacob Lifshay 2024-09-07 16:38:58 -07:00 committed by GitHub
commit 7d7c6e1c16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -591,12 +591,14 @@ function animalia.action_melee(self, target)
if stage == 2
and dist < mob.width + 1 then
mob:punch_target(target)
local knockback = minetest.calculate_knockback(
target, mob.object, 1.0,
{damage_groups = {fleshy = mob.damage}},
dir, 2.0, mob.damage
)
target:add_velocity({x = dir.x * knockback, y = dir.y * knockback, z = dir.z * knockback})
if target:get_pos() then -- target may have died and disappeared
local knockback = minetest.calculate_knockback(
target, mob.object, 1.0,
{damage_groups = {fleshy = mob.damage}},
dir, 2.0, mob.damage
)
target:add_velocity({x = dir.x * knockback, y = dir.y * knockback, z = dir.z * knockback})
end
stage = 3
end