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

View file

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

View file

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

View file

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