Removing power pole collision doesn't change biter pathing?

Place to get help with not working mods / modding interface.
slims
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Aug 03, 2018 3:30 pm
Contact:

Removing power pole collision doesn't change biter pathing?

Post 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
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3716
Joined: Tue May 13, 2014 11:06 am
Contact:

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

Post 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"}
TheBrain0110
Inserter
Inserter
Posts: 37
Joined: Fri Dec 22, 2017 4:43 am
Contact:

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

Post 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.
Post Reply

Return to “Modding help”