[SOLVED] Need help with mass deleting chunks (function)

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
QuackerJ4ck
Inserter
Inserter
Posts: 44
Joined: Wed Apr 06, 2016 4:06 pm
Contact:

[SOLVED] Need help with mass deleting chunks (function)

Post by QuackerJ4ck »

Hi guys,

I revealed a "little" too much of a map and to crop the savefile and save performance i want to delete pretty much all chunks around my base.

I know there is the command

Code: Select all

/c game.player.surface.delete_chunk{X, Y}
But doing this by hand would take me around 45 years

I need pretty much a function that deletes all the chunks from the outer frame to the inner one (if possible near the red area)
Starting Area (around 0,0) is the green Circle.

Is the function able to do that?

When you need more data or coords of the map; i'm more than happy to provide that.

I hope someone can help me :-)
Attachments
Base.png
Base.png (1.66 MiB) Viewed 685 times
Zwischenablage01.jpg
Zwischenablage01.jpg (632.21 KiB) Viewed 685 times
Last edited by QuackerJ4ck on Thu May 11, 2017 8:00 pm, edited 1 time in total.

SpeedDaemon
Fast Inserter
Fast Inserter
Posts: 124
Joined: Fri May 22, 2015 3:31 pm
Contact:

Re: Need help with mass deleting chunks (function)

Post by SpeedDaemon »

I think you can put LUA scripts, including loops, into the game console, which would mean you could automate running the delete_chunk command... I don't have an example available right now, though.

EDIT:
Try this:

Code: Select all

/c for x=<start>,<end> do
   for y=<start>,<end> do
       game.player.surface.delete_chunk{x, y}
   end
end
Replace <start> and <end> with range of x/y coords you want to remove. You'll need to run this four times to delete rectangles of chunks around the area you want to keep.

QuackerJ4ck
Inserter
Inserter
Posts: 44
Joined: Wed Apr 06, 2016 4:06 pm
Contact:

Re: Need help with mass deleting chunks (function)

Post by QuackerJ4ck »

I love you forever - worked like a charm.

Post Reply

Return to “Gameplay Help”

Who is online

Users browsing this forum: No registered users