Page 1 of 1

Failed to load mods: Error in assignID: Item with name 'hopper-furnace' does not exist

Posted: Sun Mar 14, 2021 11:07 pm
by Oy_Oy
I'm just trying to get my bearings trying a couple of simple things to learn my way around a bit... In this one I was modifying a script from the https://wiki.factorio.com/Tutorial:Modd ... al/Gangsir tutorial. Originally I had changed the source_inventory_size to 2000, however when I could not get this to work I removed this line to try to figure things out. Anyways, here is my item.lua:

Code: Select all

--item.lua

local hopperFurnace = table.deepcopy(data.raw["furnace"]["electric-furnace"]) -- copy the table that defines the electric furnace item into the hopperFurnace variable

hopperFurnace.name = "hopper-furnace"
hopperFurnace.icons = {
  {
    icon = hopperFurnace.icon,
    tint = {r=1,g=0,b=0,a=0.3}
  },
}

local recipe = table.deepcopy(data.raw["recipe"]["electric-furnace"])
recipe.enabled = true
recipe.name = "hopper-furnace"
recipe.ingredients = {{"copper-plate",5}}
recipe.result = "hopper-furnace"

data:extend{hopperFurnace,recipe}
Here is the original script I copied this from, which still runs without throwing an error:

Code: Select all

--item.lua

local fireArmor = table.deepcopy(data.raw["armor"]["heavy-armor"]) -- copy the table that defines the heavy armor item into the fireArmor variable

fireArmor.name = "fire-armor"
fireArmor.icons = {
  {
    icon = fireArmor.icon,
    tint = {r=1,g=0,b=0,a=0.3}
  },
}

fireArmor.resistances = {
  {
    type = "physical",
    decrease = 6,
    percent = 10
  },
  {
    type = "explosion",
    decrease = 10,
    percent = 30
  },
  {
    type = "acid",
    decrease = 5,
    percent = 30
  },
  {
    type = "fire",
    decrease = 0,
    percent = 100
  }
}

local recipe = table.deepcopy(data.raw["recipe"]["heavy-armor"])
recipe.enabled = true
recipe.name = "fire-armor"
recipe.ingredients = {{"copper-plate",200},{"steel-plate",50}}
recipe.result = "fire-armor"

data:extend{fireArmor,recipe}
Any hints would be much appreciated!

--Edit updated with code tags

Re: Failed to load mods: Error in assignID: Item with name 'hopper-furnace' does not exist

Posted: Sun Mar 14, 2021 11:30 pm
by Techfish3000
First off, use code tags

Code: Select all

like this
to make your code more readable.

Otherwise, your problem is the copy of the furnace.
You are copying the furnace entity, not the item. It would look like this instead i'm pretty sure:

Code: Select all

local hopperFurnace = table.deepcopy(data.raw["item"]["electric-furnace"])
If not, I'm not sure what is wrong.

Re: Failed to load mods: Error in assignID: Item with name 'hopper-furnace' does not exist

Posted: Sun Mar 14, 2021 11:37 pm
by Oy_Oy
Good call, that did it!

Thanks too for correcting my poor forum syntax, I fixed both and it's working just fine.

Re: Failed to load mods: Error in assignID: Item with name 'hopper-furnace' does not exist

Posted: Sun Mar 14, 2021 11:42 pm
by Techfish3000
No problem, glad to help.