ssilk wrote: Tue Apr 21, 2020 5:06 pm
In my opinion this is some kind of work, that should be done when uploading the mod to the mod-server.
Sorry, but that's not practical, it has to be done on starting Factorio, based on the combination of mods that are used (if mods are used at all -- vanilla should be fine as it is).
For example, my
Inlaid UV-Lamp mod uses inlaid lamps (provided by any of 3 mods currently) to replace the UV lamps yet another mod provides (based on the default lamp if my mod isn't active) with an inlaid UV lamp that vehicles can drive over without damaging it. Now, one of the inlaid lamp mods just
replaces the default lamp, so once you've researched optics, all lamps will automatically be inlaid lamps. The other mods
add inlaid lamps, so once you've researched optics and unlocked the vanilla lamp, you have to research a new technology to unlock inlaid lamps, and their recipe requires a default lamp to make an inlaid lamp. Now, the mod that gives you the UV lamps needs just a vanilla lamp if it's used alone, so it has optics as prerequisite. If my mod is active, it changes the recipe for the UV lamp to require an inlaid lamp. No problem if the first inlaid lamp mod is required -- optics still is necessary as prerequisite in this case. If one of the other mods is used, however, the UV lamp mod requires an inlaid lamp which, in turn, requires optics as prerequisite. So, it now would require optics and inlaid lamps -- but as inlaid lamps already require optics, the UV lamp mod's dependency on optics has become redundant.
In this case, I've cleaned up and taken care that the UV lamps mod won't depend on optics if it's already required by one of the inlaid lamp mods. But my mod is small, providing just one new entity. Now imagine a big mod creating heaps of new items and technologies. Imagine further that it could be used alongside any number of different mods that may or may not modify any of the recipes, technologies etc. of the big mod. It's impossible to think of how adding or removing a random mod may impact the big mod -- so, depending on what mods are active, the technology tree may be quite different each time you start the game.
ssilk wrote: Tue Apr 21, 2020 5:06 pm
Only in a centralised surrounding this can be checked.
I agree with that: pruning the technology tree must happen in a central place because each mod doing it's own thing is not error proof. But this central place can't be the mod portal -- it must be the game. So each time Factorio is started, the complete tech tree must be checked for redundancies after all mods are done with changing data.raw (which already happens), and this also is the time when the redundant prerequisites should be removed from the technology tree (which I wish to happen).