Page 1 of 1

[0.16.25] AssignID error when deleting base recipe

Posted: Mon Feb 26, 2018 1:47 pm
by Impatient
Hi,

I found an unexpected behavior in the engine while tinkering with my own mod.

I was creating a different recipe for "electronic-circuit" and erased the old one, like so:

Code: Select all

data:extend{
  {
    type = "recipe",
    name = "new-recipe-for-electronic-circuit",
    normal =
    {
      ...
      result = "electronic-circuit",
    },
    expensive =
    {
      ...
      result = "electronic-circuit",
    }
  }
}

data.raw.recipe["electronic-circuit"] = nil
When loading this, factorio threw an error. These are the lines from factoro-current.log:

Code: Select all

...

   2.013 Error ModManager.cpp:1023: Error in assignID, recipe with name 'electronic-circuit' does not exist.

Source: productivity-module (module).

...
I did not change the prototype for the item "electronic-circuit". Does that mean, that the recipe for "productivity-module" references the recipe for "electronic-circuit" and not the item "electronic-circuit"? If yes, is this a bug or the intended behavior?

Re: [0.16.25] AssignID error when deleting base recipe

Posted: Mon Feb 26, 2018 2:44 pm
by Impatient
It just crossed my mind, that this error might have something to do with the recipes the productivity module is able to influence.

Re: [0.16.25] AssignID error when deleting base recipe

Posted: Mon Feb 26, 2018 2:56 pm
by Klonan
This is not a bug, but a modding error

Re: [0.16.25] AssignID error when deleting base recipe

Posted: Mon Feb 26, 2018 4:14 pm
by Impatient
Thank you Klonan.

Can anyone help me to properly remove a recipe that comes with the base mod? In case that it is possible at all. Thanks!

Re: [0.16.25] AssignID error when deleting base recipe

Posted: Mon Feb 26, 2018 4:23 pm
by Impatient
Another idea that came to my mind is, that this error might be caused by the factorio engine trying to calculate the total base ingredients of a productivity module.

Re: [0.16.25] AssignID error when deleting base recipe

Posted: Mon Feb 26, 2018 4:34 pm
by eradicator
Removing things from base is often a bad idea if you want to keep compatibility. (Though i'm not really sure what the problem is here).

Why don't you just overwrite the old recipe, or set it to enabled = false?
data.raw.recipes['electronic-circuit'] = {<your new recipe here>}

Re: [0.16.25] AssignID error when deleting base recipe

Posted: Mon Feb 26, 2018 5:22 pm
by Impatient
Yes, I did so. For now I found a way around to achieve what I want. And enabled=false is a pretty smart solution to effectively remove a base recipe from gameplay. Thanks.