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

# Factorio Prototype Docs Version 2.0.77

# ShortcutPrototype - Prototype Docs

## ShortcutPrototype 'shortcut' 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 `"redo"` or `"paste"` or `"import-string"` or `"toggle-personal-roboport"` or `"toggle-personal-logistic-requests"` 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 optional | :: array[IconData] | Can't be an empty array.
Can't be an empty array.
icon optional | :: FileName | Path to the icon file. [...]
Path to the icon file. [...]
icon_size optional | :: SpriteSizeType | The size of the square icon, in pixels. [...]
The size of the square icon, in pixels. [...]
small_icons optional | :: array[IconData] | Can't be an empty array.
Can't be an empty array.
small_icon optional | :: FileName | Path to the icon file. [...]
Path to the icon file. [...]
small_icon_size 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 optional | :: boolean | 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 | :: boolean | 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. [...]
custom_tooltip_fields optional | :: array[CustomTooltipField] | Allows to add extra description items to the tooltip and Factoriopedia.
Allows to add extra description items to the tooltip and Factoriopedia.

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 the shortcuts in the quick panel, which replaces the shortcut bar when using a controller (game pad). [...]
Used to order the shortcuts in the quick panel, which replaces the shortcut bar when using a controller (game pad). [...]
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 optional | :: LocalisedString | Provides additional description used in factoriopedia.
Provides additional description used in factoriopedia.
subgroup optional | :: ItemSubGroupID | The name of an ItemSubGroup.
The name of an ItemSubGroup.
hidden optional | :: boolean |
hidden_in_factoriopedia optional | :: boolean |
parameter optional | :: boolean | 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 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 `"redo"` or `"paste"` or `"import-string"` or `"toggle-personal-roboport"` or `"toggle-personal-logistic-requests"` 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 optional | :: FileName | Path to the icon file. [...]
Path to the icon file. [...]
icon_size optional | :: SpriteSizeType | The size of the square icon, in pixels. [...]
The size of the square icon, in pixels. [...]
icons 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 optional | :: FileName | Path to the icon file. [...]
Path to the icon file. [...]
small_icon_size optional | :: SpriteSizeType | The size of the small icon, in pixels. [...]
The size of the small icon, in pixels. [...]
small_icons 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 | :: boolean | 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 optional | :: boolean | 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

custom_tooltip_fields optional | :: array[CustomTooltipField] | Allows to add extra description items to the tooltip and Factoriopedia.
Allows to add extra description items to the tooltip and Factoriopedia.
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 optional | :: LocalisedString | Provides additional description used in factoriopedia.
Provides additional description used in factoriopedia.
factoriopedia_simulation 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 optional | :: boolean |
hidden_in_factoriopedia optional | :: boolean |
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 the shortcuts in the quick panel, which replaces the shortcut bar when using a controller (game pad). [...]
Used to order the shortcuts in the quick panel, which replaces the shortcut bar when using a controller (game pad). [...]
parameter optional | :: boolean | 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 optional | :: ItemSubGroupID | The name of an ItemSubGroup.
The name of an ItemSubGroup.

## Properties

### action :: `"toggle-alt-mode"` or `"undo"` or `"redo"` or `"paste"` or `"import-string"` or `"toggle-personal-roboport"` or `"toggle-personal-logistic-requests"` 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

Can't be an empty array.

### icon :: FileName optional

Path to the icon file.

Only loaded, and mandatory if `icons` is not defined.

### icon_size :: SpriteSizeType optional

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

Can't be an empty array.

### small_icon :: FileName optional

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

Only loaded, and mandatory if `small_icons` is not defined.

### small_icon_size :: SpriteSizeType optional

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 :: boolean optional

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 :: boolean 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-x56.png",
      icon_size = 56,
      small_icon = "__base__/graphics/icons/shortcut-toolbar/mip/new-deconstruction-planner-x24.png",
      small_icon_size = 24
    }