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

# Factorio Prototype Docs Version 2.0.7

## ShortcutPrototype 'shortcut' changed Example code

Definition for a shortcut button in the shortcut bar.

This is not a custom keybinding (keyboard shortcut), for that see CustomInputPrototype.

Inherits from Prototype « PrototypeBase

## Properties

- default
- sorted

action | :: `"toggle-alt-mode"` or `"undo"` or `"copy"` or `"cut"` or `"paste"` or `"import-string"` or `"toggle-personal-roboport"` or `"toggle-equipment-movement-bonus"` or `"spawn-item"` or `"lua"` | If this is `"lua"`, on_lua_shortcut is raised when the shortcut is clicked.
If this is `"lua"`, on_lua_shortcut is raised when the shortcut is clicked.
icons new optional | :: array[IconData] | Can't be an empty array.
Can't be an empty array.
icon changed optional | :: FileName | Path to the icon file. [...]
Path to the icon file. [...]
icon_size new optional | :: SpriteSizeType | The size of the square icon, in pixels. [...]
The size of the square icon, in pixels. [...]
small_icons new optional | :: array[IconData] | Can't be an empty array.
Can't be an empty array.
small_icon changed optional | :: FileName | Path to the icon file. [...]
Path to the icon file. [...]
small_icon_size new optional | :: SpriteSizeType | The size of the small icon, in pixels. [...]
The size of the small icon, in pixels. [...]
item_to_spawn optional | :: ItemID | The item to create when clicking on a shortcut with the action set to `"spawn-item"`. [...]
The item to create when clicking on a shortcut with the action set to `"spawn-item"`. [...]
technology_to_unlock optional | :: TechnologyID | The technology that must be researched before this shortcut can be used. [...]
The technology that must be researched before this shortcut can be used. [...]
unavailable_until_unlocked new optional | :: bool | If `true`, the shortcut will not be available until its `technology_to_unlock` is researched, even if it was already researched in a different game.
If `true`, the shortcut will not be available until its `technology_to_unlock` is researched, even if it was already researched in a different game.
toggleable optional | :: bool | Must be enabled for the Factorio API to be able to set the toggled state on the shortcut button, see LuaPlayer::set_shortcut_toggled.
Must be enabled for the Factorio API to be able to set the toggled state on the shortcut button, see LuaPlayer::set_shortcut_toggled.
associated_control_input optional | :: string | Name of a custom input or vanilla control. [...]
Name of a custom input or vanilla control. [...]
style optional | :: `"default"` or `"blue"` or `"red"` or `"green"` |

Inherited from Prototype

factoriopedia_alternative optional | :: string | The ID type corresponding to the prototype that inherits from this. [...]
The ID type corresponding to the prototype that inherits from this. [...]

Inherited from PrototypeBase

type | :: string | Specifies the kind of prototype this is. [...]
Specifies the kind of prototype this is. [...]
name | :: string | Unique textual identification of the prototype. [...]
Unique textual identification of the prototype. [...]
order[overridden] optional | :: Order | Used to order prototypes in inventory, recipes and GUIs. [...]
Used to order prototypes in inventory, recipes and GUIs. [...]
localised_name optional | :: LocalisedString | Overwrites the name set in the locale file. [...]
Overwrites the name set in the locale file. [...]
localised_description optional | :: LocalisedString | Overwrites the description set in the locale file. [...]
Overwrites the description set in the locale file. [...]
factoriopedia_description new optional | :: LocalisedString | Provides additional description used in factoriopedia.
Provides additional description used in factoriopedia.
subgroup new optional | :: ItemSubGroupID | The name of an ItemSubGroup.
The name of an ItemSubGroup.
hidden new optional | :: bool |
hidden_in_factoriopedia new optional | :: bool |
parameter new optional | :: bool | Whether the prototype is a special type which can be used to parametrize blueprints and doesn't have other function.
Whether the prototype is a special type which can be used to parametrize blueprints and doesn't have other function.
factoriopedia_simulation new optional | :: SimulationDefinition | The simulation shown when looking at this prototype in the Factoriopedia GUI.
The simulation shown when looking at this prototype in the Factoriopedia GUI.

action | :: `"toggle-alt-mode"` or `"undo"` or `"copy"` or `"cut"` or `"paste"` or `"import-string"` or `"toggle-personal-roboport"` or `"toggle-equipment-movement-bonus"` or `"spawn-item"` or `"lua"` | If this is `"lua"`, on_lua_shortcut is raised when the shortcut is clicked.
If this is `"lua"`, on_lua_shortcut is raised when the shortcut is clicked.
associated_control_input optional | :: string | Name of a custom input or vanilla control. [...]
Name of a custom input or vanilla control. [...]
icon changed optional | :: FileName | Path to the icon file. [...]
Path to the icon file. [...]
icon_size new optional | :: SpriteSizeType | The size of the square icon, in pixels. [...]
The size of the square icon, in pixels. [...]
icons new optional | :: array[IconData] | Can't be an empty array.
Can't be an empty array.
item_to_spawn optional | :: ItemID | The item to create when clicking on a shortcut with the action set to `"spawn-item"`. [...]
The item to create when clicking on a shortcut with the action set to `"spawn-item"`. [...]
small_icon changed optional | :: FileName | Path to the icon file. [...]
Path to the icon file. [...]
small_icon_size new optional | :: SpriteSizeType | The size of the small icon, in pixels. [...]
The size of the small icon, in pixels. [...]
small_icons new optional | :: array[IconData] | Can't be an empty array.
Can't be an empty array.
style optional | :: `"default"` or `"blue"` or `"red"` or `"green"` |
technology_to_unlock optional | :: TechnologyID | The technology that must be researched before this shortcut can be used. [...]
The technology that must be researched before this shortcut can be used. [...]
toggleable optional | :: bool | Must be enabled for the Factorio API to be able to set the toggled state on the shortcut button, see LuaPlayer::set_shortcut_toggled.
Must be enabled for the Factorio API to be able to set the toggled state on the shortcut button, see LuaPlayer::set_shortcut_toggled.
unavailable_until_unlocked new optional | :: bool | If `true`, the shortcut will not be available until its `technology_to_unlock` is researched, even if it was already researched in a different game.
If `true`, the shortcut will not be available until its `technology_to_unlock` is researched, even if it was already researched in a different game.

Inherited from Prototype

factoriopedia_alternative optional | :: string | The ID type corresponding to the prototype that inherits from this. [...]
The ID type corresponding to the prototype that inherits from this. [...]

Inherited from PrototypeBase

name | :: string | Unique textual identification of the prototype. [...]
Unique textual identification of the prototype. [...]
type | :: string | Specifies the kind of prototype this is. [...]
Specifies the kind of prototype this is. [...]
factoriopedia_description new optional | :: LocalisedString | Provides additional description used in factoriopedia.
Provides additional description used in factoriopedia.
factoriopedia_simulation new optional | :: SimulationDefinition | The simulation shown when looking at this prototype in the Factoriopedia GUI.
The simulation shown when looking at this prototype in the Factoriopedia GUI.
hidden new optional | :: bool |
hidden_in_factoriopedia new optional | :: bool |
localised_description optional | :: LocalisedString | Overwrites the description set in the locale file. [...]
Overwrites the description set in the locale file. [...]
localised_name optional | :: LocalisedString | Overwrites the name set in the locale file. [...]
Overwrites the name set in the locale file. [...]
order[overridden] optional | :: Order | Used to order prototypes in inventory, recipes and GUIs. [...]
Used to order prototypes in inventory, recipes and GUIs. [...]
parameter new optional | :: bool | Whether the prototype is a special type which can be used to parametrize blueprints and doesn't have other function.
Whether the prototype is a special type which can be used to parametrize blueprints and doesn't have other function.
subgroup new optional | :: ItemSubGroupID | The name of an ItemSubGroup.
The name of an ItemSubGroup.

## Properties

### action :: `"toggle-alt-mode"` or `"undo"` or `"copy"` or `"cut"` or `"paste"` or `"import-string"` or `"toggle-personal-roboport"` or `"toggle-equipment-movement-bonus"` or `"spawn-item"` or `"lua"`

If this is `"lua"`, on_lua_shortcut is raised when the shortcut is clicked.

### icons :: array[IconData] optional new

Can't be an empty array.

### icon :: FileName optional changed

Path to the icon file.

Mandatory if `icons` is not defined.

### icon_size :: SpriteSizeType optional new

Default: `64`

The size of the square icon, in pixels. E.g. `32` for a 32px by 32px icon. Must be larger than `0`.

The base game uses 32px icons for shortcuts.

Only loaded if `icons` is not defined.

### small_icons :: array[IconData] optional new

Can't be an empty array.

### small_icon :: FileName optional changed

Path to the icon file. Used in the shortcut selection popup.

Mandatory if `small_icons` is not defined.

### small_icon_size :: SpriteSizeType optional new

Default: `64`

The size of the small icon, in pixels. E.g. `32` for a 32px by 32px icon. Must be larger than `0`.

The base game uses 24px small icons for shortcuts.

Only loaded if `small_icons` is not defined.

### item_to_spawn :: ItemID optional

The item to create when clicking on a shortcut with the action set to `"spawn-item"`. The item must have the spawnable flag set.

### technology_to_unlock :: TechnologyID optional

The technology that must be researched before this shortcut can be used. Once a shortcut is unlocked in one save file, it is unlocked for all future save files.

### unavailable_until_unlocked :: bool optional new

Default: `false`

If `true`, the shortcut will not be available until its `technology_to_unlock` is researched, even if it was already researched in a different game.

### toggleable :: bool optional

Default: `false`

Must be enabled for the Factorio API to be able to set the toggled state on the shortcut button, see LuaPlayer::set_shortcut_toggled.

### associated_control_input :: string optional

Default: `""`

Name of a custom input or vanilla control. This is only used to show the keybind in the tooltip of the shortcut.

### style :: `"default"` or `"blue"` or `"red"` or `"green"` optional

Default: `"default"`

## Overridden Properties

### order :: Order optional

Default: `""`

Used to order the shortcuts in the quick panel, which replaces the shortcut bar when using a controller (game pad). It is recommended to order modded shortcuts after the vanilla shortcuts.

## Example

    {
      type = "shortcut",
      name = "give-deconstruction-planner",
      order = "b[blueprints]-i[deconstruction-planner]",
      action = "spawn-item",
      localised_name = {"shortcut.make-deconstruction-planner"},
      associated_control_input = "give-deconstruction-planner",
      technology_to_unlock = "construction-robotics",
      item_to_spawn = "deconstruction-planner",
      style = "red",
      icon = "__base__/graphics/icons/shortcut-toolbar/mip/new-deconstruction-planner-x32.png",
      icon_size = 32,
      small_icon = "__base__/graphics/icons/shortcut-toolbar/mip/new-deconstruction-planner-x24.png",
      small_icon_size = 24
    }