Page 1 of 1

[2.0.14] Quality crashes when malformed recipe

Posted: Thu Nov 07, 2024 9:34 am
by lambdalemon

Code: Select all

data:extend{{
    type = "recipe",
    name = "unspoil-yumako",
    ingredients = {
        type = "item",
        name = "yumako",
        amount = 1
    },
    results = {
        type = "item",
        name = "yumako",
        amount = 1,
        percent_spoiled = 0
    },
    enabled = true
}}

Re: [2.0.14] Quality crashes when recipes maps to itself

Posted: Thu Nov 07, 2024 9:41 am
by boskid
Not a bug. Your recipe prototype is malformed.

Re: [2.0.14] Quality crashes when recipes maps to itself

Posted: Thu Nov 07, 2024 9:47 am
by lambdalemon
In that case it's a bug because it should show it's a malformed recipe, not a quality issue.

Re: [2.0.14] Quality crashes when malformed recipe

Posted: Thu Nov 07, 2024 10:02 am
by boskid
Yes, it is a bug with your recipe prototype. Quality mod tries to iterate over products table however it was not an array of products but a single product given directly. It is not a game crash but script throwing an error and the error tells you exactly that: it tries to use `product` (by going to sources you will find it expects a table here) but it gets a numeric value instead. I am not seeing any reasons to throwing custom errors here instead because it would still be throwing an error and i would be commited to adding a lot of extra checks only to throw "more readable" errors and i cannot predict where modders will provide malformed data. If your prototypes would not be malformed, then they would not cause subsequent mod to break.

Re: [2.0.14] Quality crashes when malformed recipe

Posted: Thu Nov 07, 2024 10:11 am
by lambdalemon
Prototype validation could just check this and produce an error with malformed prototype, I don't think this would be a high priority bug. It would be a nice thing to have though.

Re: [2.0.14] Quality crashes when malformed recipe

Posted: Thu Nov 07, 2024 10:17 am
by boskid
There is no prototypes validation between mod stages because that would be huge slow down when loading highly modded games and that would require implementation of custom prototype validation checks for every prototype, we have too many of those. Also some mods may define partial prototypes in one stage and fill them up in other data stages, we do not blame those mods for doing that however if other mods trip at this we say it is not our fault.

Not a bug.