[2.0.23] Underground pipe connections fail when underground_collision_mask differs in fluid_box.pipe_connections

Bugs that are actually features.
User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 376
Joined: Tue Jul 08, 2014 10:06 am
Contact:

[2.0.23] Underground pipe connections fail when underground_collision_mask differs in fluid_box.pipe_connections

Post by LuziferSenpai »

Description:

While experimenting with underground pipe connections, I found that pipes to ground require both the same connection_type and matching underground_collision_mask values in fluid_box.pipe_connections to connect. If the underground_collision_mask layers differ, the connection fails, even when the collision masks do not collide.

This behavior is undocumented and causes unexpected connection issues when customizing pipes to ground.
Steps to Reproduce:
  1. Create a custom pipe to ground with the following fluid_box.pipe_connections configuration:

    Code: Select all

    {
        { direction = defines.direction.north, position = { 0, 0 } },
        {
            connection_type = "underground",
            direction = defines.direction.south,
            position = { 0, 0 },
            max_underground_distance = 10,
            connection_category = { "default" },
            underground_collision_mask = { layers = { empty_space = true, lava_tile = true, water_tile = true } }
        }
    }
    
  2. Attempt to connect the custom pipe to ground to a base game pipe to ground.
  3. Observe that the connection fails.
  4. Modify the custom pipe by removing the water_tile layer from the underground_collision_mask in fluid_box.pipe_connections.
  5. Attempt the connection again and observe that it now works, even with the base game pipe to ground.

Expected Behavior:

Pipes to ground with compatible pipe_connections should connect regardless of differing underground_collision_mask values, as long as there is no collision.
Actual Behavior:

Pipes to ground fail to connect if the underground_collision_mask layers in fluid_box.pipe_connections differ, even when the connection_type matches and the collision masks do not collide.
Test Mod:

Attached is a test mod that demonstrates this issue. The custom pipe to ground includes a water_tile layer in the underground_collision_mask of fluid_box.pipe_connections, which prevents it from connecting to the base game pipe to ground. When the water_tile layer is removed, the connection works as expected.

Greetz,

Luzifer
Attachments
more-pipe-to-ground_0.0.1.zip
(1.66 KiB) Downloaded 4 times
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3092
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.23] Underground pipe connections fail when underground_collision_mask differs in fluid_box.pipe_connections

Post by boskid »

Not a bug.

I made them incompatible because of a huge class of corner cases i did not care to handle related to symmetry of the searches: when underground connection without collision searches other end it can skip tile checks and will find other end but if underground connection that collides would search for other end it will abort search at colliding tiles. If handled incorrectly tgat would show as weird class of bugs where undergrounds would only connect when built in a specific order where not colliding underground is built last. If not, the non colliding end upon finding another end woild have to revisit all tiles in between to check if they collide but that would still leave other corner cases present that are really annoying. Imagine this: non colliding underground facing east, lava tile, colliding undergroubd facing east, colliding underground facing west, lava tile, non colliding underground facing west: should the outies connect to each other since they cannot connect to the inner ones as they are already connected to each other and are closer? Or should they be blocked?
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3092
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.23] Underground pipe connections fail when underground_collision_mask differs in fluid_box.pipe_connections

Post by boskid »

For 2.0.24 i changed the connection logic slightly to make underground fluid box connections with incompatible underground_collision_mask possible, such connection will fail when tile between collides with any of the two masks on connection ends.
Post Reply

Return to “Not a bug”