Fix walk timer
parent
4863dc64cc
commit
21461b298c
|
@ -114,11 +114,12 @@ function mobs_api.register_mob(name, def)
|
|||
end
|
||||
elseif self._state == "walk" then
|
||||
self.set_animation(self, "walk")
|
||||
if math.random(1, 100) <= 30 and not self._stay_near then
|
||||
if math.random(1, 100) <= 30 and not self._walk_timer then
|
||||
self.object:set_yaw(self.object:get_yaw()+((math.random(0,360)-180)/180*math.pi))
|
||||
self.set_velocity(self, self.walk_velocity)
|
||||
end
|
||||
if math.random(1, 100) <= 20 and not self._stay_near or self._walk_timer and self._walk_timer <= 0 then
|
||||
if math.random(1, 100) <= 20 and not self._walk_timer or self._walk_timer and self._walk_timer <= 0 then
|
||||
self._walk_timer = nil
|
||||
self.set_velocity(self, 0)
|
||||
self._state = "stand"
|
||||
self:set_animation("stand")
|
||||
|
|
Loading…
Reference in New Issue