Factorio API Docs

1.1.70 <>

Class LuaItemPrototype

Prototype of an item.

Example

game.item_prototypes["iron-plate"]
has_flag(flag)
boolean

Does this prototype have a flag enabled?


get_ammo_type(ammo_source_type?)
AmmoType?

The type of this ammo prototype.


help()
string

All methods and properties that this object supports.


:: string
[R]

Type of this prototype.


:: string
[R]

Name of this prototype.




:: string
[R]

The string used to alphabetically sort these prototypes.


[R]

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


[R]

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


[R]

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


:: boolean
[R]

Is this item allowed to stack at all?


:: uint
[R]

The default request value.


:: uint
[R]

Maximum stack size of the item specified by this prototype.


:: uint
[R]

The number of items needed to connect two entities with this as wire.


:: string?
[R]

The fuel category of this item prototype, if any.


[R]

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


:: float
[R]

Fuel value when burned.


:: double
[R]

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


:: double
[R]

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


:: double
[R]

The emissions multiplier if this is used as fuel.


[R]

The subgroup this prototype belongs to.


[R]

The group this prototype belongs to.


[R]

The flags for this item prototype.


:: array[Product]
[R]

The results of launching this item in a rocket.


:: boolean
[R]

If this item can be mod-opened.


:: float?
[R]

Size of full magazine.


:: float?
[R]

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


[R]

The prototype of this armor equipment grid, if any.


:: dictionary[stringResistance]?
[R]

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


:: uint?
[R]

The inventory size bonus for this armor prototype.


[R]

The capsule action for this capsule item prototype.


[R]

The gun attack parameters.


:: uint?
[R]

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


:: dictionary[stringLuaItemPrototype]?
[R]

:: dictionary[stringLuaGroup]?
[R]

:: dictionary[stringLuaGroup]?
[R]

:: string?
[R]

The filter mode used by this item with inventory.


:: string?
[R]

The insertion priority mode used by this item with inventory.


[R]

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


:: boolean?
[R]

If this item with inventory extends the inventory it resides in by default.


:: Color?
[R]

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


:: boolean?
[R]

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


:: float?
[R]

The repairing speed if this is a repairing tool.


[R]

Effects of this module.


:: string?
[R]

The name of a LuaModuleCategoryPrototype.


:: uint?
[R]

Tier of the module inside its category.


:: array[string]?
[R]

An array of recipe names this module is allowed to work with.


:: string?
[R]

The limitation message key used when the player attempts to use this modules in some place it's not allowed.


[R]

The straight rail prototype used for this rail planner prototype.


[R]

The curved rail prototype used for this rail planner prototype.


:: array[TriggerItem]?
[R]

The repair result of this repair tool prototype.


:: Color?
[R]

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


:: Color?
[R]

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


:: Color?
[R]

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


[R]

Flags that affect which entities will be selected.


[R]

Flags that affect which entities will be selected during alternate selection.


[R]

Flags that affect which entities will be selected during reverse selection.





:: boolean?
[R]

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


:: string?
[R]

The entity filter mode used by this selection tool.


:: string?
[R]

The alt entity filter mode used by this selection tool.


:: string?
[R]

The reverse entity filter mode used by this selection tool.


:: string?
[R]

The tile filter mode used by this selection tool.


:: string?
[R]

The alt tile filter mode used by this selection tool.


:: string?
[R]

The reverse tile filter mode used by this selection tool.


:: dictionary[stringLuaEntityPrototype]?
[R]

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


:: dictionary[stringLuaEntityPrototype]?
[R]

The alt entity filters used by this selection tool indexed by entity name.


:: dictionary[stringLuaEntityPrototype]?
[R]

The reverse entity filters used by this selection tool indexed by entity name.


:: dictionary[stringboolean]?
[R]

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


:: dictionary[stringboolean]?
[R]

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


:: dictionary[stringboolean]?
[R]

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


:: dictionary[stringLuaTilePrototype]?
[R]

The tile filters used by this selection tool indexed by tile name.


:: dictionary[stringLuaTilePrototype]?
[R]

The alt tile filters used by this selection tool indexed by tile name.


:: dictionary[stringLuaTilePrototype]?
[R]

The reverse tile filters used by this selection tool indexed by tile name.


:: uint?
[R]

The number of entity filters this deconstruction item has.


:: uint?
[R]

The number of tile filters this deconstruction item has.


:: string?
[R]

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


:: double?
[R]

The durability of this tool item.


:: boolean?
[R]

If this tool item has infinite durability.


:: uint?
[R]

How many filters an upgrade item has.


:: boolean
[R]

Is this object valid?


:: string
[R]

The class name of this object.

Methods

has_flag (flag) → boolean

Does this prototype have a flag enabled?

Parameters

flag
:: string

The flag to check. Can be one of ItemPrototypeFlags. Any other value will cause an error.


get_ammo_type (ammo_source_type?) → AmmoType?

The type of this ammo prototype.

Parameters

ammo_source_type
:: string?

One of "default", "player", "turret", or "vehicle". Defaults to "default".

Can only be used if this is AmmoItem

help () → string

All methods and properties that this object supports.

Attributes

type :: string [Read]

Type of this prototype. E.g. "gun" or "mining-tool".


name :: string [Read]

Name of this prototype.


localised_name :: LocalisedString [Read]


localised_description :: LocalisedString [Read]


order :: string [Read]

The string used to alphabetically sort these prototypes. It is a simple string that has no additional semantic meaning.


place_result :: LuaEntityPrototype? [Read]

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


place_as_equipment_result :: LuaEquipmentPrototype? [Read]

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


place_as_tile_result :: PlaceAsTileResult? [Read]

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


stackable :: boolean [Read]

Is this item allowed to stack at all?


default_request_amount :: uint [Read]

The default request value.


stack_size :: uint [Read]

Maximum stack size of the item specified by this prototype.


wire_count :: uint [Read]

The number of items needed to connect two entities with this as wire.


fuel_category :: string? [Read]

The fuel category of this item prototype, if any.


burnt_result :: LuaItemPrototype? [Read]

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


fuel_value :: float [Read]

Fuel value when burned.


fuel_acceleration_multiplier :: double [Read]

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


fuel_top_speed_multiplier :: double [Read]

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


fuel_emissions_multiplier :: double [Read]

The emissions multiplier if this is used as fuel.


subgroup :: LuaGroup [Read]

The subgroup this prototype belongs to.


group :: LuaGroup [Read]

The group this prototype belongs to.


flags :: ItemPrototypeFlags [Read]

The flags for this item prototype.


rocket_launch_products :: array[Product] [Read]

The results of launching this item in a rocket.


can_be_mod_opened :: boolean [Read]

If this item can be mod-opened.


magazine_size :: float? [Read]

Size of full magazine.

Can only be used if this is AmmoItem

reload_time :: float? [Read]

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 :: LuaEquipmentGridPrototype? [Read]

The prototype of this armor equipment grid, if any.

Can only be used if this is Armor

resistances :: dictionary[stringResistance]? [Read]

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

Can only be used if this is Armor

inventory_size_bonus :: uint? [Read]

The inventory size bonus for this armor prototype.

Can only be used if this is ArmorPrototype

capsule_action :: CapsuleAction? [Read]

The capsule action for this capsule item prototype.

Can only be used if this is Capsule

attack_parameters :: AttackParameters? [Read]

The gun attack parameters.

Can only be used if this is Gun

inventory_size :: uint? [Read]

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

Can only be used if this is ItemWithInventoryPrototype

item_filters :: dictionary[stringLuaItemPrototype]? [Read]

Can only be used if this is ItemWithInventory

item_group_filters :: dictionary[stringLuaGroup]? [Read]

Can only be used if this is ItemWithInventory

item_subgroup_filters :: dictionary[stringLuaGroup]? [Read]

Can only be used if this is ItemWithInventory

filter_mode :: string? [Read]

The filter mode used by this item with inventory.

Can only be used if this is ItemWithInventory

insertion_priority_mode :: string? [Read]

The insertion priority mode used by this item with inventory.

Can only be used if this is ItemWithInventory

localised_filter_message :: LocalisedString? [Read]

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

extend_inventory_by_default :: boolean? [Read]

If this item with inventory extends the inventory it resides in by default.

Can only be used if this is ItemWithInventory

default_label_color :: Color? [Read]

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 :: boolean? [Read]

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 :: float? [Read]

The repairing speed if this is a repairing tool.

Can only be used if this is RepairTool

module_effects :: ModuleEffects? [Read]

Effects of this module.

Can only be used if this is ModuleItem

category :: string? [Read]

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 :: uint? [Read]

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

limitations :: array[string]? [Read]

An array of recipe names this module is allowed to work with. Empty when all recipes are allowed.

Can only be used if this is ModuleItem

limitation_message_key :: string? [Read]

The limitation message key used when the player attempts to use this modules in some place it's not allowed.

Can only be used if this is ModuleItem

straight_rail :: LuaEntityPrototype? [Read]

The straight rail prototype used for this rail planner prototype.

Can only be used if this is RailPlanner

curved_rail :: LuaEntityPrototype? [Read]

The curved rail prototype used for this rail planner prototype.

Can only be used if this is RailPlanner

repair_result :: array[TriggerItem]? [Read]

The repair result of this repair tool prototype.

Can only be used if this is RepairTool

selection_border_color :: Color? [Read]

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

Can only be used if this is SelectionTool

alt_selection_border_color :: Color? [Read]

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

Can only be used if this is SelectionTool

reverse_selection_border_color :: Color? [Read]

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

Can only be used if this is SelectionTool

selection_mode_flags :: SelectionModeFlags? [Read]

Flags that affect which entities will be selected.

Can only be used if this is SelectionTool

alt_selection_mode_flags :: SelectionModeFlags? [Read]

Flags that affect which entities will be selected during alternate selection.

Can only be used if this is SelectionTool

reverse_selection_mode_flags :: SelectionModeFlags? [Read]

Flags that affect which entities will be selected during reverse selection.

Can only be used if this is SelectionTool

selection_cursor_box_type :: string? [Read]

Can only be used if this is SelectionTool

alt_selection_cursor_box_type :: string? [Read]

Can only be used if this is SelectionTool

reverse_selection_cursor_box_type :: string? [Read]

Can only be used if this is SelectionTool

always_include_tiles :: boolean? [Read]

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

Can only be used if this is SelectionTool

entity_filter_mode :: string? [Read]

The entity filter mode used by this selection tool.

Can only be used if this is SelectionTool

alt_entity_filter_mode :: string? [Read]

The alt entity filter mode used by this selection tool.

Can only be used if this is SelectionTool

reverse_alt_entity_filter_mode :: string? [Read]

The reverse entity filter mode used by this selection tool.

Can only be used if this is SelectionTool

tile_filter_mode :: string? [Read]

The tile filter mode used by this selection tool.

Can only be used if this is SelectionTool

alt_tile_filter_mode :: string? [Read]

The alt tile filter mode used by this selection tool.

Can only be used if this is SelectionTool

reverse_tile_filter_mode :: string? [Read]

The reverse tile filter mode used by this selection tool.

Can only be used if this is SelectionTool

entity_filters :: dictionary[stringLuaEntityPrototype]? [Read]

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

Can only be used if this is SelectionTool

alt_entity_filters :: dictionary[stringLuaEntityPrototype]? [Read]

The alt entity filters used by this selection tool indexed by entity name.

Can only be used if this is SelectionTool

reverse_entity_filters :: dictionary[stringLuaEntityPrototype]? [Read]

The reverse entity filters used by this selection tool indexed by entity name.

Can only be used if this is SelectionTool

entity_type_filters :: dictionary[stringboolean]? [Read]

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

Note

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

Can only be used if this is SelectionTool

alt_entity_type_filters :: dictionary[stringboolean]? [Read]

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

Note

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

Can only be used if this is SelectionTool

reverse_entity_type_filters :: dictionary[stringboolean]? [Read]

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

Note

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

Can only be used if this is SelectionTool

tile_filters :: dictionary[stringLuaTilePrototype]? [Read]

The tile filters used by this selection tool indexed by tile name.

Can only be used if this is SelectionTool

alt_tile_filters :: dictionary[stringLuaTilePrototype]? [Read]

The alt tile filters used by this selection tool indexed by tile name.

Can only be used if this is SelectionTool

reverse_tile_filters :: dictionary[stringLuaTilePrototype]? [Read]

The reverse tile filters used by this selection tool indexed by tile name.

Can only be used if this is SelectionTool

entity_filter_slots :: uint? [Read]

The number of entity filters this deconstruction item has.

Can only be used if this is DeconstructionItem

tile_filter_slots :: uint? [Read]

The number of tile filters this deconstruction item has.

Can only be used if this is DeconstructionItem

durability_description_key :: string? [Read]

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

Can only be used if this is ToolItem

durability :: double? [Read]

The durability of this tool item.

Can only be used if this is ToolItem

infinite :: boolean? [Read]

If this tool item has infinite durability.

Can only be used if this is ToolItem

mapper_count :: uint? [Read]

How many filters an upgrade item has.

Can only be used if this is UpgradeItem

valid :: boolean [Read]

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 :: string [Read]

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.

|<

Classes

Events

Concepts

Defines

Builtin types

>|