Merge pull request 'Fix Global var warnings' (#2305) from fix_global_var_warnings into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2305
Reviewed-by: MysticTempest <mystictempest@noreply.git.minetest.land>
This commit is contained in:
cora 2022-06-13 00:46:49 +00:00
commit 8aaa7f9400

View file

@ -2326,9 +2326,8 @@ local do_states = function(self, dtime)
local s = self.object:get_pos() local s = self.object:get_pos()
local objs = minetest.get_objects_inside_radius(s, 3) local objs = minetest.get_objects_inside_radius(s, 3)
local lp
for n = 1, #objs do for n = 1, #objs do
if objs[n]:is_player() then if objs[n]:is_player() then
lp = objs[n]:get_pos() lp = objs[n]:get_pos()
break break
@ -2336,7 +2335,7 @@ local do_states = function(self, dtime)
end end
-- look at any players nearby, otherwise turn randomly -- look at any players nearby, otherwise turn randomly
if self.look_at_players then if lp and self.look_at_players then
local vec = { local vec = {
x = lp.x - s.x, x = lp.x - s.x,
@ -2964,7 +2963,7 @@ local function damage_mob(self,reason,damage)
if damage > 0 then if damage > 0 then
self.health = self.health - damage 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 if check_for_death(self, reason, {type = reason}) then
return true return true