diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties index 6f11804..8f2aa14 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties @@ -124,6 +124,9 @@ beatrun.toolsmenu.hud.textcolor=HUD Text Color beatrun.toolsmenu.hud.cornercolor=HUD Corner Color beatrun.toolsmenu.hud.floatxpcolor=HUD Floating XP Color +beatrun.toolsmenu.hud.buttonhints=Show Button Hints +beatrun.toolsmenu.hud.buttonhintsdesc=Display button hints on the bottom right of the HUD. + # Tools Menu Camera Section beatrun.toolsmenu.camera.name=Camera beatrun.toolsmenu.camera.desc=Camera Settings @@ -269,3 +272,28 @@ beatrun.infection.end=The game has ended!\nSurvivors: %s\nRestarting in 15s # Server ConVars beatrun.randommwloadouts=Random MW Base Loadouts beatrun.randommwloadoutsdesc=Toggles random MW Base loadouts in Deathmatch and DataTheft + +# Button hints thingy +beatrun.buttonhints.hold=(Hold) +beatrun.buttonhints.timed=(Timed) +beatrun.buttonhints.ttcheckpoint=Return To Checkpoint +beatrun.buttonhints.ttrestart=Restart Course +beatrun.buttonhints.sidestep=Sidestep +beatrun.buttonhints.quickturn=Quickturn +beatrun.buttonhints.dive=Dive +beatrun.buttonhints.crouchjump=Coil +beatrun.buttonhints.fasthorfall=Safety Roll +beatrun.buttonhints.slowhorfall=Safe Landing +beatrun.buttonhints.vaultjump=Springboard +beatrun.buttonhints.move=Move +beatrun.buttonhints.jump=Jump +beatrun.buttonhints.drop=Drop +beatrun.buttonhints.climb=Climb Up +beatrun.buttonhints.ladderdescend=Slide Down +beatrun.buttonhints.balance=Balance +beatrun.buttonhints.balanceturn=Turn Around +beatrun.buttonhints.balanceforward=Move Forward +beatrun.buttonhints.grapplelonger=Extend Grapple +beatrun.buttonhints.grappleshorter=Shorten Grapple +beatrun.buttonhints.wallclimbcancel=Cancel Wallclimb +beatrun.buttonhints.wallclimbsidejump=Side Jump \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/it/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/it/beatrun.properties index a43c364..8468f70 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/it/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/it/beatrun.properties @@ -114,6 +114,9 @@ beatrun.toolsmenu.hud.textcolor=Colore del testo dell'HUD beatrun.toolsmenu.hud.cornercolor=Colore del bordo dell'HUD beatrun.toolsmenu.hud.floatxpcolor=Colore XP mobile dell'HUD +beatrun.toolsmenu.hud.buttonhints= +beatrun.toolsmenu.hud.buttonhintsdesc= + # Tools Menu Camera Section beatrun.toolsmenu.camera.name=Camera beatrun.toolsmenu.camera.desc=Impostazioni Camera @@ -231,3 +234,28 @@ beatrun.infection.infectedby=ha contagiato beatrun.infection.award=Ti sono stati assegnati 200 XP per essere sopravvissuto! beatrun.infection.awardinfected=Ti sono stati assegnati 100 XP per essere generato come infetto! beatrun.infection.end=La partita è finita\nSopravvissuti: %s\nRiavvio in 15s + +# Button hints thingy +beatrun.buttonhints.hold= +beatrun.buttonhints.timed= +beatrun.buttonhints.ttcheckpoint= +beatrun.buttonhints.ttrestart= +beatrun.buttonhints.sidestep= +beatrun.buttonhints.quickturn= +beatrun.buttonhints.dive= +beatrun.buttonhints.crouchjump= +beatrun.buttonhints.fasthorfall= +beatrun.buttonhints.slowhorfall= +beatrun.buttonhints.vaultjump= +beatrun.buttonhints.move= +beatrun.buttonhints.jump= +beatrun.buttonhints.drop= +beatrun.buttonhints.climb= +beatrun.buttonhints.ladderdescend= +beatrun.buttonhints.balance= +beatrun.buttonhints.balanceturn= +beatrun.buttonhints.balanceforward= +beatrun.buttonhints.grapplelonger= +beatrun.buttonhints.grappleshorter= +beatrun.buttonhints.wallclimbcancel= +beatrun.buttonhints.wallclimbsidejump= \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/pl/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/pl/beatrun.properties index 16b751f..f9b94e7 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/pl/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/pl/beatrun.properties @@ -124,6 +124,9 @@ beatrun.toolsmenu.hud.textcolor=Kolor tekstu interfejsu beatrun.toolsmenu.hud.cornercolor=Kolor rogu interfejsu beatrun.toolsmenu.hud.floatxpcolor=Kolor "unoszących się" punktów PD na interfejsie +beatrun.toolsmenu.hud.buttonhints= +beatrun.toolsmenu.hud.buttonhintsdesc= + # Tools Menu Camera Section beatrun.toolsmenu.camera.name=Kołysanie kamery w ruchu beatrun.toolsmenu.camera.desc=Ustawienia kołysania kamery w ruchu @@ -269,3 +272,28 @@ beatrun.infection.end=Rozgrywka zakończkona!\nPrzetrwańcy: %s\nReset za 15s # Server ConVars beatrun.randommwloadouts=Losowe uzbrojenie MW Base beatrun.randommwloadoutsdesc=Włącz/Wyłącz losowe uzbrojenie MW Base w trybach Pojedynku i Kradzieży danych + +# Button hints thingy +beatrun.buttonhints.hold= +beatrun.buttonhints.timed= +beatrun.buttonhints.ttcheckpoint= +beatrun.buttonhints.ttrestart= +beatrun.buttonhints.sidestep= +beatrun.buttonhints.quickturn= +beatrun.buttonhints.dive= +beatrun.buttonhints.crouchjump= +beatrun.buttonhints.fasthorfall= +beatrun.buttonhints.slowhorfall= +beatrun.buttonhints.vaultjump= +beatrun.buttonhints.move= +beatrun.buttonhints.jump= +beatrun.buttonhints.drop= +beatrun.buttonhints.climb= +beatrun.buttonhints.ladderdescend= +beatrun.buttonhints.balance= +beatrun.buttonhints.balanceturn= +beatrun.buttonhints.balanceforward= +beatrun.buttonhints.grapplelonger= +beatrun.buttonhints.grappleshorter= +beatrun.buttonhints.wallclimbcancel= +beatrun.buttonhints.wallclimbsidejump= \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/pt-BR/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/pt-BR/beatrun.properties index b4a6875..b0607c5 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/pt-BR/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/pt-BR/beatrun.properties @@ -116,6 +116,9 @@ beatrun.toolsmenu.hud.textcolor=Cor de Texto da HUD beatrun.toolsmenu.hud.cornercolor=Color do Canto da HUD beatrun.toolsmenu.hud.floatxpcolor=Color do XP Flutuante +beatrun.toolsmenu.hud.buttonhints= +beatrun.toolsmenu.hud.buttonhintsdesc= + # Tools Menu Camera Section beatrun.toolsmenu.camera.name=Viewbob beatrun.toolsmenu.camera.desc=Configuraçoes do Viewbob @@ -235,3 +238,28 @@ beatrun.infection.infectedby=infectou beatrun.infection.award=Você ganhou 200 XP por sobreviver como Humano! beatrun.infection.awardinfected=Você ganhou 100 XP por spawnar como Infectado! beatrun.infection.end=O Jogo Terminou!\nSobreviventes: %s\nReiniciando em 15s + +# Button hints thingy +beatrun.buttonhints.hold= +beatrun.buttonhints.timed= +beatrun.buttonhints.ttcheckpoint= +beatrun.buttonhints.ttrestart= +beatrun.buttonhints.sidestep= +beatrun.buttonhints.quickturn= +beatrun.buttonhints.dive= +beatrun.buttonhints.crouchjump= +beatrun.buttonhints.fasthorfall= +beatrun.buttonhints.slowhorfall= +beatrun.buttonhints.vaultjump= +beatrun.buttonhints.move= +beatrun.buttonhints.jump= +beatrun.buttonhints.drop= +beatrun.buttonhints.climb= +beatrun.buttonhints.ladderdescend= +beatrun.buttonhints.balance= +beatrun.buttonhints.balanceturn= +beatrun.buttonhints.balanceforward= +beatrun.buttonhints.grapplelonger= +beatrun.buttonhints.grappleshorter= +beatrun.buttonhints.wallclimbcancel= +beatrun.buttonhints.wallclimbsidejump= \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties index 6ffac5f..04e218a 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties @@ -121,6 +121,9 @@ beatrun.toolsmenu.hud.textcolor=Цвет Текста в HUD beatrun.toolsmenu.hud.cornercolor=Цвет Края в HUD beatrun.toolsmenu.hud.floatxpcolor=Цвет Всплывающего XP в HUD +beatrun.toolsmenu.hud.buttonhints=Показывать подсказки клавиш +beatrun.toolsmenu.hud.buttonhintsdesc=Показывает подсказки по клавишам в правом нижнем углу + # Tools Menu Camera Section beatrun.toolsmenu.camera.name=Камера beatrun.toolsmenu.camera.desc=Настройки камеры @@ -266,3 +269,28 @@ beatrun.infection.end=Игра окончена!\nВыжившие: %s\nПере # Server ConVars beatrun.randommwloadouts=Случайные наборы оружия MW Base beatrun.randommwloadoutsdesc=Переключает случайные наборы оружия MW Base в Deathmatch и DataTheft + +# Button Hints +beatrun.buttonhints.hold=(держать) +beatrun.buttonhints.timed=(тайминг) +beatrun.buttonhints.ttcheckpoint=Вернуться к чекпоинту +beatrun.buttonhints.ttrestart=Перезапустить курс +beatrun.buttonhints.sidestep=Рывок в строну +beatrun.buttonhints.quickturn=Быстрый разворот +beatrun.buttonhints.dive=Нырнуть +beatrun.buttonhints.crouchjump=Поджать ноги +beatrun.buttonhints.fasthorfall=Кувырок +beatrun.buttonhints.slowhorfall=Безопасное приземление +beatrun.buttonhints.vaultjump=Отпрыгнуть +beatrun.buttonhints.move=Движение +beatrun.buttonhints.jump=Прыжок +beatrun.buttonhints.drop=Спрыгнуть +beatrun.buttonhints.climb=Подняться +beatrun.buttonhints.ladderdescend=Спуститься +beatrun.buttonhints.balance=Балансировать +beatrun.buttonhints.balanceturn=Развернуться +beatrun.buttonhints.balanceforward=Идти вперёд +beatrun.buttonhints.grapplelonger=Увеличить верёвку +beatrun.buttonhints.grappleshorter=Укоротить верёвку +beatrun.buttonhints.wallclimbcancel=Слезть со стены +beatrun.buttonhints.wallclimbsidejump=Прыжок в сторону diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/tr/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/tr/beatrun.properties index a9c9fc3..5955519 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/tr/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/tr/beatrun.properties @@ -116,6 +116,9 @@ beatrun.toolsmenu.hud.textcolor=Arayüz Metin Rengi beatrun.toolsmenu.hud.cornercolor=Arayüz Köşe Rengi beatrun.toolsmenu.hud.floatxpcolor=Arayüz Süzülen XP Rengi +beatrun.toolsmenu.hud.buttonhints= +beatrun.toolsmenu.hud.buttonhintsdesc= + # Tools Menu Camera Section beatrun.toolsmenu.camera.name=Görüntü Sarsılması beatrun.toolsmenu.camera.desc=Görüntü Sarsılma Ayarları @@ -235,3 +238,28 @@ beatrun.infection.infectedby=enfekte etti beatrun.infection.award=Hayatta kaldığın için 200 XP ile ödüllendirildin! beatrun.infection.awardinfected=Enfekte olarak canlandığın için 100 XP ile ödüllendirildin! beatrun.infection.end=Oyun sona erdi!\nYaşayanlar: %s\n15 saniye içinde \nyeniden başlıyor + +# Button hints thingy +beatrun.buttonhints.hold= +beatrun.buttonhints.timed= +beatrun.buttonhints.ttcheckpoint= +beatrun.buttonhints.ttrestart= +beatrun.buttonhints.sidestep= +beatrun.buttonhints.quickturn= +beatrun.buttonhints.dive= +beatrun.buttonhints.crouchjump= +beatrun.buttonhints.fasthorfall= +beatrun.buttonhints.slowhorfall= +beatrun.buttonhints.vaultjump= +beatrun.buttonhints.move= +beatrun.buttonhints.jump= +beatrun.buttonhints.drop= +beatrun.buttonhints.climb= +beatrun.buttonhints.ladderdescend= +beatrun.buttonhints.balance= +beatrun.buttonhints.balanceturn= +beatrun.buttonhints.balanceforward= +beatrun.buttonhints.grapplelonger= +beatrun.buttonhints.grappleshorter= +beatrun.buttonhints.wallclimbcancel= +beatrun.buttonhints.wallclimbsidejump= \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/uk/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/uk/beatrun.properties index c8e3b7b..dea972d 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/uk/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/uk/beatrun.properties @@ -120,6 +120,9 @@ beatrun.toolsmenu.hud.textcolor=Колір Тексту в HUD beatrun.toolsmenu.hud.cornercolor=Колір Краю в HUD beatrun.toolsmenu.hud.floatxpcolor=Колір спливаючого XP в HUD +beatrun.toolsmenu.hud.buttonhints= +beatrun.toolsmenu.hud.buttonhintsdesc= + # Tools Menu Camera Section beatrun.toolsmenu.camera.name=Покачування Камери beatrun.toolsmenu.camera.desc=Налаштування похитування камери @@ -252,3 +255,28 @@ beatrun.infection.end=Гра закінчена!\nВиживші: %s\nПерез # Server ConVars beatrun.randommwloadouts=Випадкові набори зброї MW Base beatrun.randommwloadoutsdesc=Перемикає випадкові набори зброї MW Base у Deathmatch і DataTheft + +# Button hints thingy +beatrun.buttonhints.hold= +beatrun.buttonhints.timed= +beatrun.buttonhints.ttcheckpoint= +beatrun.buttonhints.ttrestart= +beatrun.buttonhints.sidestep= +beatrun.buttonhints.quickturn= +beatrun.buttonhints.dive= +beatrun.buttonhints.crouchjump= +beatrun.buttonhints.fasthorfall= +beatrun.buttonhints.slowhorfall= +beatrun.buttonhints.vaultjump= +beatrun.buttonhints.move= +beatrun.buttonhints.jump= +beatrun.buttonhints.drop= +beatrun.buttonhints.climb= +beatrun.buttonhints.ladderdescend= +beatrun.buttonhints.balance= +beatrun.buttonhints.balanceturn= +beatrun.buttonhints.balanceforward= +beatrun.buttonhints.grapplelonger= +beatrun.buttonhints.grappleshorter= +beatrun.buttonhints.wallclimbcancel= +beatrun.buttonhints.wallclimbsidejump= \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/ButtonHints.lua b/beatrun/gamemodes/beatrun/gamemode/cl/ButtonHints.lua new file mode 100644 index 0000000..0fedb4d --- /dev/null +++ b/beatrun/gamemodes/beatrun/gamemode/cl/ButtonHints.lua @@ -0,0 +1,183 @@ +local buttonhints = CreateClientConVar("Beatrun_HUDButtonHints", "1", true, false, "Show button hints on the bottom-right of your display when enabled.", 0, 1) + +local function GetFormattedKey(bind) + string = input.LookupBinding(bind) + + if string == "MOUSE1" then string = "LMB" -- Don't localize LMB and RMB. Maybe. + elseif string == "MOUSE2" then string = "RMB" + elseif string == "MOUSE3" then string = "Wheel Click" end + + if string then + return string.upper(string) + else + return "UNBOUND" + end +end + +surface.CreateFont("BeatrunButtons", { + shadow = true, + blursize = 0, + underline = false, + rotary = false, + strikeout = false, + additive = false, + antialias = false, + extended = false, + scanlines = 2, + font = "x14y24pxHeadUpDaisy", + italic = false, + outline = false, + symbol = false, + weight = 500, + size = ScreenScale(7) +}) + +surface.CreateFont("BeatrunButtonsSmall", { + shadow = true, + blursize = 0, + underline = false, + rotary = false, + strikeout = false, + additive = false, + antialias = false, + extended = false, + scanlines = 2, + font = "x14y24pxHeadUpDaisy", + italic = false, + outline = false, + symbol = false, + weight = 500, + size = ScreenScale(6) +}) + +hook.Add("HUDPaint", "BeatrunButtonPrompts", function() + if !buttonhints:GetBool() then return end + local ply = LocalPlayer() + + if ply.FallStatic then return end -- you're certainly dead by that point, can't even do anything + + local text_color = string.ToColor(ply:GetInfo("Beatrun_HUDTextColor")) + local box_color = string.ToColor(ply:GetInfo("Beatrun_HUDCornerColor")) + + local RestartAtCheckpoint = GetConVar("Beatrun_CPSave"):GetBool() + + local QuickturnGround = GetConVar("Beatrun_QuickturnGround"):GetBool() + local QuickturnHandsOnly = GetConVar("Beatrun_QuickturnHandsOnly"):GetBool() + + local QuickturnSpecialCase = ply:GetClimbing() != 0 or ply:GetMantle() >= 4 or ply:GetWallrun() != 0 or IsValid(ply:GetLadder()) or ply:GetGrappling() or ply:GetDive() or ply:GetSliding() or IsValid(ply:GetBalanceEntity()) or IsValid(ply:GetZipline()) + -- Case-catcher (?) for when quickturn/sidestep prompt shouldn't appear. + + local ButtonsTable = {} -- initialize/clear button table + + surface.SetFont("BeatrunButtons") + fontheight = select(2, surface.GetTextSize("Placeholder, do not localize")) * 1.5 + + if Course_Name != "" and RestartAtCheckpoint and ply:GetNW2Int("CPNum", -1) > 1 then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.ttcheckpoint"), {GetFormattedKey("+reload")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.ttrestart"), {"HELDPRESS", GetFormattedKey("+reload")}} + elseif Course_Name != "" then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.ttrestart"), {GetFormattedKey("+reload")}} + end + + if ply:OnGround() and ply:UsingRH() and !QuickturnSpecialCase then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.sidestep"), {GetFormattedKey("+moveleft"), "OR", GetFormattedKey("+moveright"), "AND", GetFormattedKey("+attack2")}} + end + + if (!ply:OnGround() or QuickturnGround) and (ply:UsingRH() or (ply:notUsingRH() and !QuickturnHandsOnly)) and not QuickturnSpecialCase then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.quickturn"), {GetFormattedKey("+attack2")}} + end + + if !ply:OnGround() and ply:UsingRH() and not QuickturnSpecialCase then + if !ply:GetDive() then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.dive"), {GetFormattedKey("+duck"), "AND", GetFormattedKey("+attack2")}} + end + + if !ply:GetCrouchJump() then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.crouchjump"), {GetFormattedKey("+duck")}} + end + end + + if !ply:OnGround() and !ply:GetCrouchJump() and !ply:GetDive() then + if ply:GetVelocity():Length2D() > 220 and ply:GetVelocity().z <= -350 and !QuickturnSpecialCase then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.fasthorfall"), {"TIMEDPRESS", GetFormattedKey("+duck")}} + elseif ply:GetVelocity().z <= -350 and !QuickturnSpecialCase then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.slowhorfall"), {"TIMEDPRESS", GetFormattedKey("+duck")}} + end + end + + if ply:GetMantle() == 2 then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.vaultjump"), {"HELDPRESS", GetFormattedKey("+jump")}} + end + + if ply:GetClimbing() != 0 then + local ang = EyeAngles() + ang = math.abs(math.AngleDifference(ang.y, ply.wallang.y)) + + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.move"), {GetFormattedKey("+moveleft"), "OR", GetFormattedKey("+moveright")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.drop"), {GetFormattedKey("+duck")}} + if ang <= 42 then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.climb"), {GetFormattedKey("+forward")}} + else + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.jump"), {GetFormattedKey("+forward"), "AND", GetFormattedKey("+jump")}} + end + end + + if ply:GetWallrun() == 1 then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.quickturn"), {GetFormattedKey("+attack2")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.wallclimbcancel"), {GetFormattedKey("+duck")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.wallclimbsidejump"), {GetFormattedKey("+moveleft"), "OR", GetFormattedKey("+moveright"), "AND", GetFormattedKey("+jump")}} + elseif ply:GetWallrun() != 0 then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.quickturn"), {GetFormattedKey("+attack2")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.wallclimbcancel"), {GetFormattedKey("+duck")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.jump"), {GetFormattedKey("+jump")}} + end + + if IsValid(ply:GetLadder()) then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.climb"), {"HELDPRESS", GetFormattedKey("+forward")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.ladderdescend"), {"HELDPRESS", GetFormattedKey("+back")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.drop"), {GetFormattedKey("+duck")}} + elseif IsValid(ply:GetBalanceEntity()) then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.balance"), {GetFormattedKey("+moveleft"), "OR", GetFormattedKey("+moveright")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.balanceturn"), {GetFormattedKey("+attack2")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.balanceforward"), {GetFormattedKey("+forward")}} + elseif IsValid(ply:GetZipline()) then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.drop"), {GetFormattedKey("+duck")}} + elseif ply:GetGrappling() then + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.jump"), {GetFormattedKey("+jump")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.grapplelonger"), {GetFormattedKey("+attack2")}} + ButtonsTable[#ButtonsTable + 1] = {language.GetPhrase("beatrun.buttonhints.grappleshorter"), {GetFormattedKey("+attack")}} + end + + for i=1,#ButtonsTable do + local ButtonOrder = i + local LineOffset = math.max(ButtonOrder - 1, 0) + local ContainsSpecialText = false + + tw = 0 + for i=#ButtonsTable[ButtonOrder][2],1,-1 do + if ButtonsTable[ButtonOrder][2][i] == "TIMEDPRESS" then + draw.DrawText(language.GetPhrase("beatrun.buttonhints.timed"), "BeatrunButtonsSmall", ScrW() - ScreenScaleH(10) - tw - ScreenScaleH(2), ScrH() - ScreenScaleH(10) - fontheight * (1 + LineOffset), text_color, TEXT_ALIGN_RIGHT) + tw = tw + surface.GetTextSize(language.GetPhrase("beatrun.buttonhints.timed")) + ContainsSpecialText = true + elseif ButtonsTable[ButtonOrder][2][i] == "HELDPRESS" then + draw.DrawText(language.GetPhrase("beatrun.buttonhints.hold"), "BeatrunButtonsSmall", ScrW() - ScreenScaleH(10) - tw - ScreenScaleH(2), ScrH() - ScreenScaleH(10) - fontheight * (1 + LineOffset), text_color, TEXT_ALIGN_RIGHT) + tw = tw + surface.GetTextSize(language.GetPhrase("beatrun.buttonhints.hold")) + ContainsSpecialText = true + elseif ButtonsTable[ButtonOrder][2][i] == "OR" then + draw.DrawText("/", "BeatrunButtons", ScrW() - ScreenScaleH(10) - tw, ScrH() - ScreenScaleH(10) - fontheight * (1 + LineOffset), text_color, TEXT_ALIGN_RIGHT) + tw = tw + surface.GetTextSize("/") + elseif ButtonsTable[ButtonOrder][2][i] == "AND" then + draw.DrawText("+", "BeatrunButtons", ScrW() - ScreenScaleH(10) - tw, ScrH() - ScreenScaleH(10) - fontheight * (1 + LineOffset), text_color, TEXT_ALIGN_RIGHT) + tw = tw + surface.GetTextSize("+") + elseif ContainsSpecialText then + draw.WordBox(ScreenScaleH(2), ScrW() - ScreenScaleH(10) - tw, ScrH() - fontheight * (1 + LineOffset) - ScreenScaleH(10) - ScreenScaleH(1), ButtonsTable[ButtonOrder][2][i], "BeatrunButtons", box_color, text_color, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP) + tw = tw + surface.GetTextSize(ButtonsTable[ButtonOrder][2][i]) + ScreenScaleH(2) * 2 + else + draw.WordBox(ScreenScaleH(2), ScrW() - ScreenScaleH(10) - tw, ScrH() - fontheight * (1 + LineOffset) - ScreenScaleH(10) - ScreenScaleH(2), ButtonsTable[ButtonOrder][2][i], "BeatrunButtons", box_color, text_color, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP) + tw = tw + surface.GetTextSize(ButtonsTable[ButtonOrder][2][i]) + ScreenScaleH(2) * 2 + end + end + + draw.DrawText(ButtonsTable[ButtonOrder][1], "BeatrunButtons", ScrW() - ScreenScaleH(10) - tw - ScreenScaleH(4), ScrH() - ScreenScaleH(10) - fontheight * (1 + LineOffset), text_color, TEXT_ALIGN_RIGHT) + end +end) \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua b/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua index 3a77c7a..aaa7867 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua @@ -152,6 +152,9 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function() panel:ClearControls() panel:SetName("#beatrun.toolsmenu.hud.desc") + panel:CheckBox("#beatrun.toolsmenu.hud.buttonhints", "Beatrun_HUDButtonHints") + panel:ControlHelp("#beatrun.toolsmenu.hud.buttonhintsdesc") + panel:CheckBox("#beatrun.toolsmenu.hud.dynamic", "Beatrun_HUDDynamic") panel:ControlHelp("#beatrun.toolsmenu.hud.dynamicdesc")