From 5f46f9649ab9817400abc02d8b5ccfb3fee50cc5 Mon Sep 17 00:00:00 2001 From: epCode <64379263+epCode@users.noreply.github.com> Date: Thu, 6 Oct 2022 14:21:57 -0700 Subject: [PATCH] Make mobs not always look at you+looks at own kind --- mods/ENTITIES/mcl_mobs/api.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 9e652231a..94a6bf425 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3717,13 +3717,13 @@ local mob_step = function(self, dtime) local oldp,oldr = self.object:get_bone_position(self.head_swivel) for _, obj in pairs(minetest.get_objects_inside_radius(pos, 10)) do - if obj:is_player() and not self.attack then + if obj:is_player() and not self.attack or obj:get_luaentity() and obj:get_luaentity().name == self.name and self ~= obj:get_luaentity() then if not self._locked_object then - if math.random(50/self.curiosity) == 1 then + if math.random(5000/self.curiosity) == 1 then self._locked_object = obj end else - if math.random(200*self.curiosity) == 1 then + if math.random(5000/self.curiosity) == 1 then self._locked_object = nil end end @@ -3736,6 +3736,9 @@ local mob_step = function(self, dtime) if self._locked_object and (self._locked_object:is_player() or self._locked_object:get_luaentity()) and self._locked_object:get_hp() > 0 then local _locked_object_eye_height = 1.5 + if self._locked_object:get_luaentity() then + _locked_object_eye_height = self._locked_object:get_luaentity().head_eye_height + end if self._locked_object:is_player() then _locked_object_eye_height = self._locked_object:get_properties().eye_height end