Move variable declaration out of loops to increase performance.

This commit is contained in:
Brandon 2020-07-16 20:20:13 -04:00
parent 1dda98fa4c
commit 64a2a6bb53

View file

@ -264,7 +264,6 @@ local is_fire_node = { ["mcl_core:lava_flowing"]=true,
["mcl_nether:nether_lava_flowing"]=true, ["mcl_nether:nether_lava_flowing"]=true,
["mcl_nether:nether_lava_source"]=true} ["mcl_nether:nether_lava_source"]=true}
-- Prevent damage to player with Fire Resistance enabled -- Prevent damage to player with Fire Resistance enabled
minetest.register_on_player_hpchange(function(player, hp_change, reason) 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) function mcl_potions.is_obj_hit(self, pos)
local entity
for _,object in pairs(minetest.get_objects_inside_radius(pos, 1.1)) do 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 if entity and entity.name ~= self.object:get_luaentity().name then