Hi, LithiumBattery 8.2.3 crashes on load on Factorio 2.1.25 when underground-heat-pipe (2.2.2) is installed and the "Underground ammonia" startup setting (ao-underground) is on:
LithiumBattery/prototypes/compat-data-final-fixes.lua:26: attempt to index field '?' (a nil value)
The loop over data.raw["pipe-to-ground"] assumes the underground connection is always pipe_connections[2]. underground-heat-pipe defines four pipe-to-ground entities (underground-heat-pipe, fast-, express-, turbo-underground-heat-pipe) that have only one connection, the underground one, so [2] is nil.
Looking for the connection by connection_type fixes it. I tested this with a full data load and it works:
for , prototype_name in pairs(data.raw["pipe-to-ground"]) do
for , connection in pairs(prototype_name.fluid_box.pipe_connections) do
if connection.connection_type == "underground" then
if not connection.underground_collision_mask then
connection.underground_collision_mask = {layers = {}}
end
connection.underground_collision_mask.layers["ao-ammonia"] = true
end
end
end
This also covers any other modded pipe-to-ground whose underground connection isn't in slot 2. Until it's fixed upstream, turning off the "Underground ammonia" startup setting avoids the crash. Thanks for the mod!