ItemProductPrototype::type is not always required

DaleStan
Filter Inserter
Filter Inserter
Posts: 399
Joined: Mon Jul 09, 2018 2:40 am
Contact:

ItemProductPrototype::type is not always required

Post by DaleStan »

Comparing the 1.1 and 2.0 documentation makes me believe that ItemProductPrototype::type is required in 2.0. However, with the mod Tricky Old Nick, --dump-data (output attached) produces at least one rocket_launch_products entry with no type. For example, at line 65882:

Code: Select all

        {
          "name": "nullius-guide-drone-nickel-1",
          "amount": 1,
          "probability": 0.2
        }
Under what circumstances is type optional in an ItemProductPrototype?
Attachments
data-raw-dump.7z
(739.15 KiB) Downloaded 31 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4642
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: ItemProductPrototype::type is not always required

Post by boskid »

In 2.0, `type` is required only in places where there is selection between ItemProduct and FluidProduct. Since rocket_launch_products is always an ItemProduct, there is no need to check what type it is becuase only items are allowed.

As for 2.1, there will be a change that makes code consistent with docs: `type` will be always mandatory regardless of prototype taking only ItemProduct or any product. This means that this data you mentioned will throw an error due to missing type.
Bilka
Factorio Staff
Factorio Staff
Posts: 3807
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: ItemProductPrototype::type is not always required

Post by Bilka »

I'm considering this fixed for 2.1 since the type will always be required.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Post Reply

Return to “Resolved Requests”