lance-gg / lance

Multiplayer game server based on Node.JS
https://lance-gg.github.io/
Apache License 2.0
1.57k stars 165 forks source link

bindKey with inputOptions for sendInput #131

Closed wooki closed 4 years ago

wooki commented 4 years ago

Add a new parameter to the bindKey method to specify inputOptions. I have a case where more than one piece of information was needed in a call to sendInput, which is easy to achieve by directly calling it in an event handler but to bind that to a keypress meant manually repeating lots of the code already in KeyboardControls class.

This implementation allows for either the data to be passed, or a callback which allows for more generic handling.

Have kept the movement:true inputOption as I am unaware if that is actually needed internally but this could be a good time to remove that is somebody who knows more than me knows if it is needed.

namel commented 4 years ago

nice addition. Thanks!