don't hurt perched parrot on punch

This commit is contained in:
cora 2022-05-23 19:59:59 +02:00
parent e90e17e533
commit c0a9cb7020

@ -153,25 +153,19 @@ mcl_mobs:register_mob("mobs_mc:parrot", {
end end
return return
end end
-- Feed to tame, but not breed -- Feed to tame, but not breed
if mobs:feed_tame(self, clicker, 1, false, true) then return end if mobs:feed_tame(self, clicker, 1, false, true) then return end
perch(self,clicker) perch(self,clicker)
end, end,
do_custom = function(self,dtime) do_custom = function(self,dtime)
check_perch(self,dtime) check_perch(self,dtime)
end end,
do_punch = function(self,puncher) --do_punch is the mcl_mobs_redo variant - it gets called by on_punch later....
}) if self.object:get_attach() == puncher then
return false --return false explicitly here. mcl_mobs checks for that
minetest.register_on_leaveplayer(function(p)
for _,o in pairs(p:get_children()) do
local l = o:get_luaentity()
if l and l.name == "mobs_mc:parrot" then
l.object:set_detach()
end end
end end,
end) })
-- Parrots spawn rarely in jungles. TODO: Also check for jungle *biome* <- I'll get to this eventually -j4i -- Parrots spawn rarely in jungles. TODO: Also check for jungle *biome* <- I'll get to this eventually -j4i
mcl_mobs:spawn_specific( mcl_mobs:spawn_specific(