Delete Empty Chunks

by Strath

Delete chunks which contain no player entities, configurable chunk radius & paving detection

Utilities
3 years ago
0.15 - 1.1
11.5K

g Is it possible to keep a radius around the player and delete everything else (even with entities)?

5 years ago

I have a 200,000 tile long rail line from the start point, I dont need the rail anymore, but its still there, so the script keeps it.

Is it possible to set the mod to delete everything outside of like 10,000 tiles from the players current position?

5 years ago
(updated 5 years ago)

It would be fairly simple. Here is a console command that does it:
/c for chunk in game.player.surface.get_chunks() do
local px = math.floor(game.player.position.x/32)
local py = math.floor(game.player.position.y/32)
local r = 10000/32
if math.sqrt((px-chunk.x)*(px-chunk.x) + (py-chunk.y)*(py-chunk.y)) > r then
game.player.surface.delete_chunk({chunk.x, chunk.y})
end
end

New response