From c049113f26f0747c55b0e8526f2970311ae2d204 Mon Sep 17 00:00:00 2001 From: epCode Date: Tue, 30 May 2023 12:03:13 -0700 Subject: [PATCH] Fix sheep sliding, make eating timed, fix animation repeat --- mods/ENTITIES/mcl_mobs/movement.lua | 13 ++++++++++++- mods/ENTITIES/mobs_mc/sheep.lua | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/movement.lua b/mods/ENTITIES/mcl_mobs/movement.lua index 4e8ce3392..5909350ad 100644 --- a/mods/ENTITIES/mcl_mobs/movement.lua +++ b/mods/ENTITIES/mcl_mobs/movement.lua @@ -524,7 +524,18 @@ function mob_class:replace_node(pos) if mobs_griefing then self.state = "eat" self:set_animation("eat") - minetest.set_node(pos, newnode) + self:set_velocity(0) + minetest.after(0.5, function() + if self and self.object and not self.dead then + self.object:set_velocity(vector.new(0,0,0)) + minetest.set_node(pos, newnode) + end + end) + minetest.after(2.5, function() + if self and self.object and self.state == 'eat' and not self.dead then + self.state = "walk" + end + end) end end diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index b4fbda52c..f7d6e87f1 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -101,13 +101,13 @@ mcl_mobs.register_mob("mobs_mc:sheep", { stand_start = 0, stand_end = 0, walk_start = 0, walk_end = 40, walk_speed = 30, run_start = 0, run_end = 40, run_speed = 40, - eat_start = 40, eat_end = 80, + eat_start = 40, eat_end = 80, eat_loop = false, }, child_animations = { stand_start = 81, stand_end = 81, walk_start = 81, walk_end = 121, walk_speed = 45, run_start = 81, run_end = 121, run_speed = 60, - eat_start = 121, eat_start = 161, + eat_start = 121, eat_start = 161, eat_loop = false, }, follow = { "mcl_farming:wheat_item" }, view_range = 12,