1
0
Fork 0

Fix 2 wrong variable uses that made warnings

This commit is contained in:
cora 2022-06-12 03:03:32 +02:00 committed by Gitea
parent 00e94c81c4
commit a43627e268
1 changed files with 3 additions and 4 deletions

View File

@ -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