From f629a6ba9d5e1b9bf92de55b47cf705d721aa3c7 Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 1 Aug 2022 00:36:33 +0200 Subject: [PATCH] Only zombies attack villagers --- mods/ENTITIES/mcl_mobs/api.lua | 3 ++- mods/ENTITIES/mobs_mc/villager_zombie.lua | 1 + mods/ENTITIES/mobs_mc/zombie.lua | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 16f4343b15..6f3a4f13c7 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -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, diff --git a/mods/ENTITIES/mobs_mc/villager_zombie.lua b/mods/ENTITIES/mobs_mc/villager_zombie.lua index cd0e892152..cbb4fa1d3b 100644 --- a/mods/ENTITIES/mobs_mc/villager_zombie.lua +++ b/mods/ENTITIES/mobs_mc/villager_zombie.lua @@ -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( diff --git a/mods/ENTITIES/mobs_mc/zombie.lua b/mods/ENTITIES/mobs_mc/zombie.lua index 4bb77e5f9a..5ae7e922f6 100644 --- a/mods/ENTITIES/mobs_mc/zombie.lua +++ b/mods/ENTITIES/mobs_mc/zombie.lua @@ -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)