Prototype/Shortcut: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(→‎Example: Updated to 1.1.34)
(Note on scale for sprite, removed it from example)
Line 28: Line 28:


{{Prototype property|small_icon|[[Types/Sprite|Sprite]]|optional=true}}
{{Prototype property|small_icon|[[Types/Sprite|Sprite]]|optional=true}}
Note: The scale that can be defined in the sprite may not have the expected effect because the game always scales the sprite to fill the GUI slot.


{{Prototype property|disabled_icon|[[Types/Sprite|Sprite]]|optional=true}}
{{Prototype property|disabled_icon|[[Types/Sprite|Sprite]]|optional=true}}
Note: The scale that can be defined in the sprite may not have the expected effect because the game always scales the sprite to fill the GUI slot.


{{Prototype property|disabled_small_icon|[[Types/Sprite|Sprite]]|optional=true}}
{{Prototype property|disabled_small_icon|[[Types/Sprite|Sprite]]|optional=true}}
Note: The scale that can be defined in the sprite may not have the expected effect because the game always scales the sprite to fill the GUI slot.


{{Prototype property|style|[[Types/string|string]]|"default"|optional=true}}
{{Prototype property|style|[[Types/string|string]]|"default"|optional=true}}
Line 53: Line 56:
       priority = "extra-high-no-scale",
       priority = "extra-high-no-scale",
       size = 32,
       size = 32,
      scale = 0.5,
       mipmap_count = 2,
       mipmap_count = 2,
       flags = {"gui-icon"}
       flags = {"gui-icon"}
Line 62: Line 64:
       priority = "extra-high-no-scale",
       priority = "extra-high-no-scale",
       size = 24,
       size = 24,
      scale = 0.5,
       mipmap_count = 2,
       mipmap_count = 2,
       flags = {"gui-icon"}
       flags = {"gui-icon"}
Line 71: Line 72:
       priority = "extra-high-no-scale",
       priority = "extra-high-no-scale",
       size = 24,
       size = 24,
      scale = 0.5,
       mipmap_count = 2,
       mipmap_count = 2,
       flags = {"gui-icon"}
       flags = {"gui-icon"}
     }
     }
   }</syntaxhighlight>
   }</syntaxhighlight>

Revision as of 10:55, 11 June 2021

Template:Prototype parent Definition for a shortcut button in the shortcut bar.
This is not a custom keybinding (keyboard shortcut), for that see Prototype/CustomInput

Template:Prototype TOC

Mandatory properties

Inherits all properties from PrototypeBase.

Template:Prototype property One of "toggle-alt-mode", "undo", "copy", "cut", "paste", "import-string", "toggle-personal-roboport", "toggle-equipment-movement-bonus", "spawn-item" and "lua".

Template:Prototype property

Optional properties

Template:Prototype property Name of a Prototype/Item. The item to create when clicking on a shortcut with the action set to "spawn-item". The item must have the "spawnable" flag set.

Template:Prototype property Name of a Prototype/Technology. The technology that must be researched before this shortcut can be used.

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

Template:Prototype property Name of a custom input or vanilla control. Used to show the keybind in the tooltip of the shortcut.

Template:Prototype property Note: The scale that can be defined in the sprite may not have the expected effect because the game always scales the sprite to fill the GUI slot.

Template:Prototype property Note: The scale that can be defined in the sprite may not have the expected effect because the game always scales the sprite to fill the GUI slot.

Template:Prototype property Note: The scale that can be defined in the sprite may not have the expected effect because the game always scales the sprite to fill the GUI slot.

Template:Prototype property One of "default", "blue", "red" and "green".

Example

  {
    type = "shortcut",
    name = "give-deconstruction-planner",
    order = "b[blueprints]-g[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 =
    {
      filename = "__base__/graphics/icons/shortcut-toolbar/mip/new-deconstruction-planner-x32-white.png",
      priority = "extra-high-no-scale",
      size = 32,
      mipmap_count = 2,
      flags = {"gui-icon"}
    },
    small_icon =
    {
      filename = "__base__/graphics/icons/shortcut-toolbar/mip/new-deconstruction-planner-x24-white.png",
      priority = "extra-high-no-scale",
      size = 24,
      mipmap_count = 2,
      flags = {"gui-icon"}
    },
    disabled_small_icon =
    {
      filename = "__base__/graphics/icons/shortcut-toolbar/mip/new-deconstruction-planner-x24-white.png",
      priority = "extra-high-no-scale",
      size = 24,
      mipmap_count = 2,
      flags = {"gui-icon"}
    }
  }