Page 1 of 1

Auto target trees as hostiles

Posted: Wed Apr 10, 2019 8:21 pm
by Krimsonkiler
I know we all dislike trees and wish our automated defenses shared our disdain for these arboreal abominations.

What I have in mind is making trees targetable entities for things like turrets and personal defenses.

I have tried in the past but didn't know enough about lua or factorio modding to get it done myself at the time.

Not sure if this is even feasible, but really hope it is...

Re: Auto target trees as hostiles

Posted: Thu Apr 11, 2019 11:12 am
by Qon
I was Qonsidering making a mod that lets artillery auto target trees as well if loaded with poison capsules. That way you also don't destroy your own base if any trees are trying to get their grubby roots on your precious metallic factory. But I haven't really prioritised it.

Re: Auto target trees as hostiles

Posted: Thu Apr 11, 2019 1:36 pm
by mrvn
My first idea would be to mark tress as enemy forces. But could you still chop them down for wood then?

Re: Auto target trees as hostiles

Posted: Thu Apr 11, 2019 1:43 pm
by Krimsonkiler
I had that idea as well but didn't know how to do that

Re: Auto target trees as hostiles

Posted: Thu Apr 11, 2019 2:15 pm
by Krimsonkiler
mrvn wrote: Thu Apr 11, 2019 1:36 pm My first idea would be to mark tress as enemy forces. But could you still chop them down for wood then?
How is that done? Is it some kind of inheritance? I am familiar with coding, just not Lua.

Re: Auto target trees as hostiles

Posted: Thu Apr 11, 2019 3:14 pm
by mrvn
Krimsonkiler wrote: Thu Apr 11, 2019 2:15 pm
mrvn wrote: Thu Apr 11, 2019 1:36 pm My first idea would be to mark tress as enemy forces. But could you still chop them down for wood then?
How is that done? Is it some kind of inheritance? I am familiar with coding, just not Lua.
Iirc the prototype has a setting for how entitites are placed. Some are neutral, some not. Compare the prototypes for trees, chests and worms.

Re: Auto target trees as hostiles

Posted: Thu Apr 11, 2019 3:37 pm
by Krimsonkiler
mrvn wrote: Thu Apr 11, 2019 3:14 pm
Krimsonkiler wrote: Thu Apr 11, 2019 2:15 pm
mrvn wrote: Thu Apr 11, 2019 1:36 pm My first idea would be to mark tress as enemy forces. But could you still chop them down for wood then?
How is that done? Is it some kind of inheritance? I am familiar with coding, just not Lua.
Iirc the prototype has a setting for how entitites are placed. Some are neutral, some not. Compare the prototypes for trees, chests and worms.
Ooooooh, I was not aware of that part, I was fiddling with the tree prototype directly, didnt know there were placement settings...

Re: Auto target trees as hostiles

Posted: Thu Apr 11, 2019 6:12 pm
by Krimsonkiler
So I think "all" I would have to do is make Trees inherit from Prototype/SimpleEntityWithForce instead of Prototype/EntityWithHealth. Then they can be added to "Enemy" force, I don't think that will have any other effect. Now I just have to figure out HOW to do that...

(Biters MAY not attack them if they get stuck anymore, but am not sure.)

Re: Auto target trees as hostiles

Posted: Sun Apr 28, 2019 7:51 pm
by Qon
Here is a BP for automated deforestation! A constant combinator (in the bp: value 1000) sends the distance to scan for trees. The scanner scans one tile randomly within this distance so set it to whetever you want but extremely high values means close by trees will take a while to find. Only scans a single tile/tick so isn't very CPU intensive.


Mod list: