diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua b/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua index 881ca02..a5b4fc7 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua @@ -131,14 +131,14 @@ local function BeatrunHUD() surface.SetFont("DebugFixedSmall") - local version_text = "v" .. VERSIONGLOBAL + local version_text = "v" .. VERSION_GLOBAL local tw, _ = surface.GetTextSize(version_text) surface.SetTextColor(255, 255, 255, 20) surface.SetTextPos(scrw - tw, 0) surface.DrawText(version_text) surface.SetFont("BeatrunHUD") - if VERSIONGLOBAL ~= VERSIONLATEST then + if VERSION_GLOBAL ~= VERSION_LATEST then local update_text = "Update available!" local notlatest_w, _ = surface.GetTextSize(update_text) surface.SetTextColor(255, 255, 255, 30) diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/Keystrokes.lua b/beatrun/gamemodes/beatrun/gamemode/cl/Keystrokes.lua index dd876ca..cd36921 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/Keystrokes.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/Keystrokes.lua @@ -8,125 +8,140 @@ local size = 35 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")) + + 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) - draw.SimpleText("W", "BeatrunHUD", size + 10, size - 30, color_black) + draw.SimpleText(forward, "BeatrunHUD", size + 10, size - 30, color_black) else surface.SetDrawColor(color_black_t) surface.DrawRect(size, 0, size, size) - draw.SimpleText("W", "BeatrunHUD", size + 10, size - 30, color_white) + 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) - draw.SimpleText("E", "BeatrunHUD", size + 48, size - 30, color_black) + draw.SimpleText(use, "BeatrunHUD", size + 48, size - 30, color_black) else surface.SetDrawColor(color_black_t) surface.DrawRect(size * 2, 0, size, size) - draw.SimpleText("E", "BeatrunHUD", size + 48, size - 30, color_white) + 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) - draw.SimpleText("R", "BeatrunHUD", size * 3 + 12, size - 30, color_black) + draw.SimpleText(reload, "BeatrunHUD", size * 3 + 12, size - 30, color_black) else surface.SetDrawColor(color_black_t) surface.DrawRect(size * 3, 0, size, size) - draw.SimpleText("R", "BeatrunHUD", size * 3 + 12, size - 30, color_white) + 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) - draw.SimpleText("A", "BeatrunHUD", size - 23, size + 8, color_black) + draw.SimpleText(moveleft, "BeatrunHUD", size - 23, size + 8, color_black) else surface.SetDrawColor(color_black_t) surface.DrawRect(0, size, size, size) - draw.SimpleText("A", "BeatrunHUD", size - 23, size + 8, color_white) + 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) - draw.SimpleText("S", "BeatrunHUD", size + 12, size + 8, color_black) + draw.SimpleText(back, "BeatrunHUD", size + 12, size + 8, color_black) else surface.SetDrawColor(color_black_t) surface.DrawRect(size, size, size, size) - draw.SimpleText("S", "BeatrunHUD", size + 12, size + 8, color_white) + 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) - draw.SimpleText("D", "BeatrunHUD", size + 48, size + 8, color_black) + draw.SimpleText(moveright, "BeatrunHUD", size + 48, size + 8, color_black) else surface.SetDrawColor(color_black_t) surface.DrawRect(size * 2, size, size, size) - draw.SimpleText("D", "BeatrunHUD", size + 48, size + 8, color_white) + 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) - draw.SimpleText("SPACE", "BeatrunHUD", 28, size * 2 + 8, color_black) + draw.SimpleText(jump, "BeatrunHUD", 28, size * 2 + 8, color_black) else surface.SetDrawColor(color_black_t) surface.DrawRect(0, size * 2, size * 3, size) - draw.SimpleText("SPACE", "BeatrunHUD", 28, size * 2 + 8, color_white) + 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) - draw.SimpleText("SHIFT", "BeatrunHUD", 28, size * 3 + 8, color_black) + draw.SimpleText(speed, "BeatrunHUD", 28, size * 3 + 8, color_black) else surface.SetDrawColor(color_black_t) surface.DrawRect(0, size * 3, size * 3, size) - draw.SimpleText("SHIFT", "BeatrunHUD", 28, size * 3 + 8, color_white) + 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) - draw.SimpleText("CTRL", "BeatrunHUD", 32, size * 4 + 8, color_black) + draw.SimpleText(duck, "BeatrunHUD", 32, size * 4 + 8, color_black) else surface.SetDrawColor(color_black_t) surface.DrawRect(0, size * 4, size * 3, size) - draw.SimpleText("CTRL", "BeatrunHUD", 32, size * 4 + 8, color_white) + 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) - draw.SimpleText("LMB", "BeatrunHUD", size + 87, size + 8, color_black) + draw.SimpleText(attack, "BeatrunHUD", size + 87, size + 8, color_black) else surface.SetDrawColor(color_black_t) surface.DrawRect(size * 3, size, size * 2, size) - draw.SimpleText("LMB", "BeatrunHUD", size + 87, size + 8, color_white) + 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) - draw.SimpleText("RMB", "BeatrunHUD", size + 86, size * 2 + 8, color_black) + draw.SimpleText(attack2, "BeatrunHUD", size + 86, size * 2 + 8, color_black) else surface.SetDrawColor(color_black_t) surface.DrawRect(size * 3, size * 2, size * 2, size) - draw.SimpleText("RMB", "BeatrunHUD", size + 86, size * 2 + 8, color_white) + draw.SimpleText(attack2, "BeatrunHUD", size + 86, size * 2 + 8, color_white) end end end diff --git a/beatrun/gamemodes/beatrun/gamemode/shared.lua b/beatrun/gamemodes/beatrun/gamemode/shared.lua index a07d7df..d9ccf2d 100644 --- a/beatrun/gamemodes/beatrun/gamemode/shared.lua +++ b/beatrun/gamemodes/beatrun/gamemode/shared.lua @@ -1,5 +1,6 @@ -VERSIONGLOBAL = "1.0.13" -VERSIONLATEST = "" +VERSION_GLOBAL = "1.0.14" +VERSION_LATEST = "" +VERSION_CHECKED = false DeriveGamemode("sandbox") @@ -15,12 +16,28 @@ for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/sh/*.lua", "GAME", "nam include("sh/" .. v) end -http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code) - if code == 200 then - VERSIONLATEST = body:gsub("[\n\r]", "") - else - print("Error while checking version (not 200 code):\n" .. body) - end -end, function(e) - print("Error while checking version (error on fetch):\n" .. e) -end) \ No newline at end of file +if not VERSION_CHECKED then + http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code) + if code == 200 then + VERSION_LATEST = body:gsub("[\n\r]", "") + print("Latest version: " .. VERSION_LATEST) + + if VERSION_LATEST > VERSION_GLOBAL then + print("Your version is behind latest, please update.") + elseif VERSION_LATEST == VERSION_GLOBAL then + print("You're up to date, nice!") + else + print("Your version is ahead of latest. Huh?") + end + + VERSION_CHECKED = true + + return + else + print("Error while checking version (not 200 code):\n" .. body) + VERSION_CHECKED = true + + return + end + end) +end \ No newline at end of file diff --git a/version.txt b/version.txt index 9256e28..97bceaa 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.13 \ No newline at end of file +1.0.14 \ No newline at end of file