Compare commits

...

3 commits

Author SHA1 Message Date
ea2c5f58ca
v1.0.15 2024-10-04 18:17:35 +05:00
e5c25f310e
clean up previous commit 2024-10-04 18:17:02 +05:00
LostTrackpad
bd4a147c1b
Hotfix for keystrokes glitching with key unbound (#217) 2024-10-04 18:05:52 +05:00
3 changed files with 28 additions and 28 deletions

View file

@ -6,24 +6,34 @@ local color_black = Color(0, 0, 0)
local color_black_t = Color(0, 0, 0, 100)
local size = 35
local function GetFormattedKey(bind)
local keyBind = input.LookupBinding(bind)
if keyBind == "MOUSE1" then keyBind = "LMB"
elseif keyBind == "MOUSE2" then keyBind = "RMB"
elseif keyBind == "MOUSE3" then keyBind = "MMB" end
if keyBind then
return string.upper(keyBind)
else
return "?"
end
end
local function ShowKeyStrokes()
if showKeystrokes:GetBool() and GetConVar("Beatrun_HUDHidden"):GetInt() == 0 then
local forward = string.upper(input.LookupBinding("+forward"))
local back = string.upper(input.LookupBinding("+back"))
local moveleft = string.upper(input.LookupBinding("+moveleft"))
local moveright = string.upper(input.LookupBinding("+moveright"))
local use = string.upper(input.LookupBinding("+use"))
local reload = string.upper(input.LookupBinding("+reload"))
local jump = string.upper(input.LookupBinding("+jump"))
local speed = string.upper(input.LookupBinding("+speed"))
local duck = string.upper(input.LookupBinding("+duck"))
local attack = string.upper(input.LookupBinding("+attack"))
local attack2 = string.upper(input.LookupBinding("+attack2"))
local forward = GetFormattedKey("+forward")
local back = GetFormattedKey("+back")
local moveleft = GetFormattedKey("+moveleft")
local moveright = GetFormattedKey("+moveright")
local use = GetFormattedKey("+use")
local reload = GetFormattedKey("+reload")
local jump = GetFormattedKey("+jump")
local speed = GetFormattedKey("+speed")
local duck = GetFormattedKey("+duck")
local attack = GetFormattedKey("+attack")
local attack2 = GetFormattedKey("+attack2")
if attack == "MOUSE1" then attack = "LMB" end
if attack2 == "MOUSE2" then attack2 = "RMB" end
-- Key W
if LocalPlayer():KeyDown(IN_FORWARD) then
surface.SetDrawColor(color_white_t)
surface.DrawRect(size, 0, size, size)
@ -34,7 +44,6 @@ local function ShowKeyStrokes()
draw.SimpleText(forward, "BeatrunHUD", size + 10, size - 30, color_white)
end
-- Key E
if LocalPlayer():KeyDown(IN_USE) then
surface.SetDrawColor(color_white_t)
surface.DrawRect(size * 2, 0, size, size)
@ -45,7 +54,6 @@ local function ShowKeyStrokes()
draw.SimpleText(use, "BeatrunHUD", size + 48, size - 30, color_white)
end
-- Key R
if LocalPlayer():KeyDown(IN_RELOAD) then
surface.SetDrawColor(color_white_t)
surface.DrawRect(size * 3, 0, size, size)
@ -56,7 +64,6 @@ local function ShowKeyStrokes()
draw.SimpleText(reload, "BeatrunHUD", size * 3 + 12, size - 30, color_white)
end
-- Key A
if LocalPlayer():KeyDown(IN_MOVELEFT) then
surface.SetDrawColor(color_white_t)
surface.DrawRect(0, size, size, size)
@ -67,7 +74,6 @@ local function ShowKeyStrokes()
draw.SimpleText(moveleft, "BeatrunHUD", size - 23, size + 8, color_white)
end
-- Key S
if LocalPlayer():KeyDown(IN_BACK) then
surface.SetDrawColor(color_white_t)
surface.DrawRect(size, size, size, size)
@ -78,7 +84,6 @@ local function ShowKeyStrokes()
draw.SimpleText(back, "BeatrunHUD", size + 12, size + 8, color_white)
end
-- Key D
if LocalPlayer():KeyDown(IN_MOVERIGHT) then
surface.SetDrawColor(color_white_t)
surface.DrawRect(size * 2, size, size, size)
@ -89,7 +94,6 @@ local function ShowKeyStrokes()
draw.SimpleText(moveright, "BeatrunHUD", size + 48, size + 8, color_white)
end
-- Space
if LocalPlayer():KeyDown(IN_JUMP) then
surface.SetDrawColor(color_white_t)
surface.DrawRect(0, size * 2, size * 3, size)
@ -100,7 +104,6 @@ local function ShowKeyStrokes()
draw.SimpleText(jump, "BeatrunHUD", 28, size * 2 + 8, color_white)
end
-- Shift
if LocalPlayer():KeyDown(IN_SPEED) then
surface.SetDrawColor(color_white_t)
surface.DrawRect(0, size * 3, size * 3, size)
@ -111,7 +114,6 @@ local function ShowKeyStrokes()
draw.SimpleText(speed, "BeatrunHUD", 28, size * 3 + 8, color_white)
end
-- Ctrl
if LocalPlayer():KeyDown(IN_DUCK) then
surface.SetDrawColor(color_white_t)
surface.DrawRect(0, size * 4, size * 3, size)
@ -122,7 +124,6 @@ local function ShowKeyStrokes()
draw.SimpleText(duck, "BeatrunHUD", 32, size * 4 + 8, color_white)
end
-- Left Mouse
if LocalPlayer():KeyDown(IN_ATTACK) then
surface.SetDrawColor(color_white_t)
surface.DrawRect(size * 3, size, size * 2, size)
@ -133,7 +134,6 @@ local function ShowKeyStrokes()
draw.SimpleText(attack, "BeatrunHUD", size + 87, size + 8, color_white)
end
-- Right Mouse
if LocalPlayer():KeyDown(IN_ATTACK2) then
surface.SetDrawColor(color_white_t)
surface.DrawRect(size * 3, size * 2, size * 2, size)
@ -146,4 +146,4 @@ local function ShowKeyStrokes()
end
end
hook.Add("HUDPaint", "KeyStrokes", ShowKeyStrokes)
hook.Add("HUDPaint", "KeyStrokes", ShowKeyStrokes)

View file

@ -1,4 +1,4 @@
VERSION_GLOBAL = "1.0.14"
VERSION_GLOBAL = "1.0.15"
VERSION_LATEST = ""
VERSION_CHECKED = false

View file

@ -1 +1 @@
1.0.14
1.0.15