Page 1 of 1

[2.0.8] Missleading error on recipe proto about missing icon when recipe has normal/expensive defined.

Posted: Tue Oct 22, 2024 5:50 pm
by MasterBuilder
This is debatable as to it being a bug or not, but it's a very misleading error to me and had me scratching my head for a few minutes about it.

The error in question:

Code: Select all

Error ModManager.cpp:1733: Error while loading recipe prototype "stacked-copper-plate" (recipe): Key "icon" not found in property tree at ROOT.recipe.stacked-steel-plate
Modifications: Deadlock Experimental Stacking
Except the icon is optional if the recipe has one result item, so I couldn't understand why it wasn't working when other recipes did.

Code: Select all

local stacked_cable = {
    type = "recipe",
    name = "stacked-copper-cable",
    normal = {
        enabled = false,
        energy_required = 0.5 * cable_density,
        ingredients = {{"deadlock-stack-copper-plate", 1}},
        results = {{"deadlock-stack-copper-cable",2}},
    },
    expensive = {
        enabled = false,
        energy_required = 0.5 * cable_density,
        ingredients = {{"deadlock-stack-copper-plate", 1}},
        results = {{"deadlock-stack-copper-cable",2}},
    },
}
(This is after I changed result/result_count to results.)
As it turns out, normal/expensive has been removed, so the actual error is that those are defined, and not the missing icon itself. Once I replaced it with just the contents of the normal section, the icon error went away.

So it'd be great if the error was something along the lines of normal/expensive sections being defined, instead of something that seems completely different from a user perspective.

Re: [2.0.8] Missleading error on recipe proto about missing icon when recipe has normal/expensive defined.

Posted: Tue Oct 22, 2024 5:59 pm
by boskid
1/ You are showing error for "stacked-steel-plate" but data for "stacked-copper-cable"
2/ `icon` is required when `icons` are not given.

Not a bug.

Re: [2.0.8] Missleading error on recipe proto about missing icon when recipe has normal/expensive defined.

Posted: Tue Oct 22, 2024 6:01 pm
by Bilka
Moved to modding interface requests to maybe adjust the error message.

Re: [2.0.8] Missleading error on recipe proto about missing icon when recipe has normal/expensive defined.

Posted: Tue Oct 22, 2024 6:22 pm
by MasterBuilder
boskid wrote: Tue Oct 22, 2024 5:59 pm 1/ You are showing error for "stacked-steel-plate" but data for "stacked-copper-cable"
2/ `icon` is required when `icons` are not given.

Not a bug.
Yeah, that was me just copying one of the recipes in the file. The exact name didn't matter since the issue was on the misleading error message of icons and I know that the cause is the normal/expensive groups. (I'll just edit them to match.)
Either way, it was moved to modding interface requests, so, not a bug for that I guess.

Re: [2.0.8] Missleading error on recipe proto about missing icon when recipe has normal/expensive defined.

Posted: Wed Nov 20, 2024 1:08 am
by Rseding91
Having a custom error for a mod defining "normal" and "expensive" for a recipe seems like overkill. It could just as easily have been they defined all the values in "something_that_is_not_valid" which also wouldn't work. It just happens that "icon"/"icons" is the first value it tried to read from the definition that wasn't defined.