mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-27 20:43:02 +05:00
Hotfix for keystrokes glitching with key unbound (#217)
This commit is contained in:
parent
ec38d2d230
commit
bd4a147c1b
1 changed files with 28 additions and 12 deletions
|
@ -6,19 +6,35 @@ local color_black = Color(0, 0, 0)
|
||||||
local color_black_t = Color(0, 0, 0, 100)
|
local color_black_t = Color(0, 0, 0, 100)
|
||||||
local size = 35
|
local size = 35
|
||||||
|
|
||||||
|
local function GetFormattedKey(bind)
|
||||||
|
string = input.LookupBinding(bind)
|
||||||
|
|
||||||
|
if string == "MOUSE1" then string = "LMB"
|
||||||
|
elseif string == "MOUSE2" then string = "RMB"
|
||||||
|
elseif string == "MOUSE3" then string = "MMB" end
|
||||||
|
|
||||||
|
if string then
|
||||||
|
return string.upper(string)
|
||||||
|
else
|
||||||
|
return "???"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function ShowKeyStrokes()
|
local function ShowKeyStrokes()
|
||||||
if showKeystrokes:GetBool() and GetConVar("Beatrun_HUDHidden"):GetInt() == 0 then
|
if showKeystrokes:GetBool() and GetConVar("Beatrun_HUDHidden"):GetInt() == 0 then
|
||||||
local forward = string.upper(input.LookupBinding("+forward"))
|
-- will have inconsistent indent on GH web view, thanks github
|
||||||
local back = string.upper(input.LookupBinding("+back"))
|
-- absolutely indented correctly, view in an editor like vscode
|
||||||
local moveleft = string.upper(input.LookupBinding("+moveleft"))
|
local forward = GetFormattedKey("+forward")
|
||||||
local moveright = string.upper(input.LookupBinding("+moveright"))
|
local back = GetFormattedKey("+back")
|
||||||
local use = string.upper(input.LookupBinding("+use"))
|
local moveleft = GetFormattedKey("+moveleft")
|
||||||
local reload = string.upper(input.LookupBinding("+reload"))
|
local moveright = GetFormattedKey("+moveright")
|
||||||
local jump = string.upper(input.LookupBinding("+jump"))
|
local use = GetFormattedKey("+use")
|
||||||
local speed = string.upper(input.LookupBinding("+speed"))
|
local reload = GetFormattedKey("+reload")
|
||||||
local duck = string.upper(input.LookupBinding("+duck"))
|
local jump = GetFormattedKey("+jump")
|
||||||
local attack = string.upper(input.LookupBinding("+attack"))
|
local speed = GetFormattedKey("+speed")
|
||||||
local attack2 = string.upper(input.LookupBinding("+attack2"))
|
local duck = GetFormattedKey("+duck")
|
||||||
|
local attack = GetFormattedKey("+attack")
|
||||||
|
local attack2 = GetFormattedKey("+attack2")
|
||||||
|
|
||||||
if attack == "MOUSE1" then attack = "LMB" end
|
if attack == "MOUSE1" then attack = "LMB" end
|
||||||
if attack2 == "MOUSE2" then attack2 = "RMB" end
|
if attack2 == "MOUSE2" then attack2 = "RMB" end
|
||||||
|
@ -146,4 +162,4 @@ local function ShowKeyStrokes()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("HUDPaint", "KeyStrokes", ShowKeyStrokes)
|
hook.Add("HUDPaint", "KeyStrokes", ShowKeyStrokes)
|
||||||
|
|
Loading…
Reference in a new issue