Issue extending data with new item
Posted: Sat Jun 08, 2024 11:29 pm
I'm trying to add, let's say, a red accumulator. I have the code setup, and there are no errors. But when I try to insert it into my inventory, it says "Unknown item name: rose"
As an example, this code piece is straight from the fire-armor tutorial.
This works ~
This DOES NOT WORK -
Looking at this mod, it doesn't seem like there is anything special with accumulators to extend them.
https://github.com/LsHallo/advanced-ele ... ulator.lua
Appreciate any help, thanks
As an example, this code piece is straight from the fire-armor tutorial.
This works ~
Code: Select all
/c game.player.insert{name="green-armor", count=10}
Code: Select all
local green_armor = table.deepcopy(data.raw["armor"]["heavy-armor"]) -- copy the table that defines the heavy armor item into the fireArmor variable
green_armor.name = "green-armor"
green_armor.icons = {
{
icon = green_armor.icon,
icon_size = green_armor.icon_size,
tint = { r = 0, g = 100, b = 0, a = 0.3 }
},
}
data:extend { green_armor }
Code: Select all
/c game.player.insert{name="rose", count=100}
Code: Select all
local rose = table.deepcopy(data.raw["accumulator"]["accumulator"])
rose.name = "rose"
rose.icons = {
{
icon = rose.icon,
icon_size = rose.icon_size,
tint = { r = 100, g = 0, b = 0, a = 0.3 }
},
}
data:extend { rose }
https://github.com/LsHallo/advanced-ele ... ulator.lua
Appreciate any help, thanks