[2.0.20] ItemStackDefinition.quality should be QualityID

Place to report issues and suggest improvements to the API documentation.
User avatar
Cooldude2606
Fast Inserter
Fast Inserter
Posts: 110
Joined: Sat Sep 16, 2017 9:04 pm
Contact:

[2.0.20] ItemStackDefinition.quality should be QualityID

Post by Cooldude2606 »

The type of "ItemStackDefinition.quality" is currently "string" but it should be "QualityID" (string or prototype).

All of the following commands work, showing that both string and prototype are accepted by "ItemStackDefinition.quality":
(params are of type "ItemStackIdentification" -> "SimpleItemStack" -> "ItemStackDefinition")

Code: Select all

/c game.player.surface.spill_item_stack{ position={5, 5}, stack={ name="iron-plate", quality="epic" } }
/c game.player.surface.spill_item_stack{ position={5, 5}, stack={ name="iron-plate", quality=prototypes.quality.epic } }
/c game.player.insert{ name="iron-plate", quality="epic" }
/c game.player.insert{ name="iron-plate", quality=prototypes.quality.epic }
/c game.player.get_main_inventory().find_empty_stack().set_stack{ name="iron-plate", quality="epic" }
/c game.player.get_main_inventory().find_empty_stack().set_stack{ name="iron-plate", quality=prototypes.quality.epic }
--- Developer for Explosive Gaming and Clusterio. Please contact me via our Discord. ---
Bilka
Factorio Staff
Factorio Staff
Posts: 3429
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [2.0.20] ItemStackDefinition.quality should be QualityID

Post by Bilka »

This type is read in two ways, one that supports Lua objects (LuaHelper::parse<ItemStack>) and one that doesn't (ItemStack::fromPTree). The latter is used by create_entity. The documentation for the type currently documents the format that both parsing methods support, so no lua objects.
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 “Documentation Improvement Requests”