suroi icon indicating copy to clipboard operation
suroi copied to clipboard

Fix on the getKeyFromInputEvent function. (inputManager.ts)

Open pap-24 opened this issue 10 months ago • 0 comments

Hello again, here's the updated version of my bug fix without the use of the depreciated event.keyCode. This time I used event.code as one of you told me to look into (I think it was ei-pi).

Anyways, my goal is to fix the bug where the keyboard events are not read correctly due to event.key not having a constant value in different keyboard languages (for example, Greek/ΕΛ ). My fix basically uses the event.code by removing the "Key" from the string so we can have a correct reading on the key that was pressed (for example, "R", which is for reload by default).

For your information, I created the bug fix by hosting the game locally in my computer and tested it as well.

By the way, the semicolon seemed to have an issue so I added a special case for it because the value it was returning with event.key was "Dead".

Ignore the Update inputManager commit (because it's the code without the bug fix that I reverted for a test), I encountered an issue and could not commit the new version with the bug fix and it wouldn't let me PR.

pap-24 avatar Apr 08 '24 12:04 pap-24