Prototype/Shortcut: Difference between revisions
(Set prototype parent) |
(Converted to SMW format) |
||
Line 1: | Line 1: | ||
{{Prototype parent|PrototypeBase}} | {{Prototype parent|PrototypeBase}} | ||
Definition for a shortcut in the [[shortcut bar]]. | |||
{{Prototype TOC|shortcut}} | |||
Prototype | |||
== Mandatory properties == | == Mandatory properties == | ||
Inherits all properties from [[PrototypeBase]]. | Inherits all properties from [[PrototypeBase]]. | ||
{{Prototype property|action|[[Types/string|string]]}} | |||
One of "toggle-alt-mode", "undo", "copy", "cut", "paste", "import-string", "toggle-personal-roboport", "toggle-equipment-movement-bonus", "create-blueprint-item" and "lua". | One of "toggle-alt-mode", "undo", "copy", "cut", "paste", "import-string", "toggle-personal-roboport", "toggle-equipment-movement-bonus", "create-blueprint-item" and "lua". | ||
{{Prototype property|icon|[[Types/Sprite|Sprite]]}} | |||
== Optional properties == | == Optional properties == | ||
{{Prototype property|item_to_create|[[Types/string|string]]|optional=true}} | |||
Name of a [[Prototype/Item]]. The item to create when clicking on a shortcut with the action set to "create-blueprint-item". | Name of a [[Prototype/Item]]. The item to create when clicking on a shortcut with the action set to "create-blueprint-item". | ||
{{Prototype property|technology_to_unlock|[[Types/string|string]]|optional=true}} | |||
Name of a [[Prototype/Technology]]. The technology that must be researched before this shortcut can be used. | Name of a [[Prototype/Technology]]. The technology that must be researched before this shortcut can be used. | ||
{{Prototype property|toggleable|[[Types/bool|bool]]|false|optional=true}} | |||
Must be enabled for the Factorio API to be able to set the toggled state on the shortcut button, see [https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.set_shortcut_toggled LuaPlayer.set_shortcut_toggled]. | Must be enabled for the Factorio API to be able to set the toggled state on the shortcut button, see [https://lua-api.factorio.com/latest/LuaPlayer.html#LuaPlayer.set_shortcut_toggled LuaPlayer.set_shortcut_toggled]. | ||
{{Prototype property|associated_control_input|[[Types/string|string]]|""|optional=true}} | |||
Name of a custom input or vanilla control. Used to show the keybind in the tooltip of the shortcut. | Name of a custom input or vanilla control. Used to show the keybind in the tooltip of the shortcut. | ||
{{Prototype property|small_icon|[[Types/Sprite|Sprite]]|optional=true}} | |||
{{Prototype property|disabled_icon|[[Types/Sprite|Sprite]]|optional=true}} | |||
{{Prototype property|disabled_small_icon|[[Types/Sprite|Sprite]]|optional=true}} | |||
{{Prototype property|style|[[Types/string|string]]|"default"|optional=true}} | |||
One of "default", "blue", "red" and "green". | One of "default", "blue", "red" and "green". | ||
Revision as of 18:32, 6 August 2019
Prototype definitions » PrototypeBase » Prototype/Shortcut
Definition for a shortcut in the shortcut bar.
Prototype/Shortcut — shortcut | ||
action | :: | string |
icon | :: | Sprite |
associated_control_input | :: | string (optional) |
disabled_icon | :: | Sprite (optional) |
disabled_small_icon | :: | Sprite (optional) |
item_to_spawn | :: | string (optional) |
small_icon | :: | Sprite (optional) |
style | :: | string (optional) |
technology_to_unlock | :: | string (optional) |
toggleable | :: | bool (optional) |
Inherited from PrototypeBase | ||
name | :: | string |
type | :: | string |
localised_description | :: | LocalisedString (optional) |
localised_name | :: | LocalisedString (optional) |
order | :: | Order (optional) |
Mandatory properties
Inherits all properties from PrototypeBase.
action
Type: string
One of "toggle-alt-mode", "undo", "copy", "cut", "paste", "import-string", "toggle-personal-roboport", "toggle-equipment-movement-bonus", "create-blueprint-item" and "lua".
icon
Type: Sprite
Optional properties
item_to_create
Type: string
Name of a Prototype/Item. The item to create when clicking on a shortcut with the action set to "create-blueprint-item".
technology_to_unlock
Type: string
Name of a Prototype/Technology. The technology that must be researched before this shortcut can be used.
toggleable
Type: bool
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
Type: string
Default: ""
Name of a custom input or vanilla control. Used to show the keybind in the tooltip of the shortcut.
small_icon
Type: Sprite
disabled_icon
Type: Sprite
disabled_small_icon
Type: Sprite
style
Type: string
Default: "default"
One of "default", "blue", "red" and "green".
Example
{
type = "shortcut",
name = "give-deconstruction-planner",
order = "b[blueprints]-g[deconstruction-planner]",
action = "create-blueprint-item",
localised_name = {"shortcut.make-deconstruction-planner"},
technology_to_unlock = "construction-robotics",
item_to_create = "deconstruction-planner",
style = "red",
icon =
{
filename = "__base__/graphics/icons/shortcut-toolbar/new-deconstruction-planner-x32-white.png",
priority = "extra-high-no-scale",
size = 32,
scale = 1,
flags = {"icon"}
},
small_icon =
{
filename = "__base__/graphics/icons/shortcut-toolbar/new-deconstruction-planner-x24.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
disabled_small_icon =
{
filename = "__base__/graphics/icons/shortcut-toolbar/new-deconstruction-planner-x24-white.png",
priority = "extra-high-no-scale",
size = 24,
scale = 1,
flags = {"icon"}
},
}