diff --git a/scripts/client/keybind.js b/scripts/client/keybind.js index fdb5007a..0e2a214f 100644 --- a/scripts/client/keybind.js +++ b/scripts/client/keybind.js @@ -25,9 +25,16 @@ function initKeyBindScript() { function bindAccountKey(key, keyState) { logToConsole(LOG_DEBUG, `[Asshat.KeyBind]: Binded key ${sdl.getKeyName(key)} (${key})`); bindKey(toInteger(key), keyState, function(event) { - if(hasKeyBindDelayElapsed() && canLocalPlayerUseKeyBinds()) { - lastKeyBindUse = sdl.ticks; - tellServerPlayerUsedKeyBind(key); + if(hasKeyBindDelayElapsed()) { + if(canLocalPlayerUseKeyBinds()) { + logToConsole(LOG_DEBUG, `[Asshat.KeyBind]: Using keybind for key ${sdl.getKeyName(key)} (${key})`); + lastKeyBindUse = sdl.ticks; + tellServerPlayerUsedKeyBind(key); + } else { + logToConsole(LOG_ERROR, `[Asshat.KeyBind]: Failed to use keybind for key ${sdl.getKeyName(key)} (${key}) - Not allowed to use keybinds!`); + } + } else { + logToConsole(LOG_ERROR, `[Asshat.KeyBind]: Failed to use keybind for key ${sdl.getKeyName(key)} (${key}) - Not enough time has passed since last keybind use!`); } }); } @@ -52,23 +59,8 @@ function hasKeyBindDelayElapsed() { // =========================================================================== -function hasKeyBindHoldElapsed(keyState) { - let holdDuration = AG_KEYSTATE_HOLDSHORT - if(keyState == AG_KEYSTATE_HOLDLONG) { - holdDuration = keyBindLongHoldDuration; - } - - if(sdl.ticks-keyBindHoldStart >= holdDuration) { - return true; - } - - return false; -} - -// =========================================================================== - function canLocalPlayerUseKeyBinds() { - return (!usingSkinSelector && isSpawned && !itemActionDelayEnabled); + return true; //(!usingSkinSelector && isSpawned && !itemActionDelayEnabled); } // =========================================================================== \ No newline at end of file