Page 1 of 1
Command for removing ores?
Posted: Sun Aug 23, 2015 2:23 pm
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
Re: Command for removing ores?
Posted: Sun Aug 23, 2015 3:05 pm
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
Re: Command for removing ores?
Posted: Sun Aug 23, 2015 3:58 pm
by ratchetfreak
instead of surfaces.nauvis you can use game.player.surface instead (if you use a mod that transports you to other surfaces)
Re: Command for removing ores?
Posted: Sun Aug 23, 2015 5:32 pm
by Brathahn
thank you for the quick reply.
i also found another command in the wiki (duh!) i better look twice the next time
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