Commit ffc13629 authored by tenplus1's avatar tenplus1
Browse files

add sanity check to spiders

parent 33a31493
...@@ -5,6 +5,9 @@ local get_velocity = function(self) ...@@ -5,6 +5,9 @@ local get_velocity = function(self)
local v = self.object:get_velocity() 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 return (v.x * v.x + v.z * v.z) ^ 0.5
end end
...@@ -119,6 +122,9 @@ mobs:register_mob("mobs_monster:spider", { ...@@ -119,6 +122,9 @@ mobs:register_mob("mobs_monster:spider", {
local pos = self.object:get_pos() local pos = self.object:get_pos()
local yaw = self.object:get_yaw() local yaw = self.object:get_yaw()
-- sanity check
if not yaw then return end
pos.y = pos.y + self.collisionbox[2] - 0.2 pos.y = pos.y + self.collisionbox[2] - 0.2
local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5) local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment