Pipe Plus

by yokmp

Adds some additional underground pipe-stuff.

Content
4 months ago
1.1 - 2.0
6.82K
Logistics Fluids

b vanilla underground pipe stopped connecting in latest update

4 months ago

vanilla underground pipe stopped connecting in latest update. Pipe to underground 2 specifically to vanilla underground carrying molten iron if you want to replicate the issue.

4 months ago

vanilla underground pipe stopped connecting in latest update. Pipe to underground 2 specifically to vanilla underground carrying molten iron if you want to replicate the issue.

https://imgur.com/a/845L4Zi

4 months ago

I've fixed it but i have no idea why it was broken since i just copied the vanilla fluid box and pasted it back in. No modification. I now switched both tables and et voila it works again?

4 months ago
(updated 4 months ago)

It looks like your fix had side-effects, the update broke compatibility with other mods (https://mods.factorio.com/mod/underground-pipe-pack). Swapping the tables under pipe_connections broke anything expecting the vanilla version of ["pipe-to-ground"]["pipe-to-ground"].

https://github.com/TheStaplergun/pipemod/blob/master/prototypes/entities/underground-pipes.lua#L14
local base_ug_distance = util.table.deepcopy(data.raw["pipe-to-ground"]["pipe-to-ground"].fluid_box.pipe_connections[2].max_underground_distance)

Failed to load mods: ...nd-pipe-pack__/prototypes/entities/underground-pipes.lua:20: attempt to perform arithmetic on upvalue 'base_ug_distance' (a nil value)
stack traceback:
...nd-pipe-pack__/prototypes/entities/underground-pipes.lua:20: in function 'build_connections_table'
...nd-pipe-pack__/prototypes/entities/underground-pipes.lua:152: in main chunk
[C]: in function 'require'
underground-pipe-pack/data.lua:9: in main chunk

4 months ago

But if i change it so that the underground connection is the 2nd table, it won't connect to vanilla underground pipes ...
I will try some ideas but at this point i think something is off with factorio itself.
Also the other mod needs to check if the table theyre adressing is an underground connection and keep loping of not (.pipe_connections[2] is a [1] here).
But i'll test if inserting the table later will change anything.

4 months ago
(updated 4 months ago)

But if i change it so that the underground connection is the 2nd table, it won't connect to vanilla underground pipes ...
I will try some ideas but at this point i think something is off with factorio itself.
Also the other mod needs to check if the table they're addressing is an underground connection and keep loping of not (.pipe_connections[2] is a [1] here).
But i'll test if inserting the table later will change anything.

If that's the case you need to check as well, you've got the exact same code on line 2. It just doesn't error through your script since you grab it before you modify pipe-to-ground to the "broken" state. If any other mod made the same modification, it would break your mod. I don't know enough about factorio scripting to give you any advice, but there's got to be another solution to this as the underground pipe connections in the linked mod are able to connect to vanilla underground pipes without modifying them at all.

4 months ago
(updated 4 months ago)

It appears to be a bug and a bug-report is send. So i guess we have to wait until it's fixed.
Soon i hope ^^

EDIT:
Yes, but i have to switch the tables otherwise they won't connect. Ill have a look into said mod but since i've tried several solutions i don't have much hope plus i just can't see why it won't connect otherwise.

4 months ago
(updated 4 months ago)

I went ahead and looked into what the mod was doing differently (the version on github is old pre-space-age so I just decompressed their current version). I found out the issue was you were just simply missing an underground_collision_mask (https://lua-api.factorio.com/latest/types/CollisionMaskConnector.html) field on your underground connections (I also removed the override for the vanilla pipe-to-ground by changing the for loop as it's unneeded to override the vanilla pipe now).

The documentation states this field is optional (https://lua-api.factorio.com/latest/types/PipeConnectionDefinition.html#underground_collision_mask), but it's needed for space-age (In order to connect, both ends must have the same collision mask specified). This would explain why your fix partially worked, this field is set when space-age loads. Switching the connections just broke space age from modifying the underground connection since it's setting the mask only for pipe_connections[2] which in turn indirectly happened to fix the issue since it forced vanilla pipes to not have any mask matching the lack of mask on your connections.

space-age/base-data-updates.lua:26:
data.raw["pipe-to-ground"]["pipe-to-ground"].fluid_box.pipe_connections[2].underground_collision_mask = underground_collision_mask

https://pastebin.com/xxCsabbf

4 months ago
(updated 4 months ago)

Hm, i've set space-age as a soft dependency and this solves the issue.

Edit:
The issue is present even if i do not touch the vanilla pipe. The rewritten pipe.lua does not alter the vanilla pipe (except from adding the connection_category, but even without this it didn't work).
I'll upload the new version as soon as im home.
Thanks for your help and time. :)

New response