From 8e103cf615c06d125f6c8cdf207540553149a4ef Mon Sep 17 00:00:00 2001 From: emptyshore Date: Sun, 21 Jan 2024 05:37:54 +0000 Subject: [PATCH] Mobs should not anger towards the player if damage is disabled. (#4114) Co-authored-by: Mateusz Uzdowski Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4114 Reviewed-by: the-real-herowl Co-authored-by: emptyshore Co-committed-by: emptyshore --- mods/ENTITIES/mcl_mobs/combat.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/combat.lua b/mods/ENTITIES/mcl_mobs/combat.lua index b701b48fe..745a06c5c 100644 --- a/mods/ENTITIES/mcl_mobs/combat.lua +++ b/mods/ENTITIES/mcl_mobs/combat.lua @@ -35,14 +35,19 @@ function mob_class:day_docile() end end --- attack player/mob -function mob_class:do_attack(player) +-- get this mob to attack the object +function mob_class:do_attack(object) if self.state == "attack" or self.state == "die" then return end - self.attack = player + + if object:is_player() and not minetest.settings:get_bool("enable_damage") then + return + end + + self.attack = object self.state = "attack" -- TODO: Implement war_cry sound without being annoying