Currently I am doing this which saves time creating the table but still requires me to loop through to set all the positions:
Code: Select all
local blank_tiles = {}
for count = 0, 32*32-1 do
-- position will be updated before placement
blank_tiles[count] = {name= "out-of-map", position= {0, 0}}
end
local function wipe_chunk(surface, pos)
for dx = 0,31 do
for dy = 0,31 do
local blank_tile = blank_tiles[dy*32+dx]
blank_tile.position.x, blank_tile.position.y = pos.x + dx, pos.y + dy
end
end
local tile_correction = false -- causes problems with deep water
surface.set_tiles(tiles, tile_correction)
-- ...
Code: Select all
surface.set_tiles(tiles, tile_correction, pos)