ItemProductPrototype::type is not always required

Place to report issues and suggest improvements to the API documentation.
DaleStan
Filter Inserter
Filter Inserter
Posts: 396
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 15 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4540
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.
Post Reply

Return to “Documentation Improvement Requests”