Color Coded Pipes


Visualize and plan your fluid network with color-coded pipes! Build with red, orange, yellow, green, blue, purple, pink, black, white and special optional colors for each fluid. Includes pipes, pipe-to-grounds, pumps, and storage tanks.

Tweaks
2 days ago
1.1 - 2.0
16.7K
Logistics Fluids

b ✅ crash at runtime with automatic-underground-pipe-connectors

6 days ago
(updated 6 days ago)

First of all, I don't think this should be fixed in your mod, although you could probably be "friendly" and guard against such a case - if all your other mod's logic works then, which I don't know.

see here (wall of text) https://mods.factorio.com/mod/planet-rabbasca/discussion/6924c9c3ff0a9d632ec4df9c

I believe they introduce a fluid after color-coded-pipes has looped over all fliuds and added colored prototypes. Thus, wenn you call automatic-underground-pipe-connectors, you (and automatic-underground-pipe-connectors) assume that the prototypes exist, which for the fluid introduced later, is not true.

tl;dr: "Now I think automatic-underground-pipe-connectors and color-coded-pipes could guard against nonexisting prototypes. But I think their logic is sound, there's no reason why for certain fluids there shouldn't exist their color coded counterparts."

before adding the underground here https://github.com/jingleheimer-schmidt/color-coded-pipes/blob/2d474730780567bdfdc9a2e247c4e5c86ab6013a/control.lua#L192, you could check whether the prototype specified by pipe-name actually exists. But again, I think it wouldn't be logical and I don't know what it means for your mod if some fluids have no color coded pipes...

This is the error I tried to analyze a bit over at planet-rabbasca in the linked thread:


Error while running event color-coded-pipes::on_configuration_changed
Error when running interface function automatic-underground-pipe-connectors.add_undergrounds: automatic-underground-pipe-connectors/control.lua:315: attempt to index local 'pipe_prototype' (a nil value)
stack traceback:
automatic-underground-pipe-connectors/control.lua:315: in function 'validate_lookup'
automatic-underground-pipe-connectors/control.lua:349: in function <automatic-underground-pipe-connectors/control.lua:347>
stack traceback:
[C]: in function 'call'
color-coded-pipes/control.lua:198: in function 'add_automatic_underground_pipe_connector_support'
color-coded-pipes/control.lua:218: in function <color-coded-pipes/control.lua:215>


5 days ago

Thank you for the report! You are totally correct - Rabbasca mod is adding a fluid after this mod has created all the color pipe prototypes. So I'm missing it in data-stage, and capturing but not guarding against in control stage.
I've just pushed an update to add a dependency on Rabbasca mod to capture that fluid and create pipes for it. And I've also added some extra validation checks to gracefully handle the case where a mod adds fluids after this one has run. Now instead of passing invalid prototypes over to automatic-underground-pipe-connectors, I just print a message in chat saying there are some missing prototypes and asking the player to make a post on the discussion board to let me know.

5 days ago

great, that seems to work! thanks a lot for looking into this!

New response