From a43627e268315b1076be739d8287ab2d49c49b30 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 12 Jun 2022 03:03:32 +0200 Subject: [PATCH] Fix 2 wrong variable uses that made warnings --- mods/ENTITIES/mcl_mobs/api.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 577c4c2aaa..30e8a257de 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -2326,9 +2326,8 @@ local do_states = function(self, dtime) local s = self.object:get_pos() local objs = minetest.get_objects_inside_radius(s, 3) - + local lp for n = 1, #objs do - if objs[n]:is_player() then lp = objs[n]:get_pos() break @@ -2336,7 +2335,7 @@ local do_states = function(self, dtime) end -- look at any players nearby, otherwise turn randomly - if self.look_at_players then + if lp and self.look_at_players then local vec = { x = lp.x - s.x, @@ -2964,7 +2963,7 @@ local function damage_mob(self,reason,damage) if damage > 0 then self.health = self.health - damage - effect(pos, 5, "mcl_particles_smoke.png", 1, 2, 2, nil) + effect(self.object:get_pos(), 5, "mcl_particles_smoke.png", 1, 2, 2, nil) if check_for_death(self, reason, {type = reason}) then return true