diff --git a/init.lua b/init.lua index 3611148..0ab1dde 100644 --- a/init.lua +++ b/init.lua @@ -5,7 +5,6 @@ local modpath = minetest.get_modpath("cartographer"); -- The API object cartographer = { - scan_queue = {}, }; local map_data = { diff --git a/scanner.lua b/scanner.lua index aeb31bb..449eaa4 100644 --- a/scanner.lua +++ b/scanner.lua @@ -2,6 +2,8 @@ -- map_data: The cartographer map data table local map_data, chunk = ...; +local scan_queue = {}; + -- Register a new tile in map data -- x: The x position in map coordinates -- y: The y position in map coordinates @@ -172,24 +174,24 @@ function cartographer.queue_region(pos) return; end - for _,queued_pos in ipairs(cartographer.scan_queue) do + for _,queued_pos in ipairs(scan_queue) do if vector.equals(converted, queued_pos) then return; end end - cartographer.scan_queue[#cartographer.scan_queue + 1] = converted; + scan_queue[#scan_queue + 1] = converted; end -- Scan the next tile on the queue, and remove it function cartographer.scan_regions() - local len = #cartographer.scan_queue; + local len = #scan_queue; if len == 0 then return; end - local startpos = cartographer.scan_queue[1]; + local startpos = scan_queue[1]; local chunk_x = chunk.to(startpos.x); local chunk_y = chunk.to(startpos.y); local chunk_z = chunk.to(startpos.z); @@ -201,7 +203,7 @@ function cartographer.scan_regions() }; if is_scan_handled(chunk_x, startpos.y, chunk_z) then - table.remove(cartographer.scan_queue, 1); + table.remove(scan_queue, 1); return; end @@ -210,7 +212,7 @@ function cartographer.scan_regions() register_tile(chunk_x, chunk_z, biome, height, true) end - table.remove(cartographer.scan_queue, 1); + table.remove(scan_queue, 1); end minetest.register_on_generated(on_generated);