Only zombies attack villagers

This commit is contained in:
cora 2022-08-01 00:36:33 +02:00 committed by Gitea
parent 4bc6210fda
commit f629a6ba9d
3 changed files with 4 additions and 1 deletions

@ -1949,7 +1949,7 @@ local monster_attack = function(self)
-- find specific mob to attack, failing that attack player/npc/animal
if specific_attack(self.specific_attack, name)
and (type == "player" or type == "npc"
and (type == "player" or ( type == "npc" and self.attack_npcs )
or (type == "animal" and self.attack_animals == true)) then
p = player:get_pos()
@ -4033,6 +4033,7 @@ minetest.register_entity(name, {
dogshoot_count_max = def.dogshoot_count_max or 5,
dogshoot_count2_max = def.dogshoot_count2_max or (def.dogshoot_count_max or 5),
attack_animals = def.attack_animals or false,
attack_npcs = def.attack_npcs or false,
specific_attack = def.specific_attack,
runaway_from = def.runaway_from,
owner_loyal = def.owner_loyal,

@ -133,6 +133,7 @@ mcl_mobs:register_mob("mobs_mc:villager_zombie", {
view_range = 16,
fear_height = 4,
harmed_by_heal = true,
attack_npcs = true,
})
mcl_mobs:spawn_specific(

@ -101,6 +101,7 @@ local zombie = {
self.object:set_properties({visual_size = self.visual_size})
self.base_size = self.visual_size
end,
attack_npcs = true,
}
mcl_mobs:register_mob("mobs_mc:zombie", zombie)