1
0
Fork 0

mobs: add nofollow option so v. dont follow bread

This commit is contained in:
cora 2022-05-19 14:13:59 +02:00
parent 9a866e873e
commit dfb74cf9e9
2 changed files with 5 additions and 3 deletions

View File

@ -1438,6 +1438,7 @@ end
-- should mob follow what I'm holding ? -- should mob follow what I'm holding ?
local follow_holding = function(self, clicker) local follow_holding = function(self, clicker)
if self.nofollow then return false end
if mobs.invis[clicker:get_player_name()] then if mobs.invis[clicker:get_player_name()] then
return false return false
@ -3913,6 +3914,7 @@ minetest.register_entity(name, {
sounds = def.sounds or {}, sounds = def.sounds or {},
animation = def.animation, animation = def.animation,
follow = def.follow, follow = def.follow,
nofollow = def.nofollow,
jump = def.jump ~= false, jump = def.jump ~= false,
walk_chance = def.walk_chance or 50, walk_chance = def.walk_chance or 50,
attacks_monsters = def.attacks_monsters or false, attacks_monsters = def.attacks_monsters or false,
@ -4321,7 +4323,7 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
end end
-- can eat/tame with item in hand -- can eat/tame with item in hand
if follow_holding(self, clicker) then if self.nofollow or follow_holding(self, clicker) then
-- if not in creative then take item -- if not in creative then take item
if not mobs.is_creative(clicker:get_player_name()) then if not mobs.is_creative(clicker:get_player_name()) then

View File

@ -1231,6 +1231,7 @@ mobs:register_mob("mobs_mc:villager", {
die_loop = false, die_loop = false,
}, },
follow = mobs_mc.follow.villager, follow = mobs_mc.follow.villager,
nofollow = true,
view_range = 16, view_range = 16,
fear_height = 4, fear_height = 4,
jump = true, jump = true,
@ -1247,7 +1248,6 @@ mobs:register_mob("mobs_mc:villager", {
clicker = p clicker = p
end end
end end
if not clicker then minetest.log("no clicker") end
if clicker then if clicker then
mobs:feed_tame(self, clicker, 1, true, true) mobs:feed_tame(self, clicker, 1, true, true)
return return