Reverse Factory

by Kryzeth

Reverse Factory machine will recycle (uncraft) nearly any item placed inside. Supports the recycling of most, if not all, modded items. Fully featured integration with Bobs Mods, Industrial Revolution, and Fantario (independently, not simultaneously)

Content
23 hours ago
0.13 - 2.0
61.7K
Manufacturing

b [Compatibility Mod] Error on load with Reverse Factory and AIO+SpaceExploration+Krastorio2 mods

3 years ago

I encoutered a crash when I wanted to use Reverse Factory along with AIO - Space Exploration + Krastorio2 + BobLogistics.
The AIO mod replace some ingredient for some recipes and then remove the now useless ingredients.

Reverse Factory still find the old disabled recipe and tries to reverse it and cause crash because of the removed items.

I fixed this by adding a check in the function checkRecipe(recipe,item) at line 166 :
if not data.raw.item[item.name] then uncraft = false end

With this, Reverse Factory will not try to create a recipe using removed items :)

3 years ago

Oops, sorry forgot to set as bug

3 years ago

Holy wow, that's a lot of mods. Hm, I would wonder how exactly the other mod is "disabling" the other recipes.. if they simply set the item to nil, then my mod shouldn't even begin to try to recycle anything, because the beginning logic depends on the item, before looking for a recipe to recycle. If they set the recipe to nil, then my mod should fail to find a recipe and automatically flag it as unrecyclable.

The problem could simply be that my mod is loading first, creating the reverse recipes, and then the item/recipe is removed; that could definitely cause problems. I'll try and see if forcing the mod load order fixes anything, but otherwise, I'll add in your fix. Oh god, I'm going to have to download 45 (!) separate mods to even begin testing this... check back in an hour or two lol.

3 years ago
(updated 3 years ago)

Ah, that's annoying. Somehow, there's a circular dependency between reverse factory and aio-se-k2 mod. And of course, Factorio doesn't explain HOW there's a loop, only that there is one. And of course, that is exactly what the problem is: Reverse Factory is creating reverse recipes first, and then AIO comes along and removes those items, causing the errors. If my mod could load up after, this could be a very simple fix of changing dependencies.

I'm honestly not sure how or why your fix works, but it does indeed work... that is odd, considering that part of the logic is only checking the list of items on the "norecycle" list... I guess one of these mods must be adding all of the removed to the list, and my logic was simply not working properly? It does make sense to check if the item exists first, but in theory, the item Should exist, at the time of checking? Since the items aren't being nil'd out until later... I dunno, whatever, it seems to work lmao. Uploaded as v8.0.7

EDIT: Removed v8.0.7 upon further testing, as it appeared to be rendering everything unrecyclable. It only stops the crashing because it stops trying to create any reverse recipes.

3 years ago

Sorry, I was too quick in proposing this fix, I realized later that it does prevent anything from beeing recyclable...
I thougt it worked because the mod loaded and the technologies was available but I just got able to try ingame now because I started a new game ^^

Maybe the solution would be to add the AIO disabled items (BobLogistics pumps and pipes) to the non-recyclable list?
The problem if that for the pump recipe, AIO does not disable the recipe, but instead change the copper-pipe to vanilla pipe, then it removes all BobLogistics others pumps and pipes recipes.

3 years ago

Sorry, I was too quick in proposing this fix, I realized later that it does prevent anything from beeing recyclable...
I thougt it worked because the mod loaded and the technologies was available but I just got able to try ingame now because I started a new game ^^

Maybe the solution would be to add the AIO disabled items (BobLogistics pumps and pipes) to the non-recyclable list when the AIO mod is enabled?
The problem if that for the pump recipe, AIO does not disable the recipe, but instead change the copper-pipe to vanilla pipe, then it removes all BobLogistics others pumps and pipes recipes.

3 years ago

I tried the norecyle way and it works fine.
There is a few collateral damage because the recipes with changed items (eg : pump) gets unrecyclable but they should be, but because Reverse-Factory see non-updated recipes with forbidden ingredients in it, then the recipe goes non-recyclable.

Better than nothing but not an actual fix...

Would you like the full list to put in Reverse Factory, or should I make a "compatibility" mod that goes beetween AIO and Reverse Factory?

3 years ago
(updated 3 years ago)

There wouldn't be any problem if my mod could simply load after AIO's, that way, my mod wouldn't create reverse recipes for items that get removed by their mod later. Adding things to the non-recyclable list should be fine... until the AIO mod maker starts disabling more items/recipes, or brings back a recipe that they had previously removed.

Also, the fact that recipes would become unrecyclable, that would always happen, because my mod only creates reverse recipes for items that have a recipe with the exact same name as the item. If the recipe AIO creates, has a different name, then it would never be picked up by my mod, because that's simply not how it works.

Honestly, it would make more sense for the AIO mod maker to add all of these items on THEIR end, instead of me adding them on my end, because then they would be able to update their list as they please, as opposed to me having to play catch-up every time they update their mod. That's kind of why that entire "nonrecycle" list exists in the first place, for other mod makers to use to ensure compatibility with my mod.

3 years ago

Oh, it should also work if you create that as a separate mod. I could link to it here, if you would like, for players who want to use both mods. Though that would put the burden and responsibility of keeping up with AIO's updates on you, when I personally believe it should be on the mod maker.

But you're right, it makes more sense to have a compatibility mod that works, rather than leaving everything in an incompatible state.

3 years ago
(updated 3 years ago)

Sorry for the long wait, here is the simple compatibility mod I made : https://mods.factorio.com/mod/reverse-factory-aio-compat
For now it uses a static list, but I'll try to improve it to detect removed items automatically in the future.

3 years ago
(updated 3 years ago)

Everything does appear to be working perfectly with your compatibility fix and all mods installed. Very nice!

I've added your mod to the description on the homepage, in case anybody stumbles across this issue, many thanks for the fix!

New response