Map editing - remove generated blocks?

Post all other topics which do not belong to any other category.
Post Reply
zakman
Inserter
Inserter
Posts: 33
Joined: Fri Jun 03, 2016 1:48 am
Contact:

Map editing - remove generated blocks?

Post 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!

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Map editing - remove generated blocks?

Post 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
quick links: log file | graphical issues | wiki

zakman
Inserter
Inserter
Posts: 33
Joined: Fri Jun 03, 2016 1:48 am
Contact:

Re: Map editing - remove generated blocks?

Post by zakman »

Thank you! I will definitely play around with this and see what I can do.

zakman
Inserter
Inserter
Posts: 33
Joined: Fri Jun 03, 2016 1:48 am
Contact:

Re: Map editing - remove generated blocks?

Post 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!

mrvn
Smart Inserter
Smart Inserter
Posts: 5354
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Map editing - remove generated blocks?

Post 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.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 1425
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Map editing - remove generated blocks?

Post 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.


mrvn
Smart Inserter
Smart Inserter
Posts: 5354
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Map editing - remove generated blocks?

Post 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.

Post Reply

Return to “General discussion”