Page 1 of 1

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

Posted: Sat Nov 17, 2018 2:28 pm
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

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

Posted: Wed Nov 21, 2018 8:16 pm
by Bilka
Okay, I added LuaEntity::pump_rail_target (returns the rail) for 0.17.

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

Posted: Wed Nov 21, 2018 9:57 pm
by Staplergun
Nice! This is great

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

Posted: Wed Nov 21, 2018 10:09 pm
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.