Factorio 2.1 reversible pump

Place to post guides, observations, things related to modding that are not mods themselves.
i-make-robots
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Fri Jul 25, 2014 9:06 pm
Contact:

Factorio 2.1 reversible pump

Post by i-make-robots »

Hello all,

I'm trying to make a bi-directional pump. Now that devices can have a separate signal on each wire, I want one to act as before - enable/disable - and one to switch direction of flow.

My use case is in stations that load many liquids. The default pump would have a little liquid stuck inside, jamming the queue. If I can set "reverse pump when train count C==0" the pump/pipe will get flushed and problem is solved.

LuaPumpControlBehavior does not, by default, give me a way to reverse flow. One option is to spawn two pumps on top of each other, one of which is inactive at any given time. Another is to somehow track the "original" direction and then physically reverse the pump when the signal is set.

What would be best?

Thanks!
User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 318
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: Factorio 2.1 reversible pump

Post by Osmo »

Both of these options may work.
For the first option, i think you can create linked fluidboxes such that one of the pumps would be conected to the other on each side, so fluid will be able to flow into both of them, and you'd just need to set one enabled and the other disabled. But it might be possible for fluids to be stuck in one of thr pumps, not sure.
For the second option, you might also get an issue where you change the direction of the pump, and the fluids swap sides. Not sure if that's what would happen.
If the first option doesn't have any issues with leftover fluids, that would probably be the preffered option since you could do it without on_tick scripts (have both pumps have opposite circuit conditions).
But if it does have some issues, in both cases you should be able to remmeber the fluids beforehand and set them later by script to circumvent that. So choose whichever one is easier to implement.
i-make-robots
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Fri Jul 25, 2014 9:06 pm
Contact:

Re: Factorio 2.1 reversible pump

Post by i-make-robots »

Cool. How do i add a UI under Enable for the Pump Reverse?
Post Reply

Return to “Modding discussion”