Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Runtime Docs Version 2.0.77

# LuaItemPrototype - Runtime Docs

## Class LuaItemPrototype extends LuaPrototypeBase

Prototype of an item. For example, an item prototype can be obtained from LuaPrototypes::item by its name: `prototypes.item["iron-plate"]`.

Inherits from LuaPrototypeBase

## Members

has_flag(flag) | → boolean | Test whether this item prototype has a certain flag set.
Test whether this item prototype has a certain flag set.
get_spoil_ticks(quality?) | → uint32 | The number of ticks before this item spoils, or `0` if it does not spoil.
The number of ticks before this item spoils, or `0` if it does not spoil.
get_ammo_type(ammo_source_type?) | → AmmoType? | The type of this ammo prototype.
The type of this ammo prototype.
get_inventory_size_bonus(quality?) | → uint32? | The inventory size bonus for this armor prototype.
The inventory size bonus for this armor prototype.
get_module_effects(quality?) | → ModuleEffects? | Effects of this module at the specified quality.
Effects of this module at the specified quality.
get_selection_border_color(selection_mode) | → Color? | The color used when doing normal selection with this selection tool prototype.
The color used when doing normal selection with this selection tool prototype.
get_selection_mode_flags(selection_mode) | → SelectionModeFlags? | Flags that affect which entities will be selected.
Flags that affect which entities will be selected.
get_cursor_box_type(selection_mode) | → CursorBoxRenderType? |
get_entity_filter_mode(selection_mode) | → PrototypeFilterMode? | The entity filter mode used by this selection tool.
The entity filter mode used by this selection tool.
get_tile_filter_mode(selection_mode) | → PrototypeFilterMode? | The tile filter mode used by this selection tool.
The tile filter mode used by this selection tool.
get_entity_filters(selection_mode) | → array[LuaEntityPrototype]? | The entity filters used by this selection tool.
The entity filters used by this selection tool.
get_entity_type_filters(selection_mode) | → dictionary[string → `true`]? | The entity type filters used by this selection tool indexed by entity type. [...]
The entity type filters used by this selection tool indexed by entity type. [...]
get_tile_filters(selection_mode) | → array[LuaTilePrototype]? | The tile filters used by this selection tool.
The tile filters used by this selection tool.
get_durability(quality?) | → double? | The durability of this tool item prototype.
The durability of this tool item prototype.
place_result | :: R LuaEntityPrototype? | Prototype of the entity that will be created by placing this item, if any.
Prototype of the entity that will be created by placing this item, if any.
place_as_equipment_result | :: R LuaEquipmentPrototype? | Prototype of the equipment that will be created by placing this item in an equipment grid, if any.
Prototype of the equipment that will be created by placing this item in an equipment grid, if any.
place_as_tile_result | :: R PlaceAsTileResult? | The place-as-tile result if one is defined, if any.
The place-as-tile result if one is defined, if any.
stackable | :: R boolean | Is this item allowed to stack at all?
Is this item allowed to stack at all?
stack_size | :: R uint32 | Maximum stack size of the item specified by this prototype.
Maximum stack size of the item specified by this prototype.
fuel_category | :: R string? | The fuel category, if any.
The fuel category, if any.
burnt_result | :: R LuaItemPrototype? | The result of burning this item as fuel, if any.
The result of burning this item as fuel, if any.
fuel_value | :: R float | Fuel value when burned.
Fuel value when burned.
fuel_acceleration_multiplier | :: R double | The acceleration multiplier when this item is used as fuel in a vehicle.
The acceleration multiplier when this item is used as fuel in a vehicle.
fuel_top_speed_multiplier | :: R double | The fuel top speed multiplier when this item is used as fuel in a vehicle.
The fuel top speed multiplier when this item is used as fuel in a vehicle.
fuel_emissions_multiplier | :: R double | The emissions multiplier if this is used as fuel.
The emissions multiplier if this is used as fuel.
fuel_acceleration_multiplier_quality_bonus | :: R double | Additional fuel acceleration multiplier per quality level.
Additional fuel acceleration multiplier per quality level.
fuel_top_speed_multiplier_quality_bonus | :: R double | Additional fuel top speed multiplier per quality level.
Additional fuel top speed multiplier per quality level.
flags | :: R ItemPrototypeFlags | The flags for this item prototype.
The flags for this item prototype.
rocket_launch_products | :: R array[Product] | The results of launching this item in a rocket.
The results of launching this item in a rocket.
send_to_orbit_mode | :: R `"not-sendable"` or `"manual"` or `"automated"` | How this item interacts when being sent to orbit.
How this item interacts when being sent to orbit.
can_be_mod_opened | :: R boolean | If this item can be mod-opened.
If this item can be mod-opened.
spoil_result | :: R LuaItemPrototype? | The spoil result of this item, if any
The spoil result of this item, if any
plant_result | :: R LuaEntityPrototype? | The result entity when planting this item as a seed.
The result entity when planting this item as a seed.
spoil_to_trigger_result | :: R SpoilToTriggerResult? |
destroyed_by_dropping_trigger | :: R array[TriggerItem]? |
weight | :: R Weight | Weight of this item. [...]
Weight of this item. [...]
ingredient_to_weight_coefficient | :: R double |
fuel_glow_color | :: R Color? |
default_import_location | :: R LuaSpaceLocationPrototype |
factoriopedia_alternative | :: R LuaItemPrototype? | An alternative prototype that will be used to display info about this prototype in Factoriopedia.
An alternative prototype that will be used to display info about this prototype in Factoriopedia.
moved_to_hub_when_building | :: R boolean |
ammo_category | :: R LuaAmmoCategoryPrototype? |
magazine_size | :: R float? | Size of full magazine.
Size of full magazine.
reload_time | :: R float? | Amount of extra time (in ticks) it takes to reload the weapon after depleting the magazine.
Amount of extra time (in ticks) it takes to reload the weapon after depleting the magazine.
equipment_grid | :: R LuaEquipmentGridPrototype? | The prototype of this armor's equipment grid, if any.
The prototype of this armor's equipment grid, if any.
resistances | :: R dictionary[string → Resistance]? | Resistances of this armor item, if any, indexed by damage type name.
Resistances of this armor item, if any, indexed by damage type name.
collision_box | :: R BoundingBox? | The collision box used by character entities when wearing this armor.
The collision box used by character entities when wearing this armor.
drawing_box | :: R BoundingBox? | The drawing box used by character entities when wearing this armor.
The drawing box used by character entities when wearing this armor.
provides_flight | :: R boolean? | If this armor provides flight to character entities when worm.
If this armor provides flight to character entities when worm.
capsule_action | :: R CapsuleAction? | The capsule action for this capsule item prototype.
The capsule action for this capsule item prototype.
radius_color | :: R Color? |
attack_parameters | :: R AttackParameters? | The gun attack parameters.
The gun attack parameters.
inventory_size | :: R uint32? | The main inventory size for item-with-inventory-prototype.
The main inventory size for item-with-inventory-prototype.
item_filters | :: R array[LuaItemPrototype]? |
item_group_filters | :: R array[LuaGroup]? |
item_subgroup_filters | :: R array[LuaGroup]? |
filter_mode | :: R PrototypeFilterMode? | The filter mode used by this item with inventory.
The filter mode used by this item with inventory.
localised_filter_message | :: R LocalisedString? | The localised string used when the player attempts to put items into this item with inventory that aren't allowed.
The localised string used when the player attempts to put items into this item with inventory that aren't allowed.
default_label_color | :: R Color? | The default label color used for this item with label, if any.
The default label color used for this item with label, if any.
draw_label_for_cursor_render | :: R boolean? | If true, and this item with label has a label it is drawn in place of the normal number when held in the cursor.
If true, and this item with label has a label it is drawn in place of the normal number when held in the cursor.
speed | :: R float? | The repairing speed if this is a repairing tool.
The repairing speed if this is a repairing tool.
module_effects | :: R ModuleEffects? | Effects of this module.
Effects of this module.
category | :: R string? | The name of a LuaModuleCategoryPrototype. [...]
The name of a LuaModuleCategoryPrototype. [...]
tier | :: R uint32? | Tier of the module inside its category. [...]
Tier of the module inside its category. [...]
requires_beacon_alt_mode | :: R boolean? |
beacon_tint | :: R array[Color]? |
rails | :: R array[LuaEntityPrototype]? | Prototypes of all rails possible to be used by this rail planner prototype.
Prototypes of all rails possible to be used by this rail planner prototype.
support | :: R LuaEntityPrototype? | The rail support used by this rail planner.
The rail support used by this rail planner.
manual_length_limit | :: R double? |
always_include_tiles | :: R boolean? | If tiles area always included when doing selection with this selection tool prototype.
If tiles area always included when doing selection with this selection tool prototype.
skip_fog_of_war | :: R boolean? | If this selection tool skips things covered by fog of war.
If this selection tool skips things covered by fog of war.
entity_filter_slots | :: R uint32? | The number of entity filters this deconstruction item has.
The number of entity filters this deconstruction item has.
tile_filter_slots | :: R uint32? | The number of tile filters this deconstruction item has.
The number of tile filters this deconstruction item has.
durability_description_key | :: R string? | The durability message key used when displaying the durability of this tool.
The durability message key used when displaying the durability of this tool.
factoriopedia_durability_description_key | :: R string? | The durability message key used when displaying the durability of this tool in Factoriopedia.
The durability message key used when displaying the durability of this tool in Factoriopedia.
durability_description_value | :: R string? | The durability message value used when displaying the durability of this tool.
The durability message value used when displaying the durability of this tool.
infinite | :: R boolean? | If this tool item has infinite durability.
If this tool item has infinite durability.
trigger | :: R TriggerItem? |
surface | :: R LuaSurfacePrototype? |
create_electric_network | :: R boolean? |
tiles | :: R array[SpacePlatformTileDefinition]? |
initial_items | :: R array[ItemProduct]? |
valid | :: R boolean | Is this object valid? [...]
Is this object valid? [...]
object_name | :: R string | The class name of this object. [...]
The class name of this object. [...]

Inherited from LuaPrototypeBase

type | :: R string | Type of this prototype.
Type of this prototype.
name | :: R string | Name of this prototype.
Name of this prototype.
order | :: R string | The string used to alphabetically sort these prototypes. [...]
The string used to alphabetically sort these prototypes. [...]
localised_name | :: R LocalisedString |
localised_description | :: R LocalisedString |
factoriopedia_description | :: R LocalisedString | Provides additional description used in factoriopedia.
Provides additional description used in factoriopedia.
group | :: R LuaGroup | Group of this prototype.
Group of this prototype.
subgroup | :: R LuaGroup | Subgroup of this prototype.
Subgroup of this prototype.
hidden | :: R boolean |
hidden_in_factoriopedia | :: R boolean |
parameter | :: R boolean |
custom_tooltip_fields | :: R array[CustomTooltipField]? | Extra description items in the tooltip and Factoriopedia.
Extra description items in the tooltip and Factoriopedia.

## Methods

### has_flag(flag) → boolean

Test whether this item prototype has a certain flag set.

#### Parameters

flag | :: ItemPrototypeFlag | The flag to test.
The flag to test.

### get_spoil_ticks(quality?) → uint32

The number of ticks before this item spoils, or `0` if it does not spoil.

#### Parameters

quality | :: QualityID? |

### get_ammo_type(ammo_source_type?) → AmmoType?

The type of this ammo prototype.

#### Parameters

ammo_source_type | :: `"default"` or `"player"` or `"turret"` or `"vehicle"`? | Defaults to `"default"`.
Defaults to `"default"`.

Can only be used if this is AmmoItem

### get_inventory_size_bonus(quality?) → uint32?

The inventory size bonus for this armor prototype.

#### Parameters

quality | :: QualityID? |

Can only be used if this is ArmorPrototype

### get_module_effects(quality?) → ModuleEffects?

Effects of this module at the specified quality.

#### Parameters

quality | :: QualityID? |

Can only be used if this is ModuleItem

### get_selection_border_color(selection_mode) → Color?

The color used when doing normal selection with this selection tool prototype.

#### Parameters

selection_mode | :: defines.selection_mode |

Can only be used if this is SelectionTool

### get_selection_mode_flags(selection_mode) → SelectionModeFlags?

Flags that affect which entities will be selected.

#### Parameters

selection_mode | :: defines.selection_mode |

Can only be used if this is SelectionTool

### get_cursor_box_type(selection_mode) → CursorBoxRenderType?

#### Parameters

selection_mode | :: defines.selection_mode |

Can only be used if this is SelectionTool

### get_entity_filter_mode(selection_mode) → PrototypeFilterMode?

The entity filter mode used by this selection tool.

#### Parameters

selection_mode | :: defines.selection_mode |

Can only be used if this is SelectionTool

### get_tile_filter_mode(selection_mode) → PrototypeFilterMode?

The tile filter mode used by this selection tool.

#### Parameters

selection_mode | :: defines.selection_mode |

Can only be used if this is SelectionTool

### get_entity_filters(selection_mode) → array[LuaEntityPrototype]?

The entity filters used by this selection tool.

#### Parameters

selection_mode | :: defines.selection_mode |

Can only be used if this is SelectionTool

### get_entity_type_filters(selection_mode) → dictionary[string → `true`]?

The entity type filters used by this selection tool indexed by entity type.

The boolean value is meaningless and is used to allow easy lookup if a type exists in the dictionary.

#### Parameters

selection_mode | :: defines.selection_mode |

Can only be used if this is SelectionTool

### get_tile_filters(selection_mode) → array[LuaTilePrototype]?

The tile filters used by this selection tool.

#### Parameters

selection_mode | :: defines.selection_mode |

Can only be used if this is SelectionTool

### get_durability(quality?) → double?

The durability of this tool item prototype.

#### Parameters

quality | :: QualityID? |

Can only be used if this is ToolItem

## Attributes

### place_result :: Read LuaEntityPrototype?

Prototype of the entity that will be created by placing this item, if any.

### place_as_equipment_result :: Read LuaEquipmentPrototype?

Prototype of the equipment that will be created by placing this item in an equipment grid, if any.

### place_as_tile_result :: Read PlaceAsTileResult?

The place-as-tile result if one is defined, if any.

### stackable :: Read boolean

Is this item allowed to stack at all?

### stack_size :: Read uint32

Maximum stack size of the item specified by this prototype.

### fuel_category :: Read string?

The fuel category, if any.

### burnt_result :: Read LuaItemPrototype?

The result of burning this item as fuel, if any.

### fuel_value :: Read float

Fuel value when burned.

### fuel_acceleration_multiplier :: Read double

The acceleration multiplier when this item is used as fuel in a vehicle.

### fuel_top_speed_multiplier :: Read double

The fuel top speed multiplier when this item is used as fuel in a vehicle.

### fuel_emissions_multiplier :: Read double

The emissions multiplier if this is used as fuel.

### fuel_acceleration_multiplier_quality_bonus :: Read double

Additional fuel acceleration multiplier per quality level.

### fuel_top_speed_multiplier_quality_bonus :: Read double

Additional fuel top speed multiplier per quality level.

### flags :: Read ItemPrototypeFlags

The flags for this item prototype.

### rocket_launch_products :: Read array[Product]

The results of launching this item in a rocket.

### send_to_orbit_mode :: Read `"not-sendable"` or `"manual"` or `"automated"`

How this item interacts when being sent to orbit.

### can_be_mod_opened :: Read boolean

If this item can be mod-opened.

### spoil_result :: Read LuaItemPrototype?

The spoil result of this item, if any

### plant_result :: Read LuaEntityPrototype?

The result entity when planting this item as a seed.

### spoil_to_trigger_result :: Read SpoilToTriggerResult?

### destroyed_by_dropping_trigger :: Read array[TriggerItem]?

### weight :: Read Weight

Weight of this item. More information on how item weight is determined can be found on its auxiliary page.

### ingredient_to_weight_coefficient :: Read double

### fuel_glow_color :: Read Color?

### default_import_location :: Read LuaSpaceLocationPrototype

### factoriopedia_alternative :: Read LuaItemPrototype?

An alternative prototype that will be used to display info about this prototype in Factoriopedia.

### moved_to_hub_when_building :: Read boolean

### ammo_category :: Read LuaAmmoCategoryPrototype?

Can only be used if this is AmmoItem

### magazine_size :: Read float?

Size of full magazine.

Can only be used if this is AmmoItem

### reload_time :: Read float?

Amount of extra time (in ticks) it takes to reload the weapon after depleting the magazine.

Can only be used if this is AmmoItem

### equipment_grid :: Read LuaEquipmentGridPrototype?

The prototype of this armor's equipment grid, if any.

Can only be used if this is Armor

### resistances :: Read dictionary[string → Resistance]?

Resistances of this armor item, if any, indexed by damage type name.

Can only be used if this is Armor

### collision_box :: Read BoundingBox?

The collision box used by character entities when wearing this armor.

Can only be used if this is ArmorPrototype

### drawing_box :: Read BoundingBox?

The drawing box used by character entities when wearing this armor.

Can only be used if this is ArmorPrototype

### provides_flight :: Read boolean?

If this armor provides flight to character entities when worm.

Can only be used if this is ArmorPrototype

### capsule_action :: Read CapsuleAction?

The capsule action for this capsule item prototype.

Can only be used if this is Capsule

### radius_color :: Read Color?

Can only be used if this is Capsule

### attack_parameters :: Read AttackParameters?

The gun attack parameters.

Can only be used if this is Gun

### inventory_size :: Read uint32?

The main inventory size for item-with-inventory-prototype.

Can only be used if this is ItemWithInventoryPrototype

### item_filters :: Read array[LuaItemPrototype]?

Can only be used if this is ItemWithInventory

### item_group_filters :: Read array[LuaGroup]?

Can only be used if this is ItemWithInventory

### item_subgroup_filters :: Read array[LuaGroup]?

Can only be used if this is ItemWithInventory

### filter_mode :: Read PrototypeFilterMode?

The filter mode used by this item with inventory.

Can only be used if this is ItemWithInventory

### localised_filter_message :: Read LocalisedString?

The localised string used when the player attempts to put items into this item with inventory that aren't allowed.

Can only be used if this is ItemWithInventory

### default_label_color :: Read Color?

The default label color used for this item with label, if any.

Can only be used if this is ItemWithLabel

### draw_label_for_cursor_render :: Read boolean?

If true, and this item with label has a label it is drawn in place of the normal number when held in the cursor.

Can only be used if this is ItemWithLabel

### speed :: Read float?

The repairing speed if this is a repairing tool.

Can only be used if this is RepairTool

### module_effects :: Read ModuleEffects?

Effects of this module.

Can only be used if this is ModuleItem

### category :: Read string?

The name of a LuaModuleCategoryPrototype. Used when upgrading modules: Ctrl + click modules into an entity and it will replace lower tier modules of the same category with higher tier modules.

Can only be used if this is ModuleItem

### tier :: Read uint32?

Tier of the module inside its category. Used when upgrading modules: Ctrl + click modules into an entity and it will replace lower tier modules with higher tier modules if they have the same category.

Can only be used if this is ModuleItem

### requires_beacon_alt_mode :: Read boolean?

Can only be used if this is ModuleItem

### beacon_tint :: Read array[Color]?

Can only be used if this is ModuleItem

### rails :: Read array[LuaEntityPrototype]?

Prototypes of all rails possible to be used by this rail planner prototype.

Can only be used if this is RailPlanner

### support :: Read LuaEntityPrototype?

The rail support used by this rail planner.

Can only be used if this is RailPlanner

### manual_length_limit :: Read double?

Can only be used if this is RailPlanner

### always_include_tiles :: Read boolean?

If tiles area always included when doing selection with this selection tool prototype.

Can only be used if this is SelectionTool

### skip_fog_of_war :: Read boolean?

If this selection tool skips things covered by fog of war.

Can only be used if this is SelectionTool

### entity_filter_slots :: Read uint32?

The number of entity filters this deconstruction item has.

Can only be used if this is DeconstructionItem

### tile_filter_slots :: Read uint32?

The number of tile filters this deconstruction item has.

Can only be used if this is DeconstructionItem

### durability_description_key :: Read string?

The durability message key used when displaying the durability of this tool.

Can only be used if this is ToolItem

### factoriopedia_durability_description_key :: Read string?

The durability message key used when displaying the durability of this tool in Factoriopedia.

Can only be used if this is ToolItem

### durability_description_value :: Read string?

The durability message value used when displaying the durability of this tool.

Can only be used if this is ToolItem

### infinite :: Read boolean?

If this tool item has infinite durability.

Can only be used if this is ToolItem

### trigger :: Read TriggerItem?

Can only be used if this is SpacePlatformStarterPack

### surface :: Read LuaSurfacePrototype?

Can only be used if this is SpacePlatformStarterPack

### create_electric_network :: Read boolean?

Can only be used if this is SpacePlatformStarterPack

### tiles :: Read array[SpacePlatformTileDefinition]?

Can only be used if this is SpacePlatformStarterPack

### initial_items :: Read array[ItemProduct]?

Can only be used if this is SpacePlatformStarterPack

### valid :: Read boolean

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.

### object_name :: Read string

The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.

Class used in

- LuaAchievementPrototype::dont_research
- LuaAchievementPrototype::research_with
- LuaAchievementPrototype::armor
- LuaAchievementPrototype::alternative_armor
- LuaAchievementPrototype::module
- LuaAchievementPrototype::item_product
- LuaAchievementPrototype::science_pack
- LuaAchievementPrototype::ammo_type
- LuaAchievementPrototype::to_use
- LuaAsteroidChunkPrototype::item_signal_alias
- LuaBurnerPrototype::initial_fuel
- LuaCustomInputPrototype::item_to_spawn
- LuaEntityPrototype::guns
- LuaEntityPrototype::indexed_guns
- LuaEquipmentPrototype::take_result
- LuaItem::prototype
- LuaItemPrototype::burnt_result
- LuaItemPrototype::spoil_result
- LuaItemPrototype::factoriopedia_alternative
- LuaItemPrototype::item_filters
- LuaItemStack::prototype
- LuaPrototypes::get_item_filtered()
- LuaPrototypes::item
- LuaRecipePrototype::trash
- LuaShortcutPrototype::item_to_spawn
- FactoriopediaID
- ItemID
- ItemWithQualityID
- PipetteID
- WorkerRobotOrder
- on_mod_item_opened
- on_player_built_tile
- on_player_pipette
- on_player_used_capsule
- on_pre_robot_exploded_cliff
- on_robot_built_tile
- on_robot_exploded_cliff
- on_space_platform_built_tile