From 64a2a6bb53a2008f68bd8e2f0304dce8b416aa13 Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 16 Jul 2020 20:20:13 -0400 Subject: [PATCH] Move variable declaration out of loops to increase performance. --- mods/ITEMS/mcl_potions/functions.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_potions/functions.lua b/mods/ITEMS/mcl_potions/functions.lua index a4f20dd8b6..810f072ce6 100644 --- a/mods/ITEMS/mcl_potions/functions.lua +++ b/mods/ITEMS/mcl_potions/functions.lua @@ -264,7 +264,6 @@ local is_fire_node = { ["mcl_core:lava_flowing"]=true, ["mcl_nether:nether_lava_flowing"]=true, ["mcl_nether:nether_lava_source"]=true} - -- Prevent damage to player with Fire Resistance enabled minetest.register_on_player_hpchange(function(player, hp_change, reason) @@ -344,9 +343,10 @@ minetest.register_on_dieplayer( function(player) mcl_potions._reset_player_effec function mcl_potions.is_obj_hit(self, pos) + local entity for _,object in pairs(minetest.get_objects_inside_radius(pos, 1.1)) do - local entity = object:get_luaentity() + entity = object:get_luaentity() if entity and entity.name ~= self.object:get_luaentity().name then