Issue extending data with new item

Place to get help with not working mods / modding interface.
codyfactorio
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 06, 2024 6:39 pm
Contact:

Issue extending data with new item

Post by codyfactorio »

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 ~

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 }
This DOES NOT WORK -

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 }
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
codyfactorio
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 06, 2024 6:39 pm
Contact:

Re: Issue extending data with new item

Post by codyfactorio »

Ah the issue was you also need to extend an item, in addition to the entity.

Code: Select all

data:extend(
        {
            {
                type = "item",
                name = "rose",
                icon = "__base__/graphics/icons/solar-panel.png",
                icon_size = 64,
                icon_mipmaps = 4,
                subgroup = "energy",
                order = "e[accumulator]-a[accumulator]-a",
                place_result = "rose",
                stack_size = 50
            }
        }
)
Post Reply

Return to “Modding help”