Clear Map
Clear Map
Hi everyone,
I'm at the point of wanting to redesign my initial factory (I'm just about to start blue science production and need a better layout).
Is there a command I can type in that will just remove all entities I have placed down in game (I know that's a big drastic but I'm OK with it).
As long as I'm still at the same level of science research I don't mind starting again, I can hopefully but some better thought into the layout then.
Thanks,
Zenith
I'm at the point of wanting to redesign my initial factory (I'm just about to start blue science production and need a better layout).
Is there a command I can type in that will just remove all entities I have placed down in game (I know that's a big drastic but I'm OK with it).
As long as I'm still at the same level of science research I don't mind starting again, I can hopefully but some better thought into the layout then.
Thanks,
Zenith
Re: Clear Map
Code: Select all
local s = game.local_player.surface
for chunk in s.get_chunks() do
entities = s.find_entities_filtered{area={{chunk.x*32, chunk.y*32}, {chunk.x*32+32, chunk.y*32+32}}, force=game.local_player.force}
for _, v in pairs(entities) do
if v.type ~= "player" then
v.destroy()
end
end
end
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
-
- Filter Inserter
- Posts: 952
- Joined: Sat May 23, 2015 12:10 pm
- Contact:
Re: Clear Map
you can get the seed (IIRC) and map settings and then regenerate
Re: Clear Map
That way you'd lose all your current research progress.ratchetfreak wrote:you can get the seed (IIRC) and map settings and then regenerate
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Re: Clear Map
Thanks prg I'll give this a go when I can and let you know.prg wrote:Code: Select all
local s = game.local_player.surface for chunk in s.get_chunks() do entities = s.find_entities_filtered{area={{chunk.x*32, chunk.y*32}, {chunk.x*32+32, chunk.y*32+32}}, force=game.local_player.force} for _, v in pairs(entities) do if v.type ~= "player" then v.destroy() end end end
Yes, you're quite correct I could regenerate or simply start again but I wanted to continue from where I left of with my existing research. Basically, I want to collect a bunch of the core resources up, then remove any items I've placed down so I can start fresh
Cheers
Zentih
Re: Clear Map
Hi prg,
I tested this on a backup of my save and it didn't do anything. I stood in the middle of my factory with assembly machines and belts around me (within a couple of tiles) and run the command and nothing happened. Any ideas?
Thanks
Zenith
I tested this on a backup of my save and it didn't do anything. I stood in the middle of my factory with assembly machines and belts around me (within a couple of tiles) and run the command and nothing happened. Any ideas?
Thanks
Zenith
Re: Clear Map
You need to use /c [stuff] to run commands since 0.11, did you just send it as a chat message?
Re: Clear Map
not sure, I thought I did /c because that's what I've done with other commands, but I'll admit I'm coming back to factorio after quite a break from it so probably my fault. I'll test it again now and let you know
Re: Clear Map
My apologies PRG this works perfectly and has removed all the furnaces etc.
The only issue I have now is that it's left behind things that were on the belts, they are now all just lying on the floor.
Is there a command to remove these as well (i'm going to go searching the forum at the same time as posting this, will update if I find anything)
Thanks,
zenith
The only issue I have now is that it's left behind things that were on the belts, they are now all just lying on the floor.
Is there a command to remove these as well (i'm going to go searching the forum at the same time as posting this, will update if I find anything)
Thanks,
zenith
Re: Clear Map
Code: Select all
/c local s = game.local_player.surface
for chunk in s.get_chunks() do
entities = s.find_entities_filtered{area={{chunk.x*32, chunk.y*32}, {chunk.x*32+32, chunk.y*32+32}}}
for _, v in pairs(entities) do
if v.type ~= "player" then
v.destroy()
end
end
end
Re: Clear Map
Add name="item-on-ground" to the find_entities_filtered call.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!