Prototype/ItemWithInventory: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(0.16)
Line 1: Line 1:
==Basics==
==Basics==
Inherits from [[prototype/ItemWithLabel]] and is used in the base game by the blueprint book item.
The inventory allows setting player defined filters similar to the quickbar and cargo wagon inventories. Extends [[Prototype/ItemWithLabel]].
  type = "item-with-inventory"
The inventory allows setting player defined filters similar to the quickbar and cargo wagon inventories.


== Mandatory properties ==
== Mandatory properties ==
This prototype inherits all the properties from [[Prototype/ItemWithLabel]].
=== inventory_size ===
=== inventory_size ===
'''Type''': [[Types/ItemStackIndex]]
The inventory size of the item.
The inventory size of the item.
  inventory_size = 20 -- 20 slots


== Optional properties ==
== Optional properties ==
=== item_filters ===
=== item_filters ===
'''Type''': [[Types/table]] of [[Types/string]]
A list of explicit item names to be used as filters.
A list of explicit item names to be used as filters.
   item_filters = {"iron-ore", "copper-ore", "coal", "stone"}
   item_filters = {"iron-ore", "copper-ore", "coal", "stone"}


=== item_group_filters ===
=== item_group_filters ===
'''Type''': [[Types/table]] of [[Types/string]]
A list of explicit item group names to be used as filters.
A list of explicit item group names to be used as filters.
   item_group_filters = {"storage", "belt"}
   item_group_filters = {"storage", "belt"}


=== item_subgroup_filters ===
=== item_subgroup_filters ===
'''Type''': [[Types/table]] of [[Types/string]]
A list of explicit item subgroup names to be used as filters.
A list of explicit item subgroup names to be used as filters.
   item_subgroup_filters = {"capsule", "tool"}
   item_subgroup_filters = {"capsule", "tool"}


=== filter_mode ===
=== filter_mode ===
'''Type''': [[Types/string]]
'''Default''': "whitelist"
This determines how filters are applied. If no filters are defined this is automatically set to "none".
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_mode = "blacklist" -- or "whitelist" if you want whitelisting


=== filter_message_key ===
=== filter_message_key ===
'''Type''': [[Types/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.
The locale key used when the player attempts to put an item that doesn't match the filter rules into the item-with-inventory.
  filter_message_key = "....."
If not defined this defaults to "item-limitation.item-not-allowed-in-this-container-item".


=== extends_inventory_by_default ===
=== extends_inventory_by_default ===
'''Type''': [[Types/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.
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.
  extends_inventory_by_default = false -- the default is false if not defined


=== insertion_priority_mode ===
=== insertion_priority_mode ===
'''Type''': [[Types/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.
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"
   insertion_priority_mode = "never"
Line 52: Line 73:
| 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
| 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
|}
|}
== Differing defaults ==
=== stackable ===
Defaults to <code>false</code>, can't be changed.
=== stack_size ===
Must be 1.

Revision as of 09:35, 22 May 2018

Basics

The inventory allows setting player defined filters similar to the quickbar and cargo wagon inventories. Extends Prototype/ItemWithLabel.

Mandatory properties

This prototype inherits all the properties from Prototype/ItemWithLabel.

inventory_size

Type: Types/ItemStackIndex

The inventory size of the item.

Optional properties

item_filters

Type: Types/table of Types/string

A list of explicit item names to be used as filters.

 item_filters = {"iron-ore", "copper-ore", "coal", "stone"}

item_group_filters

Type: Types/table of Types/string

A list of explicit item group names to be used as filters.

 item_group_filters = {"storage", "belt"}

item_subgroup_filters

Type: Types/table of Types/string

A list of explicit item subgroup names to be used as filters.

 item_subgroup_filters = {"capsule", "tool"}

filter_mode

Type: Types/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: Types/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: Types/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: Types/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

Differing defaults

stackable

Defaults to false, can't be changed.

stack_size

Must be 1.