[2.0.14] Quality crashes when malformed recipe

Bugs that are actually features.
lambdalemon
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Oct 23, 2024 12:03 pm
Contact:

[2.0.14] Quality crashes when malformed recipe

Post 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
}}
Attachments
factorio-current.log
(5.85 KiB) Downloaded 6 times
image.png
image.png (37.3 KiB) Viewed 306 times
Last edited by lambdalemon on Thu Nov 07, 2024 9:48 am, edited 1 time in total.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3335
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

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

Post by boskid »

Not a bug. Your recipe prototype is malformed.
lambdalemon
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Oct 23, 2024 12:03 pm
Contact:

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

Post by lambdalemon »

In that case it's a bug because it should show it's a malformed recipe, not a quality issue.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3335
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.14] Quality crashes when malformed recipe

Post 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.
lambdalemon
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Oct 23, 2024 12:03 pm
Contact:

Re: [2.0.14] Quality crashes when malformed recipe

Post 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.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3335
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.14] Quality crashes when malformed recipe

Post 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.
Post Reply

Return to “Not a bug”