DRY411S / Recycling-Machines

A factorio mod that adds Recycling Machines to the game. These disassemble products back into their original ingredients.
GNU General Public License v3.0
10 stars 2 forks source link

Empty Flat (no difficulty) Results #48

Closed Rybadour closed 5 years ago

Rybadour commented 5 years ago

My game seems to load fine but an item in Angels PetroChem, filter-lime, is causing the tool I'm working on to break. This is because Recycling-Machines generates a recipe that has no results in the normal difficulty of the item. This is strange because the filter-lime item doesn't have difficulties defined. Looking through your code seems to indicate that you have one possible reason this happens. In the "add_reverse_recipe" function if "build_rev_results" returns an empty table and assigns it to "flat" then the check at the bottom of the function will attempt to set "recipe.normal.results" to "normal" which is nil because the original item has no difficulties define.

I wish I could give you better info but for some reason I can't find the piece of code in PetroChem that actually defines filter-lime.

Let me know if you need me to provide more info.

Thanks.

DRY411S commented 5 years ago

Thank you for the report. I'm on vacation at the moment, so I won't be able to take a look at this until the end of the month.

DRY411S commented 5 years ago

This is not a bug in my mod.

Using my Recipe Output mod and filtering the results (shown below) you can see that my mod finds a recipe called filter-lime, which has a filter-frame and stone-crushed as ingredients, and produces the reverse recipe that produces the filter-frame and stone-crushed from the filter-lime ingredient.

Recipe Name Category Group Subgroup Product 1 Product 1 Amount Product 2 Product 2 Amount Ingredient 1 Ingredient 1 Amount Ingredient 2 Ingredient 2 Amount
dry411srev-filter-lime recycling-1 dry411srev-petrochem-refining dry411srev-petrochem-raw filter-frame 1 stone-crushed 5 filter-lime 1    
filter-lime crafting petrochem-refining petrochem-sulfur filter-lime 1     filter-frame 1 stone-crushed 5
Rybadour commented 5 years ago

I'm still learning about Lua and Factorio's API for all I know the tool I'm working on is implementing something wrong to cause this. Since I've circumvented the issue and recycling recipes are effectively useless to the tool I'll leave this issue "resolved" for now. I'll re-open if I have a need.

Thanks for looking into this.

DRY411S commented 5 years ago

Please don't reopen it. It's not an issue with my code.