Prototype/ItemWithInventory
The prototype docs have moved to a new website with an improved format. This documentation page can now be found here: https://lua-api.factorio.com/latest/prototypes/ItemWithInventoryPrototype.html
This wiki page is no longer updated and will be removed at some point in the future, so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback on the forums.
Prototype definitions » PrototypeBase » Prototype/Item » Prototype/ItemWithLabel » Prototype/ItemWithInventory
The inventory allows setting player defined filters similar to cargo wagon inventories.
Extensions
- Prototype/BlueprintBook blueprint-book
Mandatory properties
This prototype inherits all the properties from Prototype/ItemWithLabel.
inventory_size
Type: ItemStackIndex or string
The inventory size of the item or "dynamic" for a dynamic inventory size. "dynamic" can only be used for Prototype/BlueprintBook.
Optional properties
item_filters
Type: table of string
A list of explicit item names to be used as filters.
item_filters = {"iron-ore", "copper-ore", "coal", "stone"}
item_group_filters
Type: table of string
A list of explicit item group names to be used as filters.
item_group_filters = {"storage", "belt"}
item_subgroup_filters
Type: table of string
A list of explicit item subgroup names to be used as filters.
item_subgroup_filters = {"capsule", "tool"}
filter_mode
Type: string
Default: "whitelist"
This determines how filters are applied. If no filters are defined this is automatically set to "none".
filter_mode = "blacklist" -- or "whitelist" if you want whitelisting
filter_message_key
Type: string
Default: "item-limitation.item-not-allowed-in-this-container-item"
The locale key used when the player attempts to put an item that doesn't match the filter rules into the item-with-inventory.
extends_inventory_by_default
Type: bool
Default: false
When true, this item-with-inventory will extend the inventory it sits in by default. This is a runtime property on the result item that can be changed through the Lua interface and only determines the initial value.
insertion_priority_mode
Type: string
Default: "default"
The insertion priority mode for this item. This determines if items are first attempted to be put into this items inventory if the item extends the inventory it sits in when items are put into the parent inventory.
insertion_priority_mode = "never"
Possible values are:
Flag | meaning |
---|---|
default | Items are inserted into this item-with-inventory only if they match the whitelist defined in the prototype for the item and whitelist is used. |
never | Items are never inserted into this item-with-inventory except explicitly by the player or script |
always | All items first try to be inserted into this item-with-inventory |
when-manually-filtered | When the inventory contains filters that match the item-to-be-inserted then try to put it into this item before the inventory this item resides in |
Mandatory values
Item with inventory must have a stack size of 1.