[StrangePan][2.0.41] Shoot on <Enter> triggers in text fields

User avatar
Elyviere
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Aug 13, 2016 1:53 am
Contact:

[StrangePan][2.0.41] Shoot on <Enter> triggers in text fields

Post by Elyviere »

Hello!

Since I'm using a split ergodox keyboard, I happen to have my enter key on my left keyboard instead of my spacebar (spacebar being on the right half only). Therefore, I've got the [Enter] key bound to the "Shoot enemy" action.

When typing in the game, e.g. in the chat or when searching for something in the inventory, I of course end the text by pressing [Enter], to send the message or complete the search. However, because my "Shoot enemy" action is bound to that key, pressing [Enter] always fires my weapon as well. While typing, obviously no other key performs their other bound action, i.e. typing "wasd" won't move my character around in a circle, so I'd assume the same should be true for [Enter]. All other actions for the key should be disabled while typing.

Problem: Pressing [Enter] while typing (i.e. to send a message) also performs the "Shoot enemy"-action if the [Enter] key is bound to that action (causing non-targeted weapons like the shotgun to fire)

Expected: Pressing [Enter] while typing only ends the search or sends the chat, ignoring all other actions bound to the enter button for this key press, similarly to how all other keybinds are ignored while typing.

edit 2025-03-15: Updated from version 2.0.28 to 2.0.41 after confirming it is still an issue
Last edited by Elyviere on Sat Mar 15, 2025 7:58 pm, edited 6 times in total.
Kyralessa
Filter Inserter
Filter Inserter
Posts: 695
Joined: Thu Sep 29, 2016 5:58 pm
Contact:

Re: Shoot on [Enter] triggers in text fields

Post by Kyralessa »

I can see two different shoot actions:
  • Shoot enemy
  • Shoot selected
Which one are you binding Enter to?

You should probably be binding to Shoot enemy unless you really want Enter to shoot anything (rocks, trees, chests, etc.).

And then Enter shouldn't shoot unless there's actually an enemy in front of you.
User avatar
Elyviere
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Aug 13, 2016 1:53 am
Contact:

Re: Shoot on [Enter] triggers in text fields

Post by Elyviere »

I have "Shoot enemy" bound to [Enter] and "Shoot selected" bound to [Shift + Enter].

Worth noting that my three weapons are the rocket launcher, shotgun and flamethrower, i.e. none of them require a target.

I've updated my original post to better reflect this, thank you.
Kyralessa
Filter Inserter
Filter Inserter
Posts: 695
Joined: Thu Sep 29, 2016 5:58 pm
Contact:

Re: Shoot on [Enter] triggers in text fields

Post by Kyralessa »

I don't know about the shotgun and the flamethrower, but the rocket launcher definitely requires a target for "Shoot enemy". Are you sure it still happens even with the rocket launcher selected?
User avatar
Elyviere
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Aug 13, 2016 1:53 am
Contact:

Re: Shoot on [Enter] triggers in text fields

Post by Elyviere »

I tested and it does not happen with the rocket launcher, thanks for pointing that out.
User avatar
Elyviere
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Aug 13, 2016 1:53 am
Contact:

Re: Shoot on [Enter] triggers in text fields

Post by Elyviere »

Now that I've got further into the game, I will add that the railgun in fact does not require a target, and my Aquilo base is very sad about that and now lives in fear of me opening up chat.
User avatar
Elyviere
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Aug 13, 2016 1:53 am
Contact:

Re: [2.0.28] Shoot on <Enter> triggers in text fields

Post by Elyviere »

Now that the initial release window has passed and bug fixing slowed (I presume), I'll just bump this bug once so it at least gets a chance.
StrangePan
Factorio Staff
Factorio Staff
Posts: 238
Joined: Fri Dec 07, 2018 3:41 pm
Contact:

Re: [2.0.41] Shoot on <Enter> triggers in text fields

Post by StrangePan »

Keyboard events are intercepted by the GUI as long as a text is focused and are not propagated to the rest of the game. Some controls such as driving controls, walking controls, and shooting controls check the keyboard state every frame instead of only listening for key press and key release events. I believe these controls are internally configured to be "Continuous". SO for example, if "Walk right" is mapped to the D key and D is held while pressing enter to send a chat message, the character will immediately start walking right when the console window is closed. Similarly, if "Shoot enemy"/"Shoot selected" is mapped to enter, and because enter is also used to confirm a GUI dialog or send a chat message, the enter key will by definition be in the pressed state on the frame a chat message is sent, causing the player's weapon to fire.

One possible solution would be to specifically disable continuous controls whenever keyboard controls are unlocked UNTIL they are released. Alternatively, we could only do this specifically for controls mapped to the "enter" key OR only for the "shoot enemy" and "shoot selected" controls if we don't want to apply this to all continuous controls.
Post Reply

Return to “Assigned”