pyanodon / pybugreports

Central bug-report repository for pymods
The Unlicense
6 stars 1 forks source link

Postprocess Dependency Loop Failure - Lighted Electric Poles+ #18

Closed davqvist closed 2 years ago

davqvist commented 2 years ago

Mod source

PyAE Beta

Which mod are you having an issue with?

Operating system

=Windows 10

What kind of issue is this?

What is the problem?

Crash on startup with https://mods.factorio.com/mod/LightedPolesPlus

Unable to identify dependency loop

stack traceback:
    [C]: in function 'error'
    __pypostprocessing__/prototypes/functions/auto_tech.lua:1733: in function 'find_dependency_loop'
    __pypostprocessing__/prototypes/functions/auto_tech.lua:1667: in function 'topological_sort'
    __pypostprocessing__/prototypes/functions/auto_tech.lua:2216: in function 'calculate_prerequisites'
    __pypostprocessing__/prototypes/functions/auto_tech.lua:2511: in main chunk
    [C]: in function 'require'
    __pypostprocessing__/data-final-fixes.lua:124: in main chunk

Steps to reproduce

Install Py Beta Preview Suite Install Lighted Electric Poles + Start the game

Additional context

No response

Log file

No response

ShadowGlass0 commented 2 years ago

@davqvist I have fixed some of the problems, but this part is on the LightedPoles+ mod author:

   5.246 Script @__LightedPolesPlus__/data-updates.lua:208: [LEP+] no technology unlock found for nexelit-substation, inserting lighted-nexelit-substation into technology optics
   5.246 Script @__LightedPolesPlus__/data-updates.lua:208: [LEP+] no technology unlock found for nexelit-power-pole, inserting lighted-nexelit-power-pole into technology optics

Those unlocks definitely exist, so they should look into that. Also I don't think that dumping recipes into optics is a good backup solution. Just don't create the lighted version, if you can't find the unlock.

0ptera commented 2 years ago

@davqvist I have fixed some of the problems, but this part is on the LightedPoles+ mod author:

   5.246 Script @__LightedPolesPlus__/data-updates.lua:208: [LEP+] no technology unlock found for nexelit-substation, inserting lighted-nexelit-substation into technology optics
   5.246 Script @__LightedPolesPlus__/data-updates.lua:208: [LEP+] no technology unlock found for nexelit-power-pole, inserting lighted-nexelit-power-pole into technology optics

Those unlocks definitely exist, so they should look into that. Also I don't think that dumping recipes into optics is a good backup solution. Just don't create the lighted version, if you can't find the unlock.

My script runs during date-update, it generally finds techs by unlocked buildable entity reliably. Tell me if I'm wrong but skimming through the code of pypostprocessing, it looks like you create techs in data-final-fixes. I consider that bad practice as it opens up race conditions where each mod tries to be loaded last.

If the techs exist in data-update stage tell me the corresponding mod name so I can add it as optional dependency.

PS: Putting poles into optics places lighted wooden pole correctly in the tech required to craft the lighted pole.

ShadowGlass0 commented 2 years ago

@Yousei9 The recipes/unlocks are added in the data phase, so an optional dependency won't help (tried it). Found the problem: In line 160 of data-updates you check recipe.result, but not recipe.results, so you don't find the recipes.

0ptera commented 2 years ago

@ShadowGlass0 Thanks, that would be the problem. Having poles defined as recipe.results is a quirk of data stage I should support.