Factorio.com|Forums|Wiki|Mod Portal|API Docs Prototype|Runtime|Auxiliary

# Factorio Runtime Docs Version 2.0.7

## Class LuaItemPrototype extends LuaPrototypeBase changed

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

## 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?) new | → uint | 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?) new | → uint? | The inventory size bonus for this armor prototype.
The inventory size bonus for this armor prototype.
get_selection_border_color(selection_mode) new | → 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) new | → SelectionModeFlags? | Flags that affect which entities will be selected.
Flags that affect which entities will be selected.
get_cursor_box_type(selection_mode) new | → CursorBoxRenderType? |
get_entity_filter_mode(selection_mode) new | → 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) new | → PrototypeFilterMode? | The tile filter mode used by this selection tool.
The tile filter mode used by this selection tool.
get_entity_filters(selection_mode) new | → array[LuaEntityPrototype]? | The entity filters used by this selection tool.
The entity filters used by this selection tool.
get_entity_type_filters(selection_mode) new | → 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) new | → array[LuaTilePrototype]? | The tile filters used by this selection tool.
The tile filters used by this selection tool.
get_durability(quality?) new | → 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 uint | 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 new | :: R double | Additional fuel acceleration multiplier per quality level.
Additional fuel acceleration multiplier per quality level.
fuel_top_speed_multiplier_quality_bonus new | :: 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.
can_be_mod_opened | :: R boolean | If this item can be mod-opened.
If this item can be mod-opened.
spoil_result new | :: R LuaItemPrototype? | The spoil result of this item, if any
The spoil result of this item, if any
plant_result new | :: 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 new | :: R SpoilToTriggerResult? |
destroyed_by_dropping_trigger new | :: R array[TriggerItem] ? |
weight new | :: R double | Weight of this item
Weight of this item
ingredient_to_weight_coefficient new | :: R double |
fuel_glow_color new | :: R Color? |
default_import_location new | :: R LuaSpaceLocationPrototype |
ammo_category new | :: 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 new | :: 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 new | :: 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 new | :: 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 new | :: R Color? |
attack_parameters | :: R AttackParameters? | The gun attack parameters.
The gun attack parameters.
inventory_size | :: R uint? | The main inventory size for item-with-inventory-prototype.
The main inventory size for item-with-inventory-prototype.
item_filters changed | :: R array[LuaItemPrototype] ? |
item_group_filters changed | :: R array[LuaGroup] ? |
item_subgroup_filters changed | :: R array[LuaGroup] ? |
filter_mode | :: R `"none"` or `"whitelist"` or `"blacklist"`? | 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 uint? | Tier of the module inside its category. [...]
Tier of the module inside its category. [...]
requires_beacon_alt_mode new | :: R boolean? |
beacon_tint new | :: R array[Color] ? |
rails new | :: 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 new | :: R LuaEntityPrototype? | The rail support used by this rail planner.
The rail support used by this rail planner.
manual_length_limit new | :: 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 new | :: 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 uint? | The number of entity filters this deconstruction item has.
The number of entity filters this deconstruction item has.
tile_filter_slots | :: R uint? | 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.
durability_description_value new | :: 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.
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 |
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 |

## 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?) → uint new

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?) → uint?new

The inventory size bonus for this armor prototype.

#### Parameters

quality | :: QualityID? |

Can only be used if this is ArmorPrototype

### get_selection_border_color(selection_mode) → Color?new

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?new

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?new

#### Parameters

selection_mode | :: defines.selection_mode |

Can only be used if this is SelectionTool

### get_entity_filter_mode(selection_mode) → PrototypeFilterMode?new

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?new

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]?new

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`]?new

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]?new

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?new

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 uint

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 new

Additional fuel acceleration multiplier per quality level.

### fuel_top_speed_multiplier_quality_bonus :: Read double new

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.

### can_be_mod_opened :: Read boolean

If this item can be mod-opened.

### spoil_result :: Read LuaItemPrototype?new

The spoil result of this item, if any

### plant_result :: Read LuaEntityPrototype?new

The result entity when planting this item as a seed.

### spoil_to_trigger_result :: Read SpoilToTriggerResult?new

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

### weight :: Read double new

Weight of this item

### ingredient_to_weight_coefficient :: Read double new

### fuel_glow_color :: Read Color?new

### default_import_location :: Read LuaSpaceLocationPrototype new

### ammo_category :: Read LuaAmmoCategoryPrototype?new

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?new

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

Can only be used if this is ArmorPrototype

### drawing_box :: Read BoundingBox?new

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

Can only be used if this is ArmorPrototype

### provides_flight :: Read boolean?new

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?new

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 uint?

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

Can only be used if this is ItemWithInventoryPrototype

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

Can only be used if this is ItemWithInventory

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

Can only be used if this is ItemWithInventory

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

Can only be used if this is ItemWithInventory

### filter_mode :: Read `"none"` or `"whitelist"` or `"blacklist"`?

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 uint?

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?new

Can only be used if this is ModuleItem

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

Can only be used if this is ModuleItem

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

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

Can only be used if this is RailPlanner

### support :: Read LuaEntityPrototype?new

The rail support used by this rail planner.

Can only be used if this is RailPlanner

### manual_length_limit :: Read double?new

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?new

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

Can only be used if this is SelectionTool

### entity_filter_slots :: Read uint?

The number of entity filters this deconstruction item has.

Can only be used if this is DeconstructionItem

### tile_filter_slots :: Read uint?

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

### durability_description_value :: Read string?new

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

### 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.