Page 1 of 1

[2.0.20] ItemStackDefinition.quality should be QualityID

Posted: Wed Nov 20, 2024 11:34 pm
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 }

Re: [2.0.20] ItemStackDefinition.quality should be QualityID

Posted: Wed Jul 02, 2025 10:40 am
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.