picture not found in property tree

Place to get help with not working mods / modding interface.
Lead_Hail
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Jan 28, 2022 2:55 am
Contact:

picture not found in property tree

Post by Lead_Hail »

I am getting a error message Attached below when I was attempting to fix the mod Improved combinators as I was not able to attach wires to the entity. I went through with Chat GPT and it says my script looks correct but to come here to ask for help. I have also Provided the mod with the changes I have made below.

Failed to load mods: Error while loading entity prototype "improved-combinator" (container): Key "picture" not found in property tree at ROOT.container.improved_combinator
Modifications: Improved Combinator
Attachments
ImprovedCombinator_1.0.14.zip
(238.75 KiB) Downloaded 49 times

Pi-C
Smart Inserter
Smart Inserter
Posts: 1724
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: picture not found in property tree

Post by Pi-C »

Started the game with your mod, this is the error message (fixed the entity name):

Code: Select all

Mods to disable:Failed to load mods: Error while loading entity prototype "improved-combinator" (container): Key "picture" not found in property tree at ROOT.container.improved-combinator
The error message is pretty straight-forward: The definition of container prototype "improved-combinator" is missing a value for 'picture'. So, let's take a look at the definition:

Code: Select all

    {
        type = "container",
        name = entity_name,
        icon = "__ImprovedCombinator__/graphics/icons/improved-combinator-icon.png", -- Updated icon path
        icon_size = 64,
        icon_mipmaps = 4,
        flags = {"not-rotatable", "placeable-neutral", "placeable-player", "player-creation"},
        minable = {hardness = 0.2, mining_time = 2, result = entity_name},
        max_health = 250,
        selection_box = {{-0.75, -0.5}, {0.95, 0.5}},
        collision_box = {{-1.0, -0.35}, {1.0, 0.35}},
        collision_mask = {"item-layer", "object-layer", "water-tile"},
        inventory_size = 0, -- Set inventory size to 0 to disable inventory
        circuit_wire_connection_points = {
            {
                wire = {green = {0, -0.5}, red = {0, 0.5}},
                shadow = {green = {0, -0.5}, red = {0, 0.5}}
            },
            {
                wire = {green = {0, -0.5}, red = {0, 0.5}},
                shadow = {green = {0, -0.5}, red = {0, 0.5}}
            }
        },
        circuit_wire_max_distance = 7.5, -- Adjust as needed
        pictures = {
            layers = {
                {
                    filename = "__ImprovedCombinator__/graphics/entity/improved-combinator-entity.png", -- Updated entity image path
                    priority = "extra-high",
                    width = 102,
                    height = 51,
                    shift = {0, 0},
                    hr_version = {
                        filename = "__ImprovedCombinator__/graphics/entity/hr_improved-combinator-entity.png", -- Updated high-res image path
                        priority = "extra-high",
                        width = 204,
                        height = 102,
                        shift = {0, 0},
                        scale = 0.5
                    }
                }
            }
        }
    }
If you look for a key 'picture' at the top level of data.raw.container["improved-combinator"], you'll see that it really isn't there. Instead, you've got 'pictures', plural. This isn't an animation or something similar, so really one sprite only is needed. While it may consist of different layers, it really makes for just a single picture. So just fix the typo: 'pictures' --> 'picture'!

However, while this may have fixed the original typo, another error is popping up now:

Code: Select all

Mods to disable:Failed to load mods: File not found: __ImprovedCombinator__/graphics/entity/hr_improved-combinator-entity.png

Mods to be disabled:
• ImprovedCombinator (1.0.14)
These files are in ImprovedCombinator_1.0.14/graphics/entity:

Code: Select all

$ ls -1
hr-improved-combinator-shadow.png
improved-combinator.png
improved-combinator-shadow.png
remnants
More typoes! File "hr_improved-combinator-entity.png" doesn't exist, but file "hr-improved-combinator.png" does. Here are the lines with references to files named "*combinator-entity.png":

Code: Select all

ImprovedCombinator_1.0.14$ ugrep -n "combinator-entity.png"
prototypes/improved-combinator.lua:40:                    filename = "__ImprovedCombinator__/graphics/entity/improved-combinator-entity.png", -- Updated entity image path
prototypes/improved-combinator.lua:46:                        filename = "__ImprovedCombinator__/graphics/entity/hr_improved-combinator-entity.png", -- Updated high-res image path
After fixing this, there's yet another error:

Code: Select all

Mods to disable:Failed to load mods: File not found: __ImprovedCombinator__/graphics/icons/improved-combinator-icon.png

Mods to be disabled:
• ImprovedCombinator (1.0.14)
The only file in graphics/icons is "improved-combinator.png", you use the wrong name here:

Code: Select all

ImprovedCombinator_1.0.14$ ugrep -n icon.png
prototypes/improved-combinator.lua:7:        icon = "__ImprovedCombinator__/graphics/icons/improved-combinator-icon.png", -- Updated icon path
prototypes/improved-combinator.lua:16:        icon = "__ImprovedCombinator__/graphics/icons/improved-combinator-icon.png", -- Updated icon path
Looks like you updated the file names in your definitions but didn't rename the image files! Once you've done that, the game should load up successfully to the main menu.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Lead_Hail
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Jan 28, 2022 2:55 am
Contact:

Re: picture not found in property tree

Post by Lead_Hail »

I can't believe that I was stopped by one "s" I could've figured out the misspellings, but now for some reason the item isnt showing up in the crafting menu, maybe I missed something i needed in the improved-combinator.lua as I had ChatGPT completely rewrite it. Should I upload the original to show the differences? I found out that ChatGPT simply ignored the values needed for the recipe and technology, I am currently making changes to make them available again, Thank you for your help on this project! If I get stuck again I'll be back for further guidance if you don't mind

Pi-C
Smart Inserter
Smart Inserter
Posts: 1724
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: picture not found in property tree

Post by Pi-C »

Lead_Hail wrote:
Fri Sep 22, 2023 12:51 am
I can't believe that I was stopped by one "s" I could've figured out the misspellings, but now for some reason the item isnt showing up in the crafting menu,
You have defined item and entity, but not the recipe. Without recipe, you can't craft the Item. Also, in your case the item will be useless because you can't build an entity with it! Start up the game and enter this on the chat console (you may need to enter it twice):

Code: Select all

/c p = game.player; p.insert("improved-combinator")
This will put a stack of your combinators into your inventory. Try to build it -- nothing will happen. You can fix that by adding

Code: Select all

place_result = "improved-combinator"
to your item definition.
maybe I missed something i needed in the improved-combinator.lua as I had ChatGPT completely rewrite it.
Not saying that humans can't make mistakes, but I wouldn't trust an AI to come up with a mod unless it's just a very simple one that adds another version of an item or recipe …
Should I upload the original to show the differences?
Not necessary, I've found the original mod. But it seems you've removed a lot from the original entity definition …
Thank you for your help on this project! If I get stuck again I'll be back for further guidance if you don't mind
You're welcome! Just ask if you have more questions. Even If I don't know the answer, others may be willing to chime in. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Modding help”