Page 1 of 1

Pipe categories for allowed neighbor-pipes

Posted: Wed Nov 01, 2023 6:29 am
by Honktown
(did a brief search and couldn't find a similar topic)

The idea: certain pipe connections can only connect to other pipes.

The goal: allowing pipe restrictions for a fluid. This idea would also allow a mod to pipe-weave if multiple / compatible categorization were implemented.

An example implementation:
1) a new prototype of "pipe-category", the initial category being "default"
2) a fluidbox could have a new value for a pipe_category, or preferably, a table of pipe_categories, with the default being {"default"}

Game behavior:
A fluidbox connection only is established when a category of fluidbox A matches a category of fluidbox B. *on placement* is essential here, as this has no continuous runtime overhead, compared to how fluid filters would be tested every tick.

How fluid restriction benefits:
A fluidbox *of an entity* can be marked for only compatibility with category "super-dangerous-nuclear-fluid". Now, the fluid is generated in the fluidbox, and so must only flow in adjacent pipes which were tested on placement to be compatible. If no other plumbing shares "super-dangerous-nuclear-fluid", the super-dangerous-nuclear-pipes carry the fluid (and *only* from fluidboxes that make or consume that fluid). This allows an efficient means of filtering, both by permission and restriction, of fluids carried in this pipe system.

How pipe weaving could work, with compatibility for normal pipes:
1) Pipe A and pipe B carry different fluids, and are of default category.
2) An "adapter" pipe entity has categories default and "cat1", and another has default and "cat2"
3) A pipe which *only* has cat1 can now connect to the "adapter" pipe, and further connections, whether underground or above-ground, must have at least cat1. This is similar for a pipe of cat2. cat1 and cat2 underground pipes now can be lined up together, and an adapter back to a "default", or fluidbox compatible with "cat1", can receive the fluid.

Considerations:
I only just thought about how underground pipes get drawn, and if done for consistency, plumbing would need to check for compatible categories and pass-over eligible nearest-connections and keep going backwards. This doesn't feel too restrictive, but if not considered, rendering would show pipes being compatible when they were not...

Re: Pipe categories for allowed neighbor-pipes

Posted: Wed Nov 01, 2023 6:32 am
by Honktown
pipe could be replaced with "fluidbox" in some of the early "pipe"s. I was thinking on the pipe connection definition level, but then realized it would be easier on the fluidbox concept level. It could be implemented, pipe connection wise.