Fix walk timer

master
isaiah658 2022-08-12 01:33:47 +02:00
parent 4863dc64cc
commit 21461b298c
1 changed files with 3 additions and 2 deletions

View File

@ -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")