Merge pull request 'Iron golem fixes' (#3309) from gldrk/MineClone2:master into master

Reviewed-on: MineClone2/MineClone2#3309
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
This commit is contained in:
ancientmarinerdev 2023-01-22 00:45:53 +00:00
commit ce7d493890
2 changed files with 26 additions and 26 deletions

View File

@ -746,7 +746,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
local name = hitter:get_player_name() or "" local name = hitter:get_player_name() or ""
-- attack puncher and call other mobs for help -- attack puncher
if self.passive == false if self.passive == false
and self.state ~= "flop" and self.state ~= "flop"
and (self.child == false or self.type == "monster") and (self.child == false or self.type == "monster")
@ -758,6 +758,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
self:do_attack(hitter) self:do_attack(hitter)
self._aggro= true self._aggro= true
end end
end
-- alert others to the attack -- alert others to the attack
local objs = minetest.get_objects_inside_radius(hitter:get_pos(), self.view_range) local objs = minetest.get_objects_inside_radius(hitter:get_pos(), self.view_range)
@ -776,7 +777,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
obj:do_attack(hitter) obj:do_attack(hitter)
elseif type(obj.group_attack) == "table" then elseif type(obj.group_attack) == "table" then
for i=1, #obj.group_attack do 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._aggro = true
obj:do_attack(hitter) obj:do_attack(hitter)
break break
@ -791,7 +792,6 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
end end
end end
end end
end
end end
function mob_class:check_aggro(dtime) function mob_class:check_aggro(dtime)

View File

@ -15,7 +15,7 @@ mcl_mobs.register_mob("mobs_mc:iron_golem", {
description = S("Iron Golem"), description = S("Iron Golem"),
type = "npc", type = "npc",
spawn_class = "passive", spawn_class = "passive",
passive = true, passive = false,
hp_min = 100, hp_min = 100,
hp_max = 100, hp_max = 100,
breath_max = -1, breath_max = -1,
@ -42,7 +42,7 @@ mcl_mobs.register_mob("mobs_mc:iron_golem", {
damage = 14, damage = 14,
knock_back = false, knock_back = false,
reach = 3, reach = 3,
group_attack = true, group_attack = { "mobs_mc:villager" },
attacks_monsters = true, attacks_monsters = true,
attack_type = "dogfight", attack_type = "dogfight",
_got_poppy = false, _got_poppy = false,