Mobs: Add more nil checks
parent
c9b464f329
commit
28b1d5e8e9
|
@ -188,10 +188,10 @@ local set_velocity = function(self, v)
|
||||||
end
|
end
|
||||||
|
|
||||||
local yaw = (self.object:get_yaw() or 0) + self.rotate
|
local yaw = (self.object:get_yaw() or 0) + self.rotate
|
||||||
|
local vel = self.object:get_velocity()
|
||||||
self.object:set_velocity({
|
self.object:set_velocity({
|
||||||
x = sin(yaw) * -v,
|
x = sin(yaw) * -v,
|
||||||
y = self.object:get_velocity().y,
|
y = (vel and vel.y) or 0,
|
||||||
z = cos(yaw) * v
|
z = cos(yaw) * v
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -680,6 +680,9 @@ local is_at_cliff_or_danger = function(self)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not self.object:get_luaentity() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
local yaw = self.object:get_yaw()
|
local yaw = self.object:get_yaw()
|
||||||
local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5)
|
local dir_x = -sin(yaw) * (self.collisionbox[4] + 0.5)
|
||||||
local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5)
|
local dir_z = cos(yaw) * (self.collisionbox[4] + 0.5)
|
||||||
|
@ -3078,7 +3081,7 @@ local mob_step = function(self, dtime)
|
||||||
|
|
||||||
if self.delay and self.delay > 0 then
|
if self.delay and self.delay > 0 then
|
||||||
|
|
||||||
local yaw = self.object:get_yaw()
|
local yaw = self.object:get_yaw() or 0
|
||||||
|
|
||||||
if self.delay == 1 then
|
if self.delay == 1 then
|
||||||
yaw = self.target_yaw
|
yaw = self.target_yaw
|
||||||
|
|
Loading…
Reference in New Issue