A way to see if a pump is connected to a rail

Post Reply
Staplergun
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Sun Mar 25, 2018 5:34 am
Contact:

A way to see if a pump is connected to a rail

Post by Staplergun »

I'd just like a way to return if a pump is connected to a rail. Preferably it would return the rail it's connected to.

Use case: I count neighbours on fluidboxes for pumps and pipes. I have it so if the fluidboxes don't have at least two neighbours, it's considered an orphan. Problem being that the fluid box and rail are not neighbours so it thinks it's an orphan. I could do a bunch of directional position checking, but a way to just pull the rail as a method would be far more efficient.

Image

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: A way to see if a pump is connected to a rail

Post by Bilka »

Okay, I added LuaEntity::pump_rail_target (returns the rail) for 0.17.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Staplergun
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Sun Mar 25, 2018 5:34 am
Contact:

Re: A way to see if a pump is connected to a rail

Post by Staplergun »

Nice! This is great

Staplergun
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Sun Mar 25, 2018 5:34 am
Contact:

Re: A way to see if a pump is connected to a rail

Post by Staplergun »

Image
This is what I've got right now. Just does a positional check. Being able to check this property you added will make it more accurate.

Post Reply

Return to “Implemented mod requests”