Command for removing ores?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
User avatar
Brathahn
Fast Inserter
Fast Inserter
Posts: 132
Joined: Sat Aug 02, 2014 1:50 pm
Contact:

Command for removing ores?

Post by Brathahn »

Hello,

is there a console command that finds any ores in a specific area and removes them?
i just found a command in the wiki that creates ores.


i thought of something like this:

Code: Select all

select all entitys around 20 tiles of player position
if selected entity = iron-ore or copper-ore or coal-ore
then
remove entity
GopherAtl
Fast Inserter
Fast Inserter
Posts: 177
Joined: Sat Jan 31, 2015 7:54 pm
Contact:

Re: Command for removing ores?

Post by GopherAtl »

Code: Select all

local pos=game.local_player.position for k,v in pairs(game.surfaces.nauvis.find_entities_filtered{area={{pos.x-10,pos.y-10},{pos.x+10,pos.y+10}}, type="resource"}) do if v.name:match("%-ore$") then v.destroy() end end
My Mods:
Nixie Tubes - numeric displays for your circuit networks!
Logistic Combinators - use logistics values in circuit logic! -
Autowire - automate red/green wire connections
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Command for removing ores?

Post by ratchetfreak »

instead of surfaces.nauvis you can use game.player.surface instead (if you use a mod that transports you to other surfaces)
User avatar
Brathahn
Fast Inserter
Fast Inserter
Posts: 132
Joined: Sat Aug 02, 2014 1:50 pm
Contact:

Re: Command for removing ores?

Post by Brathahn »

thank you for the quick reply.

i also found another command in the wiki (duh!) i better look twice the next time :roll:
just replace stone-rock with iron ore or other entities

Code: Select all

/c for _, entity in ipairs(game.player.surface.find_entities_filtered{
        area={{game.player.position.x-32, game.player.position.y-32},
            {game.player.position.x+32, game.player.position.y+32}},
            name="stone-rock"})
do
    entity.destroy()
end
Post Reply

Return to “Gameplay Help”