add sanity check to spiders

This commit is contained in:
tenplus1 2020-04-11 17:56:51 +01:00
parent 33a314934a
commit ffc136296e
1 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,9 @@ local get_velocity = function(self)
local v = self.object:get_velocity()
-- sanity check
if not v then return 0 end
return (v.x * v.x + v.z * v.z) ^ 0.5
end
@ -119,6 +122,9 @@ mobs:register_mob("mobs_monster:spider", {
local pos = self.object:get_pos()
local yaw = self.object:get_yaw()
-- sanity check
if not yaw then return end
pos.y = pos.y + self.collisionbox[2] - 0.2
local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5)