forked from mtcontrib/mobs_monster
add sanity check to spiders
This commit is contained in:
parent
33a314934a
commit
ffc136296e
@ -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", {
|
|||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user