1
0
Fork 0

If mob jumped against wall 4 times, turn around

objects
Wuzzy 2019-02-06 08:51:09 +01:00
parent d4fe313077
commit 37b9b6fbfc
1 changed files with 16 additions and 0 deletions

View File

@ -805,6 +805,22 @@ local do_jump = function(self)
self.facing_fence = true self.facing_fence = true
end end
-- if we jumped against a block/wall 4 times then turn
if self.object:get_velocity().x ~= 0
and self.object:get_velocity().z ~= 0 then
self.jump_count = (self.jump_count or 0) + 1
if self.jump_count == 4 then
local yaw = self.object:get_yaw() or 0
yaw = set_yaw(self, yaw + 1.35, 8)
self.jump_count = 0
end
end
return true return true
end end