mirror of
https://github.com/Poikilos/mobs.git
synced 2023-10-03 07:28:50 -07:00
Fix not walking sheep when player is in view radius
This commit is contained in:
parent
0b7ff005d4
commit
b3b4e7cd71
6
api.lua
6
api.lua
@ -248,22 +248,16 @@ function mobs:register_mob(name, def)
|
||||
|
||||
if self.following and self.following:is_player() then
|
||||
if self.following:get_wielded_item():get_name() ~= self.follow then
|
||||
self.state = "stand"
|
||||
self.set_velocity(self, 0)
|
||||
self.following = nil
|
||||
self.v_start = false
|
||||
self:set_animation("stand")
|
||||
return
|
||||
end
|
||||
local s = self.object:getpos()
|
||||
local p = self.following:getpos()
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||
if dist > self.view_range then
|
||||
self.state = "stand"
|
||||
self.set_velocity(self, 0)
|
||||
self.following = nil
|
||||
self.v_start = false
|
||||
self:set_animation("stand")
|
||||
return
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user