If you would like to destroy all ore-type patches and crude oil in an area around your character, use this command line:
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}}, type="resource"}) do entity.destroy() end
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
And if you want to delete trees, use this line:
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}}, type="tree"}) do entity.destroy() end
If you want to delete all the resources in the entire discovered map, use this command line:
Code: Select all
/c local surface = game.player.surface for c in surface.get_chunks() do for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, type= "resource"})) do entity.destroy() end end
Code: Select all
/c local surface = game.player.surface for c in surface.get_chunks() do for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, type= "tree"})) do entity.destroy() end end
Code: Select all
/c local surface = game.player.surface for c in surface.get_chunks() do for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, name= "stone-rock"})) do entity.destroy() end end
These commands only work in single player. Multiplayer will require a slight tweak where instead of game.player it's game.players[1] if you're player 1, game.players[2] if you're player 2, and so on.