Page 1 of 1

Removing power pole collision doesn't change biter pathing?

Posted: Fri Aug 03, 2018 3:34 pm
by slims
I'm trying to write a mod to prevent biters from attacking big power poles, specifically so that they stop killing random big poles that go to my mining outposts. The only reason they appear to kill the poles is they get stuck on them walking to my main base, and as you probably know, they attack when they get stuck.

So I created a simple mod to remove the collision box from the power poles, however, in my testing, they still seem to run into the poles and attack them same as before, despite the fact that I can run and drive through the poles myself with no problem. I'm assuming it's because the pathing algorithm doesn't actually care about collision and is just looking for placed items? Any insight on this?

The lua code for my mod is just:

Code: Select all

for _, pole in pairs(data.raw["electric-pole"]) do
   pole.collision_box = {{0,0}, {0,0}}
end

Re: Removing power pole collision doesn't change biter pathing?

Posted: Fri Aug 03, 2018 4:39 pm
by DaveMcW
A collision box with dimension zero is still a collision point. The player is flexible enough to bounce off small collision areas, but the biters are not.

You want to remove biters from the collision mask:

Code: Select all

pole.collision_mask = {"water-tile"}

Re: Removing power pole collision doesn't change biter pathing?

Posted: Sat Aug 04, 2018 11:57 pm
by TheBrain0110
Alternatively, you can just flag power poles as indestructible, and then the biters will ignore them as well. One of the mods I use (I think Rampant?) has an option for this, and it works quite well, and the biters seem to pathfind around them as an obstacle.