#123 Fix a crash in mob api

This commit is contained in:
kay27 2022-02-01 06:48:27 +04:00
parent fda5aa1395
commit 6fe6885fdb
1 changed files with 9 additions and 3 deletions

View File

@ -173,9 +173,15 @@ mobs.punch_attack = function(self)
dir = vector_multiply(dir,3)
if self.attacking:get_velocity().y <= 1 then
dir.y = 5
end
local attacking = self.attacking
if attacking then
local attacking_velocity = attacking:get_velocity() or attacking:get_player_velocity()
if attacking_velocity then
if attacking_velocity.y <= 1 then
dir.y = 5
end
end
end
self.attacking:add_velocity(dir)
end