Prototype/Shortcut: Difference between revisions
m (formatting) |
(1.1) |
||
Line 9: | Line 9: | ||
{{Prototype property|action|[[Types/string|string]]}} | {{Prototype property|action|[[Types/string|string]]}} | ||
One of "toggle-alt-mode", "undo", "copy", "cut", "paste", "import-string", "toggle-personal-roboport", "toggle-equipment-movement-bonus", " | One of "toggle-alt-mode", "undo", "copy", "cut", "paste", "import-string", "toggle-personal-roboport", "toggle-equipment-movement-bonus", "spawn-item" and "lua". | ||
{{Prototype property|icon|[[Types/Sprite|Sprite]]}} | {{Prototype property|icon|[[Types/Sprite|Sprite]]}} | ||
Line 15: | Line 15: | ||
== Optional properties == | == Optional properties == | ||
{{Prototype property| | {{Prototype property|item_to_spawn|[[Types/string|string]]|optional=true}} | ||
Name of a [[Prototype/Item]]. The item to create when clicking on a shortcut with the action set to " | 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 [[Types/ItemPrototypeFlags#.22spawnable.22|"spawnable"]] flag set. | ||
{{Prototype property|technology_to_unlock|[[Types/string|string]]|optional=true}} | {{Prototype property|technology_to_unlock|[[Types/string|string]]|optional=true}} |
Revision as of 12:56, 14 December 2020
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
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".
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 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"}
},
}