The problem seems to be that my mod (More Quality Scaling) replaces the rare heat-pipe
with a rare-heat-pipe
, and then the latter with a rare-rare-heatpipe
since that also exists (the replacement logic only checks if a quality-prefixed version of an entity exists, and not if a replacement for a specific position/tick was already done).
Then your mod sees that a heat pipe was placed down, and tries to prepend a further rare-
- which leads to the crash.
This could be prevented on your end by checking if the new destination entity name exists (check for prototype.entity[quality.."-"..name]
) before placing it down, but I could also a) add an additional check when your mod is detected or b) generally only replace each entity once - the latter option having the downside that this may kill compatibility with mods that do their quality prefix replacement via a name whitelist (if I replace heat-pipe
with rare-heat-pipe
, they might not replace that with the rare-rare-heatpipe
which is modified by both our mod).
Though data stage compatibility would be preferable anyway, since otherwise the number of created additional entities scales with the square of the available quality levels...
Maybe you could just check for the existence of quality-prefixed heat pipes, and prevent generating additional entities in that case (simply modifying them instead if necessary)? And in control.lua implement the prototype existence check?