Fix sheep sliding, make eating timed, fix animation repeat

This commit is contained in:
epCode 2023-05-30 12:03:13 -07:00 committed by epCode
parent 1f5247df06
commit c049113f26
2 changed files with 14 additions and 3 deletions

View file

@ -524,7 +524,18 @@ function mob_class:replace_node(pos)
if mobs_griefing then if mobs_griefing then
self.state = "eat" self.state = "eat"
self:set_animation("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
end end

View file

@ -101,13 +101,13 @@ mcl_mobs.register_mob("mobs_mc:sheep", {
stand_start = 0, stand_end = 0, stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40, walk_speed = 30, walk_start = 0, walk_end = 40, walk_speed = 30,
run_start = 0, run_end = 40, run_speed = 40, 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 = { child_animations = {
stand_start = 81, stand_end = 81, stand_start = 81, stand_end = 81,
walk_start = 81, walk_end = 121, walk_speed = 45, walk_start = 81, walk_end = 121, walk_speed = 45,
run_start = 81, run_end = 121, run_speed = 60, 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" }, follow = { "mcl_farming:wheat_item" },
view_range = 12, view_range = 12,