Bob's Electronics


Adds a whole new electronics production chain.

11 months ago
0.13 - 1.1
245K

b Issue with IR2

3 years ago
(updated 3 years ago)

Hi! When both IR2 and Bob's Electronics are installed, this error will pop up on loading Factorio:

Error while running setup for technology prototype "gate" (technology): Technology prerequisite "ir2-electronics-1" is registered more than once.

This simple change to prototypes/technology-updates.lua (line 2) will avoid that crash:

-- Old
bobmods.lib.tech.add_prerequisite("gate", "electronics")

-- New
if not mods["IndustrialRevolution"] then bobmods.lib.tech.add_prerequisite("gate", "electronics") end
3 years ago
(updated 3 years ago)

I mean... your suggestion would fix the issue, but it's me adding an extra exception for a 3rd party mod, where if you read the error message, my mod isn't actually the cause.

The error says that "ir2-electronics-1" is registered more than once, which is an ir2 specific technology, so it must be IR2 doing something strange. (I would speculate that it is changing electronics technology to ir2-electronics-1 without checking to see if it already exists)

Bob's mods itself can't make such an error. if you call add_prerequisite, it will check to see if it exists, and only add it if it doesn't.
calling replace_prerequiste first checks if the old one exists, and if it does, called remove_prerequisite(old) then add_prerequisite(new), so if it were performing a replace_prerequiste function to change "electronics" into "ir2-electronics-1", it would remove "electronics" but then not actually add "ir2-electronics-1" because it already existed.

This is the kind of reason why my mods use my library, it isn't perfect or complete, I have a list of things I could add or improve in my library, but it has been developed over many years, and includes many safeguards to prevent errors such as the one you're experiencing.

Now, I'm not familiar with the inner workings of Industrial Revolution, but a better solution to the problem is if IR2 performed more safety checks, in this case checking to make sure a technology isn't already included as a prerequisite before adding it, and then use a "remove" and "add" system as part of their "replace" system if they don't already.

3 years ago

I mean... your suggestion would fix the issue, but it's me adding an extra exception for a 3rd party mod, where if you read the error message, my mod isn't actually the cause.

Correct.

Now, I'm not familiar with the inner workings of Industrial Revolution, but a better solution to the problem is if IR2 performed more safety checks, in this case checking to make sure a technology isn't already included as a prerequisite before adding it, and then use a "remove" and "add" system as part of their "replace" system if they don't already.

Deadlock is hard to contact (I'm not on Discord or github). He doesn't want to cater to other mods because that would get out of hand very fast given that he's rebuilding the entire tech tree and removing vanilla techs. While such general safeguards would be somewhat different, he's pretty much of the opinion that other mods should make efforts to be compatible with IR2.

I've come across that bug while testing BI for compatibility with other mods. I've added the check for IR to my local copy of your mod, and the game loaded successfully. So it's really just that one tech that prevents Factorio from loading. I'll add a fix to the next release of BI (it will take a while until we can release -- it's a major rework of the mod), so at least users of BI will be able to use your mod together with IR2.

3 years ago
(updated 3 years ago)

A solution I could consider. I have a redundant prerequisites check that runs during data-final-fixes stage that removes duplicated prerequisites from the tree. (EG, if you had electronics as a prerequisite on Advanced electronics 2... it's redundant, as it's on advanced electronics, and would be removed.)

I could expand on that to also check itself, so that if you have electronics (or in this case ir2-electronics-1) on the same technology twice, it would remove the duplicate one.

A general purpose fix on my end that doesn't require me to add a specific check for industrial revolution.

3 years ago

That seems to be the perfect solution: general, and requiring hardly any work. It really would be great if you'd add that! :-)

3 years ago

To be fair, these tools should be a part of any self respecting library, error mitigation is a key part of why factorio mod packs are soo flexible.
I say this as someone who has struggled to get such libraries to work with other mods... Keep up the great work BOB.

New response