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
4 days ago
0.13 - 2.0
62.7K
Manufacturing

g [Implemented] How can I make Robot Army compatible with this mod?

3 years ago

Hello,
I have a request from a user of my mod (Robot Army) that they want the items in my mod to be compatible with your mod. Have you got any guidance for me for how to do this? It sounds like your mod should handle it automatically, but maybe there's an issue.

3 years ago
(updated 3 years ago)

Hm, I just tested with both mods, and it seems that all items from your mod are recycleable, except for the ones marked as "(deployable)" in the recipe list. This could happen if the name of the item does not match the name of the recipe that creates it, which looks like it is the case here.

If you wanted these to be recyclable, they would have to match their recipe names, though looking at the rest of the items/recipes, it appears that you kinda have to specify different names for these items?

3 years ago
(updated 3 years ago)

Alright, so for the latest release (v8.1.0), I've added a feature where other mods can define custom recycling recipes, specifically for situations like this, where the item name does not match the recipe name. You can check the FAQ here, or check the bottom few lines of my data.lua for examples.

You will only have to define the item type (example: for data.raw.item[name], it should be "item", but for data.raw.ammo[name], it should be "ammo"), the item name that you want to recycle, and the recipe that should be used as the base for recycling that item. I've only tested it from within my own mod, but it should work for any other mod, so long as you define these lines during data-updates (it might not work during data or data-final-fixes due to load order issues)

3 years ago

Okay, cool! so I can basically re-direct the "deployable" items to their base item recipe so your mod can handle it? Great work!

I think the user specifically said they had errors when using your mod with the Recycling Machines mod from DRY411S, https://mods.factorio.com/mod/ZRecycling

They just said there was 'errors' when using both at once, I don't know why they reported it on my mod's Github Issues, maybe they thought my mod was to blame for the error generated from those two active at once? Here's their report: https://github.com/kyranf/robotarmyfactorio/issues/176

3 years ago
(updated 3 years ago)

Yup, here are the specific examples that I used for testing purposes, that would probably need to be applied to the rest of the "(deployable)" bots:

table.insert(rf.custom_recycle, {"item", "droid-smg-dummy", "droid-smg-deploy"})
table.insert(rf.custom_recycle, {"item", "terminator-dummy", "terminator-deploy"})

Just make sure to check for either the existence of my mod or the existence of this table, like

if rf then
  if rf.custom_recycle

As for the error.. like you mention in that report page, I would need a screenshot or modlist or something to know what the issue is. Using all 3 mods by themselves causes no issues on my side, and without even the error message, it's impossible to tell which mod the error came from.

3 years ago
(updated 3 years ago)

https://github.com/kyranf/robotarmyfactorio/issues/176

Varoga updated the issue, with what problems are occuring. Apparently there's an issue where my flamethrower robot uses 2 light armours (a non-stackable item) and your mod and Recycling Machines mod both are trying to convert the recipe to output 2 light armours but they cannot because they cannot stack?

Do you have any ideas around this?

3 years ago

I am not sure how they got this error... this "droid-flame" appears to recycle just fine?

3 years ago

I want to say that there might be a third mod that changes the recipes of all other mods, maybe something like bobs, angels, AAI, Pyanodons, Space Exploration, Industrial Revolution, etc. That's the only thing I can think of? But it's definitely not an issue isolated to these 3 mods, there must be something else in the modlist affecting the issue.

3 years ago
(updated 3 years ago)

ah! we have the answer - on the github issue just updated:
"I'm sorry, I made a mistake. This is due to my inattention. I accidentally installed the "Schall Main Battery" mod from Schallfalke, and it was he who caused the error between the "robot army" mod and the resource recycling mods. Thank you for not refusing to help."

Thanks Kryzeth for your attention to this issue, it was a weird one for sure. All in a day's work!

3 years ago

Hmm... ahh, I see why it crashes on load now. The Schall mod is adding an equipment grid to the light armor, which is perfectly fine and causes no direct issues with Reverse Factory or Recycling Machines mods by itself; but with the Robot Army mod, the "droid-flame" recycling recipe becomes incompatible, due to the limitation of items with equipment grids not being able to stack.

Hm... in theory, this issue could happen with any mod that defines a recipe using two or more items with equipment grids.. though I'm not quite sure how to prevent this from occurring.. unless I added a check for every single recipe, to check every one of its ingredients, to check for the existence of an equipment grid. Though I guess technically, it might only have to check if the ingredient exists in the armor or vehicle item types... this might not be as difficult as I thought.

3 years ago

well once you can check for it, what's the solution? ignore the recipe output? just have it not appear on the output? or limit it to 1 only, even if it should be 2 or 3 or something?

3 years ago
(updated 3 years ago)

Ah, I realized that partway through.. the way I currently have it implemented (as of v8.1.1, which I just uploaded), the recipe simply becomes unrecyclable. I kinda just wanted to finish the update so that at least, things wouldn't crash. The way my mod is set up, is that for every item in the game, check if it can be recycled with a long series of checks:

First if a recipe name matches the item name, then if the item is reversible (has at least one ingredient), then if the recipe is not probability-based, then if the recipe is not in no_recycle list (defined mostly by other mods), and then finally, here I added the check for equipment grids in the ingredients. If that last check passes, then it tries to recycle the item based on the recipe it located. Meaning, it's a simple yes-no check, not something conditional I can pass through the rest of the process.

Technically, I could always move the check into the part where it actually creates the recipe; that shouldn't be too difficult, considering that I already have a function for modifying the recipes, under certain conditions.

So I guess I will look into that later, since it does make sense to simply "flatten" the recycling recipe, so that it only produces one of the items with equipment grids. It is a slight waste of resources, but it seems better than leaving the recipe entirely unrecyclable, as it currently stands. And since this is such a rare occurrence, it shouldn't affect people 99% of the time anyways.

3 years ago
(updated 3 years ago)

I have changed this behavior due to issues with other mods, so instead of outright refusing to recycle recipe with unstackable ingredients; instead, any unstackable ingredients with equipment grids will simply reduce to 1 of that ingredient. Updated as of v8.1.2

New response