1
0
Fork 0

move self.food check

This commit is contained in:
SumianVoice 2022-07-19 14:23:54 +10:00 committed by cora
parent 9d52fed357
commit 120b096fc8
1 changed files with 18 additions and 18 deletions

View File

@ -4383,11 +4383,6 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame, notake)
-- feed and tame -- feed and tame
self.food = (self.food or 0) + 1
if self.food >= feed_count then
self.food = 0
if tame then if tame then
self.tamed = true self.tamed = true
if not self.owner or self.owner == "" then if not self.owner or self.owner == "" then
@ -4396,13 +4391,15 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame, notake)
end end
end end
if breed and not self.child and not consume_food if breed and not self.child and not consume_food
and self.hornytimer == 0 and not self.horny then and self.hornytimer == 0 and not self.horny then
self.horny = true self.food = (self.food or 0) + 1
consume_food = true consume_food = true
if self.food >= feed_count then
self.food = 0
self.horny = true
end end
-- make sound when fed so many times
mob_sound(self, "random", true)
end end
update_tag(self) update_tag(self)
@ -4426,6 +4423,9 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame, notake)
end end
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
else
-- make sound when fed so many times
mob_sound(self, "random", true)
end end
return true return true
end end