mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-27 20:43:02 +05:00
clean up previous commit
This commit is contained in:
parent
bd4a147c1b
commit
e5c25f310e
1 changed files with 18 additions and 34 deletions
|
@ -7,39 +7,33 @@ local color_black_t = Color(0, 0, 0, 100)
|
||||||
local size = 35
|
local size = 35
|
||||||
|
|
||||||
local function GetFormattedKey(bind)
|
local function GetFormattedKey(bind)
|
||||||
string = input.LookupBinding(bind)
|
local keyBind = input.LookupBinding(bind)
|
||||||
|
|
||||||
if string == "MOUSE1" then string = "LMB"
|
if keyBind == "MOUSE1" then keyBind = "LMB"
|
||||||
elseif string == "MOUSE2" then string = "RMB"
|
elseif keyBind == "MOUSE2" then keyBind = "RMB"
|
||||||
elseif string == "MOUSE3" then string = "MMB" end
|
elseif keyBind == "MOUSE3" then keyBind = "MMB" end
|
||||||
|
|
||||||
if string then
|
if keyBind then
|
||||||
return string.upper(string)
|
return string.upper(keyBind)
|
||||||
else
|
else
|
||||||
return "???"
|
return "?"
|
||||||
end
|
end
|
||||||
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
|
||||||
-- will have inconsistent indent on GH web view, thanks github
|
local forward = GetFormattedKey("+forward")
|
||||||
-- absolutely indented correctly, view in an editor like vscode
|
local back = GetFormattedKey("+back")
|
||||||
local forward = GetFormattedKey("+forward")
|
local moveleft = GetFormattedKey("+moveleft")
|
||||||
local back = GetFormattedKey("+back")
|
local moveright = GetFormattedKey("+moveright")
|
||||||
local moveleft = GetFormattedKey("+moveleft")
|
local use = GetFormattedKey("+use")
|
||||||
local moveright = GetFormattedKey("+moveright")
|
local reload = GetFormattedKey("+reload")
|
||||||
local use = GetFormattedKey("+use")
|
local jump = GetFormattedKey("+jump")
|
||||||
local reload = GetFormattedKey("+reload")
|
local speed = GetFormattedKey("+speed")
|
||||||
local jump = GetFormattedKey("+jump")
|
local duck = GetFormattedKey("+duck")
|
||||||
local speed = GetFormattedKey("+speed")
|
local attack = GetFormattedKey("+attack")
|
||||||
local duck = GetFormattedKey("+duck")
|
local attack2 = GetFormattedKey("+attack2")
|
||||||
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
|
if LocalPlayer():KeyDown(IN_FORWARD) then
|
||||||
surface.SetDrawColor(color_white_t)
|
surface.SetDrawColor(color_white_t)
|
||||||
surface.DrawRect(size, 0, size, size)
|
surface.DrawRect(size, 0, size, size)
|
||||||
|
@ -50,7 +44,6 @@ local function ShowKeyStrokes()
|
||||||
draw.SimpleText(forward, "BeatrunHUD", size + 10, size - 30, color_white)
|
draw.SimpleText(forward, "BeatrunHUD", size + 10, size - 30, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Key E
|
|
||||||
if LocalPlayer():KeyDown(IN_USE) then
|
if LocalPlayer():KeyDown(IN_USE) then
|
||||||
surface.SetDrawColor(color_white_t)
|
surface.SetDrawColor(color_white_t)
|
||||||
surface.DrawRect(size * 2, 0, size, size)
|
surface.DrawRect(size * 2, 0, size, size)
|
||||||
|
@ -61,7 +54,6 @@ local function ShowKeyStrokes()
|
||||||
draw.SimpleText(use, "BeatrunHUD", size + 48, size - 30, color_white)
|
draw.SimpleText(use, "BeatrunHUD", size + 48, size - 30, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Key R
|
|
||||||
if LocalPlayer():KeyDown(IN_RELOAD) then
|
if LocalPlayer():KeyDown(IN_RELOAD) then
|
||||||
surface.SetDrawColor(color_white_t)
|
surface.SetDrawColor(color_white_t)
|
||||||
surface.DrawRect(size * 3, 0, size, size)
|
surface.DrawRect(size * 3, 0, size, size)
|
||||||
|
@ -72,7 +64,6 @@ local function ShowKeyStrokes()
|
||||||
draw.SimpleText(reload, "BeatrunHUD", size * 3 + 12, size - 30, color_white)
|
draw.SimpleText(reload, "BeatrunHUD", size * 3 + 12, size - 30, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Key A
|
|
||||||
if LocalPlayer():KeyDown(IN_MOVELEFT) then
|
if LocalPlayer():KeyDown(IN_MOVELEFT) then
|
||||||
surface.SetDrawColor(color_white_t)
|
surface.SetDrawColor(color_white_t)
|
||||||
surface.DrawRect(0, size, size, size)
|
surface.DrawRect(0, size, size, size)
|
||||||
|
@ -83,7 +74,6 @@ local function ShowKeyStrokes()
|
||||||
draw.SimpleText(moveleft, "BeatrunHUD", size - 23, size + 8, color_white)
|
draw.SimpleText(moveleft, "BeatrunHUD", size - 23, size + 8, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Key S
|
|
||||||
if LocalPlayer():KeyDown(IN_BACK) then
|
if LocalPlayer():KeyDown(IN_BACK) then
|
||||||
surface.SetDrawColor(color_white_t)
|
surface.SetDrawColor(color_white_t)
|
||||||
surface.DrawRect(size, size, size, size)
|
surface.DrawRect(size, size, size, size)
|
||||||
|
@ -94,7 +84,6 @@ local function ShowKeyStrokes()
|
||||||
draw.SimpleText(back, "BeatrunHUD", size + 12, size + 8, color_white)
|
draw.SimpleText(back, "BeatrunHUD", size + 12, size + 8, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Key D
|
|
||||||
if LocalPlayer():KeyDown(IN_MOVERIGHT) then
|
if LocalPlayer():KeyDown(IN_MOVERIGHT) then
|
||||||
surface.SetDrawColor(color_white_t)
|
surface.SetDrawColor(color_white_t)
|
||||||
surface.DrawRect(size * 2, size, size, size)
|
surface.DrawRect(size * 2, size, size, size)
|
||||||
|
@ -105,7 +94,6 @@ local function ShowKeyStrokes()
|
||||||
draw.SimpleText(moveright, "BeatrunHUD", size + 48, size + 8, color_white)
|
draw.SimpleText(moveright, "BeatrunHUD", size + 48, size + 8, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Space
|
|
||||||
if LocalPlayer():KeyDown(IN_JUMP) then
|
if LocalPlayer():KeyDown(IN_JUMP) then
|
||||||
surface.SetDrawColor(color_white_t)
|
surface.SetDrawColor(color_white_t)
|
||||||
surface.DrawRect(0, size * 2, size * 3, size)
|
surface.DrawRect(0, size * 2, size * 3, size)
|
||||||
|
@ -116,7 +104,6 @@ local function ShowKeyStrokes()
|
||||||
draw.SimpleText(jump, "BeatrunHUD", 28, size * 2 + 8, color_white)
|
draw.SimpleText(jump, "BeatrunHUD", 28, size * 2 + 8, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Shift
|
|
||||||
if LocalPlayer():KeyDown(IN_SPEED) then
|
if LocalPlayer():KeyDown(IN_SPEED) then
|
||||||
surface.SetDrawColor(color_white_t)
|
surface.SetDrawColor(color_white_t)
|
||||||
surface.DrawRect(0, size * 3, size * 3, size)
|
surface.DrawRect(0, size * 3, size * 3, size)
|
||||||
|
@ -127,7 +114,6 @@ local function ShowKeyStrokes()
|
||||||
draw.SimpleText(speed, "BeatrunHUD", 28, size * 3 + 8, color_white)
|
draw.SimpleText(speed, "BeatrunHUD", 28, size * 3 + 8, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Ctrl
|
|
||||||
if LocalPlayer():KeyDown(IN_DUCK) then
|
if LocalPlayer():KeyDown(IN_DUCK) then
|
||||||
surface.SetDrawColor(color_white_t)
|
surface.SetDrawColor(color_white_t)
|
||||||
surface.DrawRect(0, size * 4, size * 3, size)
|
surface.DrawRect(0, size * 4, size * 3, size)
|
||||||
|
@ -138,7 +124,6 @@ local function ShowKeyStrokes()
|
||||||
draw.SimpleText(duck, "BeatrunHUD", 32, size * 4 + 8, color_white)
|
draw.SimpleText(duck, "BeatrunHUD", 32, size * 4 + 8, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Left Mouse
|
|
||||||
if LocalPlayer():KeyDown(IN_ATTACK) then
|
if LocalPlayer():KeyDown(IN_ATTACK) then
|
||||||
surface.SetDrawColor(color_white_t)
|
surface.SetDrawColor(color_white_t)
|
||||||
surface.DrawRect(size * 3, size, size * 2, size)
|
surface.DrawRect(size * 3, size, size * 2, size)
|
||||||
|
@ -149,7 +134,6 @@ local function ShowKeyStrokes()
|
||||||
draw.SimpleText(attack, "BeatrunHUD", size + 87, size + 8, color_white)
|
draw.SimpleText(attack, "BeatrunHUD", size + 87, size + 8, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Right Mouse
|
|
||||||
if LocalPlayer():KeyDown(IN_ATTACK2) then
|
if LocalPlayer():KeyDown(IN_ATTACK2) then
|
||||||
surface.SetDrawColor(color_white_t)
|
surface.SetDrawColor(color_white_t)
|
||||||
surface.DrawRect(size * 3, size * 2, size * 2, size)
|
surface.DrawRect(size * 3, size * 2, size * 2, size)
|
||||||
|
|
Loading…
Reference in a new issue