May I ask how to prevent players from modifying shortcut keys?

Place to get help with not working mods / modding interface.
sdgmlj
Fast Inserter
Fast Inserter
Posts: 148
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

May I ask how to prevent players from modifying shortcut keys?

Post by sdgmlj »

I added a 'custom input' and I don't want players to modify it. How can I set it up? Or hide it?

Code: Select all

  {
    type = "custom-input",
    name = "fast-transmission",
	hidden = true,        --invalid??????
    key_sequence = "CONTROL + mouse-button-1",
  }

Pi-C
Smart Inserter
Smart Inserter
Posts: 1737
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: May I ask how to prevent players from modifying shortcut keys?

Post by Pi-C »

sdgmlj wrote: Mon Nov 04, 2024 12:27 pm I added a 'custom input' and I don't want players to modify it.
Why would you want that?
How can I set it up? Or hide it?
If you hide it (I presume from Main menu --> Controls), how would the players know that your custom input exists, and what key sequence will trigger it?

Personally, I use the opposite approach: I don't want to think what key sequence I should assign to a shortcut, so I set 'key_sequence' to an empty string and don't set 'alternative_key_sequence', ' controller_key_sequence', and 'controller_alternative_key_sequence' at all. Players know best what key_sequences are most convenient to use given their mods, keyboard layout, whether they are left-handed or right-handed …
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
sdgmlj
Fast Inserter
Fast Inserter
Posts: 148
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: May I ask how to prevent players from modifying shortcut keys?

Post by sdgmlj »

Pi-C wrote: Mon Nov 04, 2024 1:50 pm
sdgmlj wrote: Mon Nov 04, 2024 12:27 pm I added a 'custom input' and I don't want players to modify it.
Why would you want that?
How can I set it up? Or hide it?
If you hide it (I presume from Main menu --> Controls), how would the players know that your custom input exists, and what key sequence will trigger it?

Personally, I use the opposite approach: I don't want to think what key sequence I should assign to a shortcut, so I set 'key_sequence' to an empty string and don't set 'alternative_key_sequence', ' controller_key_sequence', and 'controller_alternative_key_sequence' at all. Players know best what key_sequences are most convenient to use given their mods, keyboard layout, whether they are left-handed or right-handed …
First of all, thank you for answering my question. I will explain to the player what the shortcut key is and its purpose, but I don't want the player to modify it casually. Is it impossible to achieve this?
Post Reply

Return to “Modding help”