Skip to main content

CustomInput

Struct CustomInput 

Source
pub struct CustomInput {
Show 23 fields pub name: &'static str, pub key_sequence: &'static str, pub hidden: Option<bool>, pub order: Option<&'static str>, pub subgroup: Option<&'static str>, pub factoriopedia_description: Option<&'static str>, pub hidden_in_factoriopedia: Option<bool>, pub localised_description: Option<&'static str>, pub localised_name: Option<&'static str>, pub parameter: Option<bool>, pub factoriopedia_alternative: Option<&'static str>, pub action: Option<&'static str>, pub alternative_key_sequence: Option<&'static str>, pub block_modifiers: Option<bool>, pub consuming: Option<&'static str>, pub controller_alternative_key_sequence: Option<&'static str>, pub controller_key_sequence: Option<&'static str>, pub enabled: Option<bool>, pub enabled_while_in_cutscene: Option<bool>, pub enabled_while_spectating: Option<bool>, pub include_selected_prototype: Option<bool>, pub item_to_spawn: Option<&'static str>, pub linked_game_control: Option<&'static str>,
}
Expand description

Minimal CustomInputPrototype for data.extend.

Used for custom keyboard shortcuts/key bindings in mods. The key associated with the custom input can be changed in the options. This means that key_sequence is simply the default key binding.

type = "custom-input" is injected by the Lua generator.

Fields§

§name: &'static str

Unique textual identification of the prototype. May only contain alphanumeric characters, dashes and underscores. May not exceed a length of 200 characters.

For a list of all names used in vanilla, see data.raw.

§key_sequence: &'static str

The default key sequence for this custom input. Use "" (empty string) for unassigned.

As modifier keys, these names are used: "CONTROL", "SHIFT", "COMMAND", "ALT". Note that "COMMAND" is loaded as "CONTROL" on Windows and Linux.

" + " is used to separate modifier keys from normal keys, like so: "ALT + G". A key binding can contain any amount of individual modifier keys, but only a single normal mouse button or keyboard key (listed below).

§hidden: Option<bool>

Prototype property hidden.

§order: Option<&'static str>

Used to order prototypes in inventory, recipes and GUIs. May not exceed a length of 200 characters.

§subgroup: Option<&'static str>

The name of an ItemSubGroup.

§factoriopedia_description: Option<&'static str>

Provides additional description used in factoriopedia.

§hidden_in_factoriopedia: Option<bool>

Prototype property hidden_in_factoriopedia.

§localised_description: Option<&'static str>

Overwrites the description set in the locale file. The description is usually shown in the tooltip of the prototype.

§localised_name: Option<&'static str>

Overwrites the name set in the locale file. Can be used to easily set a procedurally-generated name because the LocalisedString format allows to insert parameters into the name directly from the Lua script.

§parameter: Option<bool>

Whether the prototype is a special type which can be used to parametrize blueprints and doesn’t have other function.

§factoriopedia_alternative: Option<&'static str>

The ID type corresponding to the prototype that inherits from this.

For example, if this is an EntityPrototype, this property’s type is EntityID.

§action: Option<&'static str>

A Lua event is only raised if the action is “lua”.

§alternative_key_sequence: Option<&'static str>

The alternative key binding for this control. See key_sequence for the format.

§block_modifiers: Option<bool>

If true, when the shortcut is activated, the modifiers used for this shortcut can’t be re-used to press something else until unpressed. The example where this is useful is ALT+A to activate spidertron remote, where ALT is consumed, so pressing right mouse button before the ALT is unpressed will not trigger pin creation (ALT + right mouse button), but send the selected unit instead.

§consuming: Option<&'static str>

Sets whether internal game events associated with the same key sequence should be fired or blocked. If they are fired (“none”), then the custom input event will happen before the internal game event.

§controller_alternative_key_sequence: Option<&'static str>

The alternative controller (game pad) keybinding for this control. See controller_key_sequence for the format.

§controller_key_sequence: Option<&'static str>

The controller (game pad) keybinding for this control. Use "" (empty string) for unassigned.

As modifier buttons, these names are used: "controller-righttrigger", "controller-lefttrigger".

" + " is used to separate modifier buttons from normal buttons, like so: "controller-righttrigger + controller-a". A key binding can contain any amount of individual modifier buttons, but only a single normal button (listed below).

§enabled: Option<bool>

If this custom input is enabled. Disabled custom inputs exist but are not used by the game. If disabled, no event is raised when the input is used.

§enabled_while_in_cutscene: Option<bool>

Prototype property enabled_while_in_cutscene.

§enabled_while_spectating: Option<bool>

Prototype property enabled_while_spectating.

§include_selected_prototype: Option<bool>

If true, the type and name of the currently selected prototype will be provided as “selected_prototype” in the raised Lua event. This also works in GUIs, not just the game world.

This will also return an item in the cursor such as copper-wire or rail-planner, if nothing is beneath the cursor.

§item_to_spawn: Option<&'static str>

The item will be created when this input is pressed and action is set to “spawn-item”. The item must have the spawnable flag set.

§linked_game_control: Option<&'static str>

When a custom-input is linked to a game control it won’t show up in the control-settings GUI and will fire when the linked control is pressed.

Trait Implementations§

Source§

impl Clone for CustomInput

Source§

fn clone(&self) -> CustomInput

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CustomInput

Source§

impl Debug for CustomInput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CustomInput

Source§

fn default() -> CustomInput

Returns the “default value” for a type. Read more
Source§

impl Eq for CustomInput

Source§

impl PartialEq for CustomInput

Source§

fn eq(&self, other: &CustomInput) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CustomInput

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.