Pipe Plus

by yokmp

Adds some additional underground pipe-stuff.

Content
3 months ago
1.1 - 2.0
8.58K
Logistics Fluids

i Double sided underground

10 months ago
(updated 10 months ago)

Hey,

here is a wishlist of me:
- Double Pipe to ground: Has a pipe to ground on each side
- Double Pipe to ground 2: Has a pipe to ground on each side + on the sides normal pipe
- Double Corner Pipe to ground: Has a double pipe to ground on a corner
- Double Corner pipe to ground 2: Same as above, only if two pipe connections also

10 months ago

Code wise its just a few lines, mostly copy and paste. The images on the other hand ...
They either look weird or you just can't see in which orientation its placed. Remember that i have to squish3 underground pipes in a tiny sqare where normally sits just one.
This is the main reason i haven't done it ;)
Maybe i get struck with inspiration somewhere in the future ...

7 months ago

I decided I really wanted at least a straight-through one, the "Double Pipe to Group 2" in the OP, and hacked together some images for it by overlaying and cropping your existing 3-way pipe. They seem to look good in-game, the work just fine, and they're not really difficult to understand how they connect, especially with the pipe overlay that pops up. Feel free to include them if you like.

https://imgur.com/a/Rh8tvGC

Relevant code changes I made locally:

To pipe_connections:

  {
    { direction = defines.direction.east, position = {0, 0} },
    { connection_type = "underground", direction = defines.direction.south, position = {0, 0}, max_underground_distance = dist, connection_category = get_categories()},
    { direction = defines.direction.west, position = {0, 0} },
    { connection_type = "underground", direction = defines.direction.north, position = {0, 0}, max_underground_distance = dist, connection_category = get_categories()},
  },

Altered visualization block inside the entity loop (which is now obviously for i =2, 4 instead of 2, 3):

  local _vi = 0
  for _, dir in pairs({"north","east","south","west"}) do
    entity.pictures[dir].filename = "__pipe_plus__/graphics/pipe/"..dir.."-"..i..".png"
    if i < 4 then
      entity.visualization[dir] = {
        filename = "__pipe_plus__/graphics/pipe/visualization.png",
        priority = "extra-high",
        x = 64 * _vi + 256 * (i-2),
        size = 64,
        scale = 0.5,
        flags = {"icon"}
      }
          entity.disabled_visualization[dir] = {
        filename = "__pipe_plus__/graphics/pipe/disabled-visualization.png",
        priority = "extra-high",
        x = 64 * _vi + 256 * (i-2),
        size = 64,
        scale = 0.5,
        flags = {"icon"}
      }
      _vi = _vi+1
    else
      entity.visualization[dir] = {
        filename = "__pipe_plus__/graphics/pipe/visualization2.png",
        priority = "extra-high",
        x = 0,
        size = 64,
        scale = 0.5,
        flags = {"icon"}
      }
          entity.disabled_visualization[dir] = {
        filename = "__pipe_plus__/graphics/pipe/disabled-visualization2.png",
        priority = "extra-high",
        x = 0,
        size = 64,
        scale = 0.5,
        flags = {"icon"}
      }
    end
  end
6 months ago
(updated 6 months ago)

Kaedys, hi!
Maybe I inserted the code incorrectly, but I have a placeholder displayed on one side. It shouldn't be there, should it?

6 months ago

Got it, I inserted it in the wrong order :)
Thanks for the addition to the code, this is a really useful pipe :)

6 months ago
(updated 6 months ago)

You betcha! Ya, I've found it incredibly handy, since it can be placed down in the middle of an existing underground pipe line to essentially "tap" off of it without any interruption in flow, and it's certainly more space-efficient than the vanilla underground-pipe-underground for doing the same thing. I love the pipes in this mod, so handy for compact builds.

Edit: and ya, for anyone else that does a local adjustment to include the above, unless and until the mod author bakes it in, the addition to the pipe_connections table needs to be at the end of that table, after the two current entries in it.

6 months ago
(updated 6 months ago)

Friend, can you help me finish the code to get such a pipe?
I can't overcome this, I always have only one underground connection :(

If you need pictures, they are here: https://drive.google.com/file/d/1kT7Bu4rmPlo8OGqcX1Dih58kpbBm-y5-/view?usp=sharing

6 months ago
(updated 6 months ago)

So, that's defined by the table in pipe_connections in pipe.lua. Each entry in that table is a pipe connection, with a normal entry that just has direction and position being an above-ground connection, and one that's underground needing connection_type, max_underground_distance, and connection_category as well. For example, the first pipe in that group has the following connections defined:

    { direction = defines.direction.east, position = {0, 0} },
    { connection_type = "underground", direction = defines.direction.south, position = {0, 0}, max_underground_distance = dist, connection_category = get_categories()},
    { direction = defines.direction.west, position = {0, 0} },

The first and third connections, for the west and east directions, are above-ground. The second one, for the south direction, is underground. For your pipe, you'd need to define a second underground entry in that table, and make sure it has a different direction face than the other 3 entries. So you could use, for example, north and west as above-ground and south and east as underground, which would look something like:

    { direction = defines.direction.north, position = {0, 0} },
    { direction = defines.direction.west, position = {0, 0} },
    { connection_type = "underground", direction = defines.direction.south, position = {0, 0}, max_underground_distance = dist, connection_category = get_categories()},
    { connection_type = "underground", direction = defines.direction.east, position = {0, 0}, max_underground_distance = dist, connection_category = get_categories()},

Note that you need to make sure you line up those up to the way the pipe appears in the north PNG you create. So if your north png looks like the pipe in the above picture, then the above definitions would be accurate for it, since the above-ground connections are to the north and west for that facing.

6 months ago

HAhahaha, I don't understand how it works, because I tried to do it in different variations, but I didn't succeed, but as soon as I inserted your code, everything worked for me :))))))
Thank you very much for your help! You are the best!

6 months ago

I also thought that if the author at some point updates his mod and adds this (or both) new pipes, and somehow changes his code so that the names become different, or something else changes, then all the pipes that were made before the update will simply be deleted, and you will have to either run around the entire base and look for places where you need to put the pipes. Well, I hope that the author will read this thread, and will not change anything radically :)

6 months ago

'tis one of the risks of locally modifying mods, but you can always defer updating the mod until that playthrough is done

New response