move heal under tame so that you can tame an animal and then heal it, like in MC

This commit is contained in:
SumianVoice 2022-07-19 14:38:32 +10:00 committed by cora
parent e6a97031ef
commit 524da8a6cb
1 changed files with 10 additions and 11 deletions

View File

@ -4369,6 +4369,16 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame, notake)
if self.nofollow or follow_holding(self, clicker) then if self.nofollow or follow_holding(self, clicker) then
local consume_food = false local consume_food = false
-- feed and tame
if tame then
self.tamed = true
if not self.owner or self.owner == "" then
self.owner = clicker:get_player_name()
consume_food = true
end
end
-- increase health -- increase health
if self.health < self.hp_max then if self.health < self.hp_max then
@ -4381,17 +4391,6 @@ function mcl_mobs:feed_tame(self, clicker, feed_count, breed, tame, notake)
self.object:set_hp(self.health) self.object:set_hp(self.health)
end end
-- feed and tame
if tame then
self.tamed = true
if not self.owner or self.owner == "" then
self.owner = clicker:get_player_name()
consume_food = true
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.food = (self.food or 0) + 1 self.food = (self.food or 0) + 1