Page 1 of 1

Map editing - remove generated blocks?

Posted: Tue May 02, 2017 4:52 am
by zakman
Is it possible to edit a save game in such a way to delete (not just re-cover) parts of the map that have already been generated?

I have an older save that I just pulled into 0.15 and am playing around with, and at one point I had run the console command that generates a stupid large portion of the map. I'd like to cut that down a bit and get the game to regenerate those chunks...add a little bit of the exploration factor back into the map, you know?

Any tips or advice would be welcome. Thanks!

Re: Map editing - remove generated blocks?

Posted: Tue May 02, 2017 2:42 pm
by daniel34
Example code:

Code: Select all

/c game.player.surface.delete_chunk{0, 4}
This will delete a chunk directly below the starting area. Note that the position is given in chunks (not tiles), 1 chunk = 32 tiles. You probably need to do some scripting (for-loop) to delete an area since I don't think you can just specify an area directly.

Be aware that if you delete chunks created in 0.14 and they are later explored again in 0.15 the map generator will create a different chunk because it changed in 0.15: viewtopic.php?f=7&t=45812

Re: Map editing - remove generated blocks?

Posted: Wed May 03, 2017 1:11 am
by zakman
Thank you! I will definitely play around with this and see what I can do.

Re: Map editing - remove generated blocks?

Posted: Thu May 04, 2017 2:53 am
by zakman
Wanted to report back on how this went:

After playing around with the code a little bit, got the following to work:

/c for y=0,100 do
for x=0,100 do
game.player.surface.delete_chunk({x+150, y-200})
end
end

This will delete a 100x100 square of the map, starting at coordinates 150, -200.

Thanks again!

Re: Map editing - remove generated blocks?

Posted: Thu Sep 08, 2022 4:51 pm
by mrvn
Does someone have a script that does that for every chunk with no buildings on it?

I messed up the map generator while playing with it and now I have bad chunks in my save around my base. I want to delete everything but the base and generate that again.

Re: Map editing - remove generated blocks?

Posted: Thu Sep 08, 2022 5:00 pm
by FuryoftheStars
mrvn wrote:
Thu Sep 08, 2022 4:51 pm
Does someone have a script that does that for every chunk with no buildings on it?

I messed up the map generator while playing with it and now I have bad chunks in my save around my base. I want to delete everything but the base and generate that again.
There are some mods out there for that. Just search "delete chunk" on the mod portal. I haven't really used them myself, so I don't know which ones are best.

Re: Map editing - remove generated blocks?

Posted: Thu Sep 08, 2022 5:05 pm
by mmmPI

Re: Map editing - remove generated blocks?

Posted: Thu Sep 08, 2022 10:21 pm
by mrvn
FuryoftheStars wrote:
Thu Sep 08, 2022 5:00 pm
mrvn wrote:
Thu Sep 08, 2022 4:51 pm
Does someone have a script that does that for every chunk with no buildings on it?

I messed up the map generator while playing with it and now I have bad chunks in my save around my base. I want to delete everything but the base and generate that again.
There are some mods out there for that. Just search "delete chunk" on the mod portal. I haven't really used them myself, so I don't know which ones are best.
Thanks.