Prototype/ItemWithInventory: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Added prototype type to page)
m (words)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Basics==
{{Prototype parent|Prototype/ItemWithLabel}}
Prototype type: '''item-with-inventory'''
The inventory allows setting player defined filters similar to the quickbar and cargo wagon inventories.


The inventory allows setting player defined filters similar to the quickbar and cargo wagon inventories. Extends [[Prototype/ItemWithLabel]].
{{Prototype TOC|item-with-inventory}}


== Extensions ==
== Extensions ==
Line 10: Line 10:
This prototype inherits all the properties from [[Prototype/ItemWithLabel]].
This prototype inherits all the properties from [[Prototype/ItemWithLabel]].


=== inventory_size ===
{{Prototype property|inventory_size|[[Types/ItemStackIndex|ItemStackIndex]]}}
'''Type''': [[Types/ItemStackIndex]]
 
The inventory size of the item.
The inventory size of the item.


== Optional properties ==
== Optional properties ==


=== item_filters ===
{{Prototype property|item_filters|[[Types/table|table]] of [[Types/string|string]]|optional=true}}
'''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 ===
{{Prototype property|item_group_filters|[[Types/table|table]] of [[Types/string|string]]|optional=true}}
'''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 ===
{{Prototype property|item_subgroup_filters|[[Types/table|table]] of [[Types/string|string]]|optional=true}}
'''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 ===
{{Prototype property|filter_mode|[[Types/string|string]]|"whitelist"|optional=true}}
'''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 ===
{{Prototype property|filter_message_key |[[Types/string|string]]|"item-limitation.item-not-allowed-in-this-container-item"|optional=true}}
'''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.


=== extends_inventory_by_default ===
{{Prototype property|extends_inventory_by_default|[[Types/bool|bool]]|false|optional=true}}
'''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.


=== insertion_priority_mode ===
{{Prototype property|insertion_priority_mode|[[Types/string|string]]|"default"|optional=true}}
'''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 79: Line 55:
|}
|}


== Differing defaults ==
== Mandatory values ==
=== stackable ===
Item with inventory must have a stack size of 1.
Defaults to <code>false</code>, can't be changed.
 
=== stack_size ===
Must be 1.

Latest revision as of 14:18, 3 November 2022

Prototype definitions » PrototypeBase » Prototype/Item » Prototype/ItemWithLabel » Prototype/ItemWithInventory


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


Prototype/ItemWithInventory — item-with-inventory
inventory_size::ItemStackIndex
extends_inventory_by_default::bool (optional)
filter_message_key::string (optional)
filter_mode::string (optional)
insertion_priority_mode::string (optional)
item_filters::table of string (optional)
item_group_filters::table of string (optional)
item_subgroup_filters::table of string (optional)
Inherited from Prototype/ItemWithLabel
default_label_color::Color (optional)
draw_label_for_cursor_render::bool (optional)
Inherited from Prototype/Item
icons, icon, icon_size (IconSpecification)::IconSpecification
stack_size::ItemCountType
burnt_result::string (optional)
close_sound::Sound (optional)
dark_background_icons, dark_background_icon, icon_size (IconSpecification)::IconSpecification (optional)
default_request_amount::ItemCountType (optional)
flags::ItemPrototypeFlags (optional)
fuel_acceleration_multiplier::double (optional)
fuel_category::string (optional)
fuel_emissions_multiplier::double (optional)
fuel_glow_color::Color (optional)
fuel_top_speed_multiplier::double (optional)
fuel_value::Energy (optional)
open_sound::Sound (optional)
pictures::SpriteVariations (optional)
place_as_tile::PlaceAsTile (optional)
place_result::string (optional)
placed_as_equipment_result::string (optional)
rocket_launch_product::ItemProductPrototype (optional)
rocket_launch_products::table (array) of ItemProductPrototype (optional)
subgroup::string (optional)
wire_count::ItemCountType (optional)
Inherited from PrototypeBase
name::string
type::string
localised_description::LocalisedString (optional)
localised_name::LocalisedString (optional)
order::Order (optional)

Extensions

Mandatory properties

This prototype inherits all the properties from Prototype/ItemWithLabel.

inventory_size

Type: ItemStackIndex
The inventory size of the item.

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.