LuaItemPrototype

class LuaItemPrototype - sort
has_flag(flag) → boolean Does this prototype have a flag enabled?
get_ammo_type(ammo_source_type) Type of this ammo prototype or nil if this is not an ammo prototype.
type :: string [R] Type of this prototype.
name :: string [R] Name of this prototype.
localised_name :: LocalisedString [R]
localised_description :: LocalisedString [R]
order :: string [R] Order string.
place_result :: LuaEntityPrototype [R] Prototype of the entity that will be created by placing this item, or nil if there is no such entity.
place_as_equipment_result :: LuaEquipmentPrototype [R] Prototype of the equipment that will be created by placing this item in an equipment grid or nil if there is no equipment defined.
place_as_tile_result [R] The place as tile result if one is defined else nil.
stackable :: boolean [R] Is this item allowed to stack at all?
default_request_amount :: uint [R] The default request value.
stack_size :: uint [R] Maximum stack size of the item specified by this prototype.
fuel_category :: string [R] The fuel category or nil.
burnt_result :: LuaItemPrototype [R] The result of burning this item as fuel or nil.
fuel_value :: float [R] Fuel value when burned.
fuel_acceleration_multiplier :: double [R] The acceleration multiplier when this item is used as fuel in a vehicle.
fuel_top_speed_multiplier :: double [R] The fuel top speed multiplier when this item is used as fuel in a vehicle.
subgroup :: LuaGroup [R] The subgroup this prototype belongs to.
group :: LuaGroup [R] The group this prototype belongs to.
flags :: dictionary stringboolean [R] The item prototype flags for this item prototype.
magazine_size :: float [R] Size of full magazine; nil if this is not an ammo item.
equipment_grid :: LuaEquipmentGridPrototype [R] The prototype of this armor equipment grid or nil if none or this is not an armor item.
resistances :: Resistances [R] Resistances of this armour item; nil if not an armor or or the armor has no resistances.
inventory_size_bonus :: uint [R] The invntory size bonus for this armor prototype.
capsule_action :: CapsuleAction [R] The capsule action for this capsule item prototype or nil if this isn't a capsule item prototype.
attack_parameters :: AttackParameters [R] The gun attack parameters or nil if not a gun item prototype.
inventory_size :: uint [R] The main inventory size for item-with-inventory-prototype.
item_filters :: dictionary stringLuaItemPrototype [R]
group_filters :: dictionary stringLuaGroup [R]
sub_group_filters :: dictionary stringLuaGroup [R]
filter_mode :: string [R] The filter mode used by this item with inventory.
insertion_priority_mode :: string [R] The insertion priority mode used by this item with inventory.
localised_filter_message :: LocalisedString [R] The localised string used when the player attempts to put items into this item with inventory that aren't allowed.
extend_inventory_by_default :: boolean [R] If this item with inventory extends the inventory it resides in by default.
default_label_color :: Color [R] The default label color used for this item with label.
draw_label_for_cursor_render :: 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.
speed :: float [R] Mining or repairing speed if this is a mining or repairing tool; otherwise nil.
attack_result :: array of TriggerItem [R] The attack result of this mining tool prototype.
attack_range :: float [R] The attack range of this mining tool or nil if not a mining tool.
module_effects :: dictionary stringEffectValue [R] Effects of this module; nil if this is not a module.
category :: string [R] The module category name
tier :: float [R] The module tier
limitations :: array of string [R] An array of recipe names this module is allowed to work with.
limitation_message_key :: string [R] The limitation message key used when the player attempts to use this modules in some place it's not allowed.
straight_rail :: LuaEntityPrototype [R] The straight rail prototype used for this rail planner prototype.
curved_rail :: LuaEntityPrototype [R] The curved rail prototype used for this rail planner prototype.
repair_result :: array of TriggerItem [R] The repair result of this repair tool prototype or nil if this isn't a repair tool prototype.
selection_border_color :: Color [R] The color used when doing normal selection with this selection tool prototype.
alt_selection_border_color :: Color [R] The color used when doing alt selection with this selection tool prototype.
selection_mode_flags :: SelectionModeFlags [R] Flags that affect which entities will be selected.
alt_selection_mode_flags :: SelectionModeFlags [R] Flags that affect which entities will be selected during alternate selection.
selection_cursor_box_type :: string [R]
alt_selection_cursor_box_type :: string [R]
always_include_tiles :: boolean [R] If tiles area always included when doing selection with this selection tool prototype.
entity_filter_slots :: uint [R] The number of entity filters this deconstruction item has or nil if this isn't a deconstruction item prototype.
tile_filter_slots :: uint [R] The number of tile filters this deconstruction item has or nil if this isn't a deconstruction item prototype.
durability_description_key :: string [R] The durability message key used when displaying the durability of this tool.
durability :: double [R] The durability of this tool item or nil if not a tool item.
valid :: boolean [R] Is this object valid?
help() → string All methods, and properties that this object supports.

Prototype of an item.

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

Does this prototype have a flag enabled?

Parameters
flag :: string: The flag to check. Can be either "goes-to-main-inventory", "goes-to-quickbar" or "hidden". Any other value will cause an error.
get_ammo_type(ammo_source_type)

Type of this ammo prototype or nil if this is not an ammo prototype.

Parameters
ammo_source_type :: string (optional): "default", "player", "turret", or "vehicle"
type :: string [Read-only]

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

name :: string [Read-only]

Name of this prototype.

localised_name :: LocalisedString [Read-only]

localised_description :: LocalisedString [Read-only]

order :: string [Read-only]

Order string.

place_result :: LuaEntityPrototype [Read-only]

Prototype of the entity that will be created by placing this item, or nil if there is no such entity.

place_as_equipment_result :: LuaEquipmentPrototype [Read-only]

Prototype of the equipment that will be created by placing this item in an equipment grid or nil if there is no equipment defined.

place_as_tile_result [Read-only]

The place as tile result if one is defined else nil.

stackable :: boolean [Read-only]

Is this item allowed to stack at all?

default_request_amount :: uint [Read-only]

The default request value.

stack_size :: uint [Read-only]

Maximum stack size of the item specified by this prototype.

fuel_category :: string [Read-only]

The fuel category or nil.

burnt_result :: LuaItemPrototype [Read-only]

The result of burning this item as fuel or nil.

fuel_value :: float [Read-only]

Fuel value when burned.

fuel_acceleration_multiplier :: double [Read-only]

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

fuel_top_speed_multiplier :: double [Read-only]

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

subgroup :: LuaGroup [Read-only]

The subgroup this prototype belongs to.

group :: LuaGroup [Read-only]

The group this prototype belongs to.

flags :: dictionary stringboolean [Read-only]

The item prototype flags for this item prototype. It is a dictionary where the keys are the set flags and the value is always true -- if a flag is unset, it isn't present in the dictionary at all.

The possible flags are:

  • "goes-to-main-inventory": If true, the item will prefer to go to the player's main inventory
  • "goes-to-quickbar": If true, the item will prefer to go to the player's quickbar.
  • "hidden": If true, the item will be hidden from all crafting menus.

magazine_size :: float [Read-only]

Size of full magazine; nil if this is not an ammo item.

equipment_grid :: LuaEquipmentGridPrototype [Read-only]

The prototype of this armor equipment grid or nil if none or this is not an armor item.

resistances :: Resistances [Read-only]

Resistances of this armour item; nil if not an armor or or the armor has no resistances.

inventory_size_bonus :: uint [Read-only]

The invntory size bonus for this armor prototype. nil if this isn't an armor prototype.

Can only be used if this is ArmorPrototype
capsule_action :: CapsuleAction [Read-only]

The capsule action for this capsule item prototype or nil if this isn't a capsule item prototype.

attack_parameters :: AttackParameters [Read-only]

The gun attack parameters or nil if not a gun item prototype.

inventory_size :: uint [Read-only]

The main inventory size for item-with-inventory-prototype. nil if not an item-with-inventory-prototype.

Can only be used if this is ItemWithInventoryPrototype
item_filters :: dictionary stringLuaItemPrototype [Read-only]

Can only be used if this is ItemWithInventory
group_filters :: dictionary stringLuaGroup [Read-only]

Can only be used if this is ItemWithInventory
sub_group_filters :: dictionary stringLuaGroup [Read-only]

Can only be used if this is ItemWithInventory
filter_mode :: string [Read-only]

The filter mode used by this item with inventory.

Can only be used if this is ItemWithInventory
insertion_priority_mode :: string [Read-only]

The insertion priority mode used by this item with inventory.

Can only be used if this is ItemWithInventory
localised_filter_message :: LocalisedString [Read-only]

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-only]

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-only]

The default label color used for this item with label. nil if not defined or if this isn't an item with label.

Can only be used if this is ItemWithLabel
draw_label_for_cursor_render :: boolean [Read-only]

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-only]

Mining or repairing speed if this is a mining or repairing tool; otherwise nil.

attack_result :: array of TriggerItem [Read-only]

The attack result of this mining tool prototype.

Can only be used if this is MiningTool
attack_range :: float [Read-only]

The attack range of this mining tool or nil if not a mining tool.

Can only be used if this is Miningtool
module_effects :: dictionary stringEffectValue [Read-only]

Effects of this module; nil if this is not a module. It is a dictionary indexed by the effect type.

Example
These are the effects of the vanilla Productivity Module 3 (up to floating point impresicions):
{consumption={bonus=0.6},
 speed={bonus=-0.15},
 productivity={bonus=0.06},
 pollution={bonus=0.075}}
Can only be used if this is ModuleItem
category :: string [Read-only]

The module category name

Can only be used if this is ModuleItem
tier :: float [Read-only]

The module tier

Can only be used if this is ModuleItem
limitations :: array of string [Read-only]

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

Can only be used if this is ModuleItem
limitation_message_key :: string [Read-only]

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-only]

The straight rail prototype used for this rail planner prototype.

Can only be used if this is RailPlanner
curved_rail :: LuaEntityPrototype [Read-only]

The curved rail prototype used for this rail planner prototype.

Can only be used if this is RailPlanner
repair_result :: array of TriggerItem [Read-only]

The repair result of this repair tool prototype or nil if this isn't a repair tool prototype.

Can only be used if this is RepairTool
selection_border_color :: Color [Read-only]

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-only]

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

Can only be used if this is SelectionTool
selection_mode_flags :: SelectionModeFlags [Read-only]

Flags that affect which entities will be selected.

Can only be used if this is SelectionTool
alt_selection_mode_flags :: SelectionModeFlags [Read-only]

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

Can only be used if this is SelectionTool
selection_cursor_box_type :: string [Read-only]

Can only be used if this is SelectionTool
alt_selection_cursor_box_type :: string [Read-only]

Can only be used if this is SelectionTool
always_include_tiles :: boolean [Read-only]

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

Can only be used if this is SelectionTool
entity_filter_slots :: uint [Read-only]

The number of entity filters this deconstruction item has or nil if this isn't a deconstruction item prototype.

Can only be used if this is DeconstructionItem
tile_filter_slots :: uint [Read-only]

The number of tile filters this deconstruction item has or nil if this isn't a deconstruction item prototype.

Can only be used if this is DeconstructionItem
durability_description_key :: string [Read-only]

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

Can only be used if this is ToolItem
durability :: double [Read-only]

The durability of this tool item or nil if not a tool item.