forked from MineClone5/MineClone5
#123 Fix a crash in mob api
This commit is contained in:
parent
fda5aa1395
commit
6fe6885fdb
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue