Prototype/Item: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
mNo edit summary
(Updated styling of prototype doc migration note)
 
(37 intermediate revisions by 7 users not shown)
Line 1: Line 1:
==Basics==
<div class="stub"><p>'''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/ItemPrototype.html https://lua-api.factorio.com/latest/prototypes/ItemPrototype.html]
Possible configuration for all items
 
</p><p>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 [https://forums.factorio.com/viewforum.php?f=233 on the forums].</p></div>
 
 
 
{{Prototype parent|PrototypeBase}}
Possible configuration for all items.
 
{{Prototype TOC|item}}
 
== Extensions ==
== Extensions ==
{| class="wikitable"
* [[Prototype/AmmoItem]] '''ammo'''
|-
* [[Prototype/Capsule]] '''capsule'''
! Item !! json identification type !! Description
* [[Prototype/Gun]] '''gun'''
|-
* [[Prototype/ItemWithEntityData]] '''item-with-entity-data'''
| [[prototype/item]] || item || Regular item with no special properties.
* [[Prototype/ItemWithLabel]] '''item-with-label'''
|-
** [[Prototype/ItemWithInventory]] '''item-with-inventory'''
| [[prototype/Ammo]] || ammo || Ammunition for guns
*** [[Prototype/BlueprintBook]] '''blueprint-book'''
|-
** [[Prototype/ItemWithTags]] '''item-with-tags'''
| [[prototype/Gun]] || gun || Guns
** [[Prototype/SelectionTool]] '''selection-tool'''
|-
*** [[Prototype/BlueprintItem]] '''blueprint'''
| [[prototype/Armor]] || armor || Used as player protection.
*** [[Prototype/CopyPasteTool]] '''copy-paste-tool'''
|-
*** [[Prototype/DeconstructionItem]] '''deconstruction-item'''
| [[prototype/MiningTool]] || mining-tool || Used for mining resources and/or melee weapon.
*** [[Prototype/UpgradeItem]] '''upgrade-item'''
|}
* [[Prototype/Module]] '''module'''
* [[Prototype/RailPlanner]] '''rail-planner'''
* [[Prototype/SpidertronRemote]] '''spidertron-remote'''
* [[Prototype/Tool]] '''tool'''
** [[Prototype/Armor]] '''armor'''
** [[Prototype/MiningTool]] '''mining-tool''' (for migration, cannot be used)
** [[Prototype/RepairTool]] '''repair-tool'''


== Mandatory properties ==
== Mandatory properties ==
=== type ===
Inherits all properties from [[PrototypeBase]].
Type of the item (extension)
 
  type = "item"
{{Prototype property|icons, icon,  icon_size (IconSpecification)|[[Types/IconSpecification|IconSpecification]]}}
=== name ===
 
Name of the item prototype (iron-gear-wheel/wooden-chest)
{{Prototype property|stack_size|[[Types/ItemCountType|ItemCountType]]}}
  name = "wooden-chest"
Count of items of the same name that can be stored in one inventory slot. Must be 1 when the <code>"not-stackable"</code> flag is set.
=== stack_size ===
Count of items of the same name that can be stored in one inventory slot.
   stack_size = 64
   stack_size = 64


=== order ===
Is used to order items in inventory (when sorting is enabled) and to sort recipes in crafting screen.
  order = "a-b-c"
=== flags ===
Specifies some properties of the item.
  flags = { "goes-to-quickbar" }
Possible values are:
{| class="wikitable"
|-
! Item !! meaning
|-
| goes-to-quickbar  || Item is moved to quick bar by default
|-
| goes-to-main-inventory || Item is moved to main inventory by default
|}
== Optional properties ==
== Optional properties ==
=== place_result ===
 
Name of [prototype/Entity] that can be built using this item
{{Prototype property|place_result|[[Types/string|string]]|""|optional=true}}
Name of [[prototype/Entity]] that can be built using this item. If this item should be the one that construction bots use to build the specified place_result, set the [[Types/ItemPrototypeFlags#"primary-place-result"|primary-place-result]] item flag.
 
The localised name of the entity will be used as the in-game item name. This behavior can be overwritten by specifying <code>localised_name</code> on this item, it will be used instead.
   place_result = "wooden-chest"
   place_result = "wooden-chest"
=== fuel_value ===
 
Amount of energy it gives when used as fuel, reference value is 1 for coal.
{{Prototype property|placed_as_equipment_result|[[Types/string|string]]|""|optional=true}}
Default value is 0 (it can't be used as fuel).
 
  fuel_value = 0.8
{{Prototype property|subgroup|[[Types/string|string]]|"other"|optional=true}}
=== healing_value ===
Name of a [[Prototype/ItemSubGroup]].
Amount of health restored when used.
 
Default value is 0 (So it can't be used this way)
Empty text of subgroup is not allowed. (You can ommit the definition to get the default "other").
  healing_value = 20
 
{{Prototype property|fuel_category|[[Types/string|string]]|""|optional=true}}
Must exist when a fuel_value is defined. Name of one of the [[Prototype/FuelCategory|fuel categories]].
 
{{Prototype property|burnt_result|[[Types/string|string]]|""|optional=true}}
The item that is the result when this item gets burned as fuel.
 
{{Prototype property|place_as_tile|[[Types/PlaceAsTile|PlaceAsTile]]|optional=true}}
 
{{Prototype property|pictures|[[Types/SpriteVariations|SpriteVariations]]|optional=true}}
Used to give the item multiple different icons so that they look less uniform on belts etc. For inventory icons and similar, <code>icon/icons</code> will be used. Maximum number of variations is 16.
 
{{Prototype property|flags|[[Types/ItemPrototypeFlags|ItemPrototypeFlags]]|optional=true}}
Specifies some properties of the item.
  flags = { "hidden" }
 
{{Prototype property|default_request_amount|[[Types/ItemCountType|ItemCountType]]|The stack size of this item.|optional=true}}
 
{{Prototype property|wire_count|[[Types/ItemCountType|ItemCountType]]|0|optional=true}}
The number of items needed to connect 2 entities with this as wire. In the base game, [[green wire]], [[red wire]] and [[copper cable]] have this set to 1.
 
{{Prototype property|fuel_value|[[Types/Energy|Energy]]|"0J"|optional=true}}
Mandatory when fuel_acceleration_multiplier, fuel_top_speed_multiplier, fuel_emissions_multiplier, or fuel_glow_color are used. Amount of energy it gives when used as fuel.
 
{{Prototype property|fuel_acceleration_multiplier|[[Types/double|double]]|1.0|optional=true}}
 
{{Prototype property|fuel_top_speed_multiplier|[[Types/double|double]]|1.0|optional=true}}
 
{{Prototype property|fuel_emissions_multiplier|[[Types/double|double]]|1.0|optional=true}}
 
{{Prototype property|fuel_glow_color|[[Types/Color|Color]]|<nowiki>{r=0, g=0, b=0, a=1}</nowiki>|optional=true}}
Colors the glow of the burner energy source when this fuel is burned. Can also be used to color the glow of reactors burning the fuel, see [[Prototype/Reactor#use_fuel_glow_color]].
 
{{Prototype property|open_sound|[[Types/Sound|Sound]]|optional=true}}
 
{{Prototype property|close_sound|[[Types/Sound|Sound]]|optional=true}}
 
{{Prototype property|dark_background_icons, dark_background_icon,  icon_size (IconSpecification)|[[Types/IconSpecification|IconSpecification]]|optional=true}}
A dark background sprite. Uses <code>dark_background_icons</code> instead of <code>icons</code> and <code>dark_background_icon</code> instead of <code>icon</code>. Inside <code>dark_background_icons</code>, the property for the file path is <code>dark_background_icon</code> instead of <code>icon</code>.
 
{{Prototype property|rocket_launch_products|[[Types/table|table]] (array) of [[Types/ItemProductPrototype|ItemProductPrototype]]|optional=true}}
 
{{Prototype property|rocket_launch_product|[[Types/ItemProductPrototype|ItemProductPrototype]]|optional=true}}

Latest revision as of 10:43, 21 September 2023

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/ItemPrototype.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


Possible configuration for all items.


Prototype/Item — 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

Inherits all properties from PrototypeBase.

icons, icon, icon_size (IconSpecification)

Type: IconSpecification

stack_size

Type: ItemCountType
Count of items of the same name that can be stored in one inventory slot. Must be 1 when the "not-stackable" flag is set.

 stack_size = 64

Optional properties

place_result

Type: string
Default: ""
Name of prototype/Entity that can be built using this item. If this item should be the one that construction bots use to build the specified place_result, set the primary-place-result item flag.

The localised name of the entity will be used as the in-game item name. This behavior can be overwritten by specifying localised_name on this item, it will be used instead.

 place_result = "wooden-chest"

placed_as_equipment_result

Type: string
Default: ""

subgroup

Type: string
Default: "other"
Name of a Prototype/ItemSubGroup.

Empty text of subgroup is not allowed. (You can ommit the definition to get the default "other").

fuel_category

Type: string
Default: ""
Must exist when a fuel_value is defined. Name of one of the fuel categories.

burnt_result

Type: string
Default: ""
The item that is the result when this item gets burned as fuel.

place_as_tile

Type: PlaceAsTile

pictures

Type: SpriteVariations
Used to give the item multiple different icons so that they look less uniform on belts etc. For inventory icons and similar, icon/icons will be used. Maximum number of variations is 16.

flags

Type: ItemPrototypeFlags
Specifies some properties of the item.

 flags = { "hidden" }

default_request_amount

Type: ItemCountType
Default: The stack size of this item.

wire_count

Type: ItemCountType
Default: 0
The number of items needed to connect 2 entities with this as wire. In the base game, green wire, red wire and copper cable have this set to 1.

fuel_value

Type: Energy
Default: "0J"
Mandatory when fuel_acceleration_multiplier, fuel_top_speed_multiplier, fuel_emissions_multiplier, or fuel_glow_color are used. Amount of energy it gives when used as fuel.

fuel_acceleration_multiplier

Type: double
Default: 1.0

fuel_top_speed_multiplier

Type: double
Default: 1.0

fuel_emissions_multiplier

Type: double
Default: 1.0

fuel_glow_color

Type: Color
Default: {r=0, g=0, b=0, a=1}
Colors the glow of the burner energy source when this fuel is burned. Can also be used to color the glow of reactors burning the fuel, see Prototype/Reactor#use_fuel_glow_color.

open_sound

Type: Sound

close_sound

Type: Sound

dark_background_icons, dark_background_icon, icon_size (IconSpecification)

Type: IconSpecification
A dark background sprite. Uses dark_background_icons instead of icons and dark_background_icon instead of icon. Inside dark_background_icons, the property for the file path is dark_background_icon instead of icon.

rocket_launch_products

Type: table (array) of ItemProductPrototype

rocket_launch_product

Type: ItemProductPrototype