From f952ee47401efc2202eb8a1cdfa84ec0d8bd04e2 Mon Sep 17 00:00:00 2001 From: Anthony Zhang Date: Thu, 30 May 2013 19:05:45 -0400 Subject: Block queue doesn't lag anymore on slow operations like digging and placing nodes, better and more efficient //fixlight. --- worldedit/manipulations.lua | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'worldedit/manipulations.lua') diff --git a/worldedit/manipulations.lua b/worldedit/manipulations.lua index 71ff61e..b5bcd3c 100644 --- a/worldedit/manipulations.lua +++ b/worldedit/manipulations.lua @@ -397,19 +397,15 @@ worldedit.fixlight = function(pos1, pos2, env) if env == nil then env = minetest.env end local count = 0 - local pos = {x=pos1.x, y=0, z=0} + local pos = {x=pos1.x, y=pos2.y, z=0} while pos.x <= pos2.x do - pos.y = pos1.y - while pos.y <= pos2.y do - pos.z = pos1.z - while pos.z <= pos2.z do - if env:get_node(pos).name == "air" then - env:dig_node(pos) - count = count + 1 - end - pos.z = pos.z + 1 + pos.z = pos1.z + while pos.z <= pos2.z do + if env:get_node(pos).name == "air" then + env:dig_node(pos) + count = count + 1 end - pos.y = pos.y + 1 + pos.z = pos.z + 1 end pos.x = pos.x + 1 end -- cgit v1.2.3