Console command to delete trees within a specific radius?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
MegaHamster7
Inserter
Inserter
Posts: 22
Joined: Tue Oct 06, 2015 2:05 pm
Contact:

Console command to delete trees within a specific radius?

Post by MegaHamster7 »

Hi,

Trees are the worst enemy in this game.....

Is there a console command to delete trees within a specific radius? Or a mod? Or some really easy way that doesn't involve robots/capsules/any effort on my part?
orzelek
Smart Inserter
Smart Inserter
Posts: 3924
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Console command to delete trees within a specific radius?

Post by orzelek »

There is a mod called explosive termites.
You can grab it here:
viewtopic.php?f=91&t=4757#p36148
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Console command to delete trees within a specific radius?

Post by daniel34 »

I think Koub answered you here: viewtopic.php?f=25&t=23724#p148981 :lol:
Koub wrote:

Code: Select all

/c for _,entity in pairs(game.local_player.surface.find_entities_filtered{area={{game.local_player.position.x-100, game.local_player.position.y-100}, {game.local_player.position.x+100, game.local_player.position.y+100}}, name="Tree 7"}) do entity.destroy() end
Replace "Tree 7" by the name of the tree kind you want to delete (hover mouse over it, it appears in the right of the screen)
Do this for any kind of tree you have around.
Clears a square of 200x200 tiles centered on you.
I suggest instead of name="Tree 7" use type="tree", that will get all the trees and not just specific ones.
quick links: log file | graphical issues | wiki
Koub
Global Moderator
Global Moderator
Posts: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Console command to delete trees within a specific radius?

Post by Koub »

This is the topic I wanted to post this :

Code: Select all

/c for _,entity in pairs(game.local_player.surface.find_entities_filtered{area={{game.local_player.position.x-100, game.local_player.position.y-100}, {game.local_player.position.x+100, game.local_player.position.y+100}}, name="Tree 7"}) do entity.destroy() end
Replace "Tree 7" by the name of the tree kind you want to delete (hover mouse over it, it appears in the right of the screen)
Do this for any kind of tree you have around.
Clears a square of 200x200 tiles centered on you.

:lol:
But well ...
Koub - Please consider English is not my native language.
MegaHamster7
Inserter
Inserter
Posts: 22
Joined: Tue Oct 06, 2015 2:05 pm
Contact:

Re: Console command to delete trees within a specific radius?

Post by MegaHamster7 »

Amazing thank you! Just what I was looking for.

@orzelek Thanks for the mod link. I had come across that one and considered it but it just doesn't sit well with me on the lore front. I know I'm a hypocrite as I'm cheating but if you're going to cheat, may as well do it properly! After a couple of hundred hours on a map I don't want clearing goddamn trees to be the thing that stops me playing. =)
mrkoss
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Jul 07, 2016 4:10 pm
Contact:

Re: Console command to delete trees within a specific radius?

Post by mrkoss »

Sorry for bad english :D
So, there is no working console command to delete ALL trees in Factorio 0.13.xx on internet that i could find. After some searching and testing subject, finally i found it :D

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
This command delete all types of trees (not only one or two) in all of discovered area.
Sacredd
Long Handed Inserter
Long Handed Inserter
Posts: 93
Joined: Fri Mar 18, 2016 9:30 am
Contact:

Re: Console command to delete trees within a specific radius?

Post by Sacredd »

mrkoss wrote:Sorry for bad english :D
So, there is no working console command to delete ALL trees in Factorio 0.13.xx on internet that i could find. After some searching and testing subject, finally i found it :D

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
This command delete all types of trees (not only one or two) in all of discovered area.
Works fine. Thank you.
Acarin
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Thu Sep 01, 2016 3:58 pm
Contact:

Re: Console command to delete trees within a specific radius?

Post by Acarin »

Cluster grenades are your friend (but not once the pin is pulled). Invented by Star$s to make instant coffee stirrers out of 3.14159 hectares of forest...

THe FARL mod is also your friend! Drive through a forest and turn it into lovely fuel so that your train can... drive through more forest!
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: Console command to delete trees within a specific radius?

Post by Jackalope_Gaming »

If you want to only delete trees in a given area from your character, use

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
That will clear a 64x64 area centered on you. You can make the area smaller by decreasing the 32's to a lower number, or increase to a higher number.
Post Reply

Return to “Gameplay Help”