From 3697ef806922d17c54c3e324f291beed4aa7f1d8 Mon Sep 17 00:00:00 2001 From: gldrk Date: Sat, 14 Jan 2023 01:28:35 +0300 Subject: [PATCH 1/4] Fix summoning friends for mobs --- mods/ENTITIES/mcl_mobs/combat.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/combat.lua b/mods/ENTITIES/mcl_mobs/combat.lua index 1886c7ccc..9c9fd7626 100644 --- a/mods/ENTITIES/mcl_mobs/combat.lua +++ b/mods/ENTITIES/mcl_mobs/combat.lua @@ -776,7 +776,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir) obj:do_attack(hitter) elseif type(obj.group_attack) == "table" then for i=1, #obj.group_attack do - if obj.name == obj.group_attack[i] then + if obj.group_attack[i] == self.name then obj._aggro = true obj:do_attack(hitter) break From 153633819906854cbb1b114bc65a2b213ef255c9 Mon Sep 17 00:00:00 2001 From: gldrk Date: Sat, 14 Jan 2023 01:32:42 +0300 Subject: [PATCH 2/4] Allow passive mobs to have protectors --- mods/ENTITIES/mcl_mobs/combat.lua | 48 +++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/combat.lua b/mods/ENTITIES/mcl_mobs/combat.lua index 9c9fd7626..b7d176855 100644 --- a/mods/ENTITIES/mcl_mobs/combat.lua +++ b/mods/ENTITIES/mcl_mobs/combat.lua @@ -746,7 +746,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir) local name = hitter:get_player_name() or "" - -- attack puncher and call other mobs for help + -- attack puncher if self.passive == false and self.state ~= "flop" and (self.child == false or self.type == "monster") @@ -758,37 +758,37 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir) self:do_attack(hitter) self._aggro= true end + end - -- alert others to the attack - local objs = minetest.get_objects_inside_radius(hitter:get_pos(), self.view_range) - local obj = nil + -- alert others to the attack + local objs = minetest.get_objects_inside_radius(hitter:get_pos(), self.view_range) + local obj = nil - for n = 1, #objs do + for n = 1, #objs do - obj = objs[n]:get_luaentity() + obj = objs[n]:get_luaentity() - if obj then - -- only alert members of same mob or friends - if obj.group_attack - and obj.state ~= "attack" - and obj.owner ~= name then - if obj.name == self.name then - obj:do_attack(hitter) - elseif type(obj.group_attack) == "table" then - for i=1, #obj.group_attack do - if obj.group_attack[i] == self.name then - obj._aggro = true - obj:do_attack(hitter) - break - end + if obj then + -- only alert members of same mob or friends + if obj.group_attack + and obj.state ~= "attack" + and obj.owner ~= name then + if obj.name == self.name then + obj:do_attack(hitter) + elseif type(obj.group_attack) == "table" then + for i=1, #obj.group_attack do + if obj.group_attack[i] == self.name then + obj._aggro = true + obj:do_attack(hitter) + break end end end + end - -- have owned mobs attack player threat - if obj.owner == name and obj.owner_loyal then - obj:do_attack(self.object) - end + -- have owned mobs attack player threat + if obj.owner == name and obj.owner_loyal then + obj:do_attack(self.object) end end end From 30521a8b2f737a7561cc2d2dcda025d8ca7ffec5 Mon Sep 17 00:00:00 2001 From: gldrk Date: Sat, 14 Jan 2023 01:34:28 +0300 Subject: [PATCH 3/4] Make iron golem defend itself from players --- mods/ENTITIES/mobs_mc/iron_golem.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/iron_golem.lua b/mods/ENTITIES/mobs_mc/iron_golem.lua index 7ca4dd88a..af7d8a49d 100644 --- a/mods/ENTITIES/mobs_mc/iron_golem.lua +++ b/mods/ENTITIES/mobs_mc/iron_golem.lua @@ -15,7 +15,7 @@ mcl_mobs.register_mob("mobs_mc:iron_golem", { description = S("Iron Golem"), type = "npc", spawn_class = "passive", - passive = true, + passive = false, hp_min = 100, hp_max = 100, breath_max = -1, From 54122067431569b052580ed6d1eb4187110499fb Mon Sep 17 00:00:00 2001 From: gldrk Date: Sat, 14 Jan 2023 01:35:50 +0300 Subject: [PATCH 4/4] Make iron golem protect villagers --- mods/ENTITIES/mobs_mc/iron_golem.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/iron_golem.lua b/mods/ENTITIES/mobs_mc/iron_golem.lua index af7d8a49d..34a7a511c 100644 --- a/mods/ENTITIES/mobs_mc/iron_golem.lua +++ b/mods/ENTITIES/mobs_mc/iron_golem.lua @@ -42,7 +42,7 @@ mcl_mobs.register_mob("mobs_mc:iron_golem", { damage = 14, knock_back = false, reach = 3, - group_attack = true, + group_attack = { "mobs_mc:villager" }, attacks_monsters = true, attack_type = "dogfight", _got_poppy = false,