Command to remove Crude Oil?
-
- Manual Inserter
- Posts: 1
- Joined: Tue Mar 15, 2016 3:59 am
- Contact:
Command to remove Crude Oil?
I spawned too much crude oil and I don't know how to remove it.I tried the Wiki and changing the entity but to no avail.
- MalcolmCooks
- Filter Inserter
- Posts: 253
- Joined: Mon Apr 06, 2015 8:32 pm
- Contact:
Re: Command to remove Crude Oil?
You should be able to use this command:
but you will have to figure out what the name for the oil patches is and insert it instead of "stone-rock". Perhaps someone else knows?
If you make the player.position numbers large enough you can delete all oil patches in a very large area. However this won't prevent the game from generating crude oil in new areas so I suggest starting the map over with different resource gen settings. If you want to keep the same map then use the map exchange string
Code: Select all
/c for _,entity in pairs(game.local_player.surface.find_entities_filtered{
area={{game.local_player.position.x-32, game.local_player.position.y-32},
{game.local_player.position.x+32, game.local_player.position.y+32}},
name="stone-rock"})
do
entity.destroy()
end
If you make the player.position numbers large enough you can delete all oil patches in a very large area. However this won't prevent the game from generating crude oil in new areas so I suggest starting the map over with different resource gen settings. If you want to keep the same map then use the map exchange string
Re: Command to remove Crude Oil?
Remove whatever you're pointing at:
Remove half of the already generated oil:
Remove half of newly generated oil:
Code: Select all
game.player.selected.destroy()
Code: Select all
for chunk in game.local_player.surface.get_chunks() do
oil_wells = game.local_player.surface.find_entities_filtered{name="crude-oil", area={{chunk.x*32, chunk.y*32}, {(chunk.x+1)*32, (chunk.y+1)*32}}}
for _, v in pairs(oil_wells) do
if math.random() > .5 then v.destroy() end
end
end
Code: Select all
script.on_event(defines.events.on_chunk_generated, function(event)
oil_wells = event.surface.find_entities_filtered{name="crude-oil", area=event.area}
for _, v in pairs(oil_wells) do
if math.random() > .5 then v.destroy() end
end
end)
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Re: Command to remove Crude Oil?
Moved to Gameplay Help.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...