Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add research-progress item type support #377

Merged
merged 2 commits into from
Dec 28, 2024
Merged

Conversation

zzh8829
Copy link

@zzh8829 zzh8829 commented Dec 27, 2024

https://mods.factorio.com/mod/Cerys-Moon-of-Fulgora
the new research-progress type breaks recipe analysis
https://github.com/danielmartin0/Cerys-Moon-of-Fulgora/blob/main/prototypes/recipe/repair.lua#L106

Could not load one of the products for Recipe.cerys-discover-fulgoran-cryogenics, possibly named ''.
   at Yafc.Parser.FactorioDataDeserializer.<>c__DisplayClass87_0.<LoadProduct>b__0(LuaTable table) in ./Yafc.Parser/Data/FactorioDataDeserializer_RecipeAndTechnology.cs:line 227
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
   at Yafc.Parser.FactorioDataDeserializer.LoadProductList(LuaTable table, String typeDotName, Boolean allowSimpleSyntax) in ./Yafc.Parser/Data/FactorioDataDeserializer_RecipeAndTechnology.cs:line 243
   at Yafc.Parser.FactorioDataDeserializer.LoadRecipeData(Recipe recipe, LuaTable table, ErrorCollector errorCollector) in ./Yafc.Parser/Data/FactorioDataDeserializer_RecipeAndTechnology.cs:line 365
   at Yafc.Parser.FactorioDataDeserializer.DeserializeRecipe(LuaTable table, ErrorCollector errorCollector) in ./Yafc.Parser/Data/FactorioDataDeserializer_RecipeAndTechnology.cs:line 10
   at Yafc.Parser.FactorioDataDeserializer.DeserializePrototypes(LuaTable data, String type, Action`2 deserializer, IProgress`1 progress, ErrorCollector errorCollector) in ./Yafc.Parser/Data/FactorioDataDeserializer.cs:line 325
   at Yafc.Parser.FactorioDataDeserializer.LoadData(String projectPath, LuaTable data, LuaTable prototypes, Boolean netProduction, IProgress`1 progress, ErrorCollector errorCollector, Boolean renderIcons) in ./Yafc.Parser/Data/FactorioDataDeserializer.cs:line 134
   at Yafc.Parser.FactorioDataSource.Parse(String factorioPath, String modPath, String projectPath, Boolean netProduction, IProgress`1 progress, ErrorCollector errorCollector, String locale, Boolean renderIcons) in ./Yafc.Parser/FactorioDataSource.cs:line 354
   at Yafc.WelcomeScreen.LoadProject() in ./Yafc/Windows/WelcomeScreen.cs:line 396

In this fix I added research_item as an item but I think it would also make sense to ignore this recipe and log warning instead if that's preferred.

edit: looks like research progress is a new officially supported API, so the fix is correct https://lua-api.factorio.com/latest/concepts/ResearchProgressProduct.html

yafc loads after the fix.

@zzh8829 zzh8829 requested a review from shpaass as a code owner December 27, 2024 00:40
@zzh8829 zzh8829 changed the title fix cerys analysis Add research-progress item type support Dec 27, 2024
Copy link
Owner

@shpaass shpaass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix!

Copy link
Collaborator

@veger veger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for you contribution.

Can you add a changelog entry for your fix?

@zzh8829
Copy link
Author

zzh8829 commented Dec 27, 2024

done

@shpaass shpaass merged commit 28426c0 into shpaass:master Dec 28, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants