From b557af99817767c66419bfc81f11e9c37aa612c3 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Sun, 8 Sep 2024 11:43:43 +0500 Subject: [PATCH] Add keystrokes on HUD --- .../localization/en/beatrun.properties | 7 +- .../localization/it/beatrun.properties | 7 +- .../localization/pl/beatrun.properties | 7 +- .../localization/pt-BR/beatrun.properties | 7 +- .../localization/ru/beatrun.properties | 7 +- .../localization/tr/beatrun.properties | 8 +- .../localization/uk/beatrun.properties | 7 +- .../beatrun/gamemode/cl/BodyAnim.lua | 9 -- .../beatrun/gamemode/cl/Keystrokes.lua | 134 ++++++++++++++++++ .../beatrun/gamemode/cl/PacketLossFix.lua | 7 +- .../beatrun/gamemode/cl/ToolMenuSettings.lua | 7 +- 11 files changed, 175 insertions(+), 32 deletions(-) create mode 100644 beatrun/gamemodes/beatrun/gamemode/cl/Keystrokes.lua diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties index 1c09569..5aadf4c 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/en/beatrun.properties @@ -114,8 +114,8 @@ beatrun.toolsmenu.hud.showspeedometerdesc=Shows the speedometer on HUD beatrun.toolsmenu.hud.showSpeedometer=Show Speedometer beatrun.toolsmenu.hud.showSpeedometerDesc=Shows the speedometer on HUD (hiding HUD does not affect visibility) -beatrun.toolsmenu.hud.wind=Wind Effect -beatrun.toolsmenu.hud.winddesc=Wind noises when running +beatrun.toolsmenu.hud.keystrokes=Show Keystrokes +beatrun.toolsmenu.hud.keystrokesdesc=Shows keys that you press beatrun.toolsmenu.hud.hidden=Hide HUD beatrun.toolsmenu.hud.hiddendesc=0 - Shown\n1 - Gamemode only\n2 - Hidden @@ -156,6 +156,9 @@ beatrun.toolsmenu.gameplay.disablegrappledesc=Toggles grapple ability beatrun.toolsmenu.gameplay.rollspeedloss=Lose Speed on Roll beatrun.toolsmenu.gameplay.rollspeedlossdesc=Toggles loss of speed on safety roll +beatrun.toolsmenu.gameplay.wind=Wind Effect +beatrun.toolsmenu.gameplay.winddesc=Wind noises when running + # Tools Menu Misc Section beatrun.toolsmenu.misc.name=Misc beatrun.toolsmenu.misc.desc=Misc Settings diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/it/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/it/beatrun.properties index 5cd0d15..a43c364 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/it/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/it/beatrun.properties @@ -105,8 +105,8 @@ beatrun.toolsmenu.hud.nametagsdesc=Attiva/disattiva i nametag sopra i giocatori beatrun.toolsmenu.hud.hudxp=Mostra XP HUD beatrun.toolsmenu.hud.hudxpdesc=Mostra XP totali vicino al tuo nickname -beatrun.toolsmenu.hud.wind=Effetto del vento -beatrun.toolsmenu.hud.winddesc=Rumori del vento durante la corsa +beatrun.toolsmenu.hud.keystrokes=Show Keystrokes +beatrun.toolsmenu.hud.keystrokesdesc=Shows keys that you press beatrun.toolsmenu.hud.hidden=Nascondi HUD beatrun.toolsmenu.hud.hiddendesc=0 - Mostra\n1 - Solo Modalità di gioco\n2 - Nascosta @@ -140,6 +140,9 @@ beatrun.toolsmenu.gameplay.puristmodedesc=La modalità purista è una modalità beatrun.toolsmenu.gameplay.disablegrapple=Disabilita il rampino beatrun.toolsmenu.gameplay.disablegrappledesc=Disabilita l'abilità del rampino +beatrun.toolsmenu.gameplay.wind=Effetto del vento +beatrun.toolsmenu.gameplay.winddesc=Rumori del vento durante la corsa + # Tools Menu Misc Section beatrun.toolsmenu.misc.name=Varie beatrun.toolsmenu.misc.desc=Impostazioni Varie diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/pl/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/pl/beatrun.properties index 7c20a34..180f1a4 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/pl/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/pl/beatrun.properties @@ -106,8 +106,8 @@ beatrun.toolsmenu.hud.nametagsdesc=Włącz/Wyłącz wyświetlanie identyfikator beatrun.toolsmenu.hud.hudxp=Wyświetl PD na interfejsie beatrun.toolsmenu.hud.hudxpdesc=Pokaż całkowitą liczbę PD w pobliżu swojego nicku -beatrun.toolsmenu.hud.wind=Efekt wiatru -beatrun.toolsmenu.hud.winddesc=Włącza dźwięki wiatru w trakcie biegu +beatrun.toolsmenu.hud.keystrokes=Show Keystrokes +beatrun.toolsmenu.hud.keystrokesdesc=Shows keys that you press beatrun.toolsmenu.hud.hidden=Ukryj interfejs beatrun.toolsmenu.hud.hiddendesc=0 - Pokazany\n1 - Tylko poza rozgrywką swobodną\n2 - Ukryty @@ -148,6 +148,9 @@ beatrun.toolsmenu.gameplay.disablegrappledesc=Wyłącza zdolność używania tyr beatrun.toolsmenu.gameplay.rollspeedloss=Utrata prędkości przy przewrocie beatrun.toolsmenu.gameplay.rollspeedlossdesc=Włącz/Wyłącz utratę prędkości przy przewrocie na końcu upadku +beatrun.toolsmenu.gameplay.wind=Efekt wiatru +beatrun.toolsmenu.gameplay.winddesc=Włącza dźwięki wiatru w trakcie biegu + # Tools Menu Misc Section beatrun.toolsmenu.misc.name=Inne beatrun.toolsmenu.misc.desc=Inne ustawienia 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 920cc8b..b4a6875 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/pt-BR/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/pt-BR/beatrun.properties @@ -106,8 +106,8 @@ beatrun.toolsmenu.hud.nametagsdesc=Mostrar crachás acima dos nomes de jogadores beatrun.toolsmenu.hud.hudxp=Mostrar XP beatrun.toolsmenu.hud.hudxpdesc=Mostrar XP total perto do seu nome -beatrun.toolsmenu.hud.wind=Efeito do Vento -beatrun.toolsmenu.hud.winddesc=Barulho de vento enquanto estiver correndo +beatrun.toolsmenu.hud.keystrokes=Show Keystrokes +beatrun.toolsmenu.hud.keystrokesdesc=Shows keys that you press beatrun.toolsmenu.hud.hidden=Esconder a HUD beatrun.toolsmenu.hud.hiddendesc=0 - Mostrado\n1 - Gamemode apenas\n2 - Escondido @@ -142,6 +142,9 @@ beatrun.toolsmenu.gameplay.puristmodedesc=Modo Purista é uma preferencia local beatrun.toolsmenu.gameplay.disablegrapple=Desativar a Habilidade de Gancho beatrun.toolsmenu.gameplay.disablegrappledesc=Desativa a Habilidade de Gancho +beatrun.toolsmenu.gameplay.wind=Efeito do Vento +beatrun.toolsmenu.gameplay.winddesc=Barulho de vento enquanto estiver correndo + # Tools Menu Misc Section beatrun.toolsmenu.misc.name=Diversos beatrun.toolsmenu.misc.desc=Configurações Diversas diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties index 9f1492c..81c34c8 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/ru/beatrun.properties @@ -111,8 +111,8 @@ beatrun.toolsmenu.hud.hudxpdesc=Показывает весь XP в HUD beatrun.toolsmenu.hud.showspeedometer=Показать спидометр beatrun.toolsmenu.hud.showspeedometerdesc=Показывает спидометр в HUD -beatrun.toolsmenu.hud.wind=Эффект Ветра -beatrun.toolsmenu.hud.winddesc=Шум ветра во время бега +beatrun.toolsmenu.hud.keystrokes=Показывать клавиши +beatrun.toolsmenu.hud.keystrokesdesc=Показывает нажатие клавиш в HUD beatrun.toolsmenu.hud.hidden=Скрыть HUD beatrun.toolsmenu.hud.hiddendesc=0 - Показать\n1 - Только режим\n2 - Скрыть полностью @@ -153,6 +153,9 @@ beatrun.toolsmenu.gameplay.disablegrappledesc=Переключает испол beatrun.toolsmenu.gameplay.rollspeedloss=Потеря скорости при перекате beatrun.toolsmenu.gameplay.rollspeedlossdesc=Переключает потерю скорости при перекате +beatrun.toolsmenu.gameplay.wind=Эффект Ветра +beatrun.toolsmenu.gameplay.winddesc=Шум ветра во время бега + # Tools Menu Misc Section beatrun.toolsmenu.misc.name=Другое beatrun.toolsmenu.misc.desc=Другие настройки diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/tr/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/tr/beatrun.properties index 50b9a3e..a9c9fc3 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/tr/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/tr/beatrun.properties @@ -106,9 +106,8 @@ beatrun.toolsmenu.hud.nametagsdesc=Oyuncuların üzerindeki ad etiketlerini aça beatrun.toolsmenu.hud.hudxp=Arayüz XP'yi göster beatrun.toolsmenu.hud.hudxpdesc=Takma adın yanında toplam XP'yi göster -beatrun.toolsmenu.hud.wind=Rüzgar Etkisi -beatrun.toolsmenu.hud.winddesc=Koşarken rüzgar sesleri - +beatrun.toolsmenu.hud.keystrokes=Show Keystrokes +beatrun.toolsmenu.hud.keystrokesdesc=Shows keys that you press beatrun.toolsmenu.hud.hidden=Arayüzü gizle beatrun.toolsmenu.hud.hiddendesc=0 - Gösterilen\n1 - Yalnızca oyun\nmodu 2 - Gizli @@ -143,6 +142,9 @@ beatrun.toolsmenu.gameplay.puristmodedesc=Purist modu, havadayken "strafe" atmay beatrun.toolsmenu.gameplay.disablegrapple=Kanca Özelliğini Devre Dışı Bırak beatrun.toolsmenu.gameplay.disablegrappledesc=Kanca özelliğini devre dışı bırakır +beatrun.toolsmenu.gameplay.wind=Rüzgar Etkisi +beatrun.toolsmenu.gameplay.winddesc=Koşarken rüzgar sesleri + # Tools Menu Misc Section beatrun.toolsmenu.misc.name=Diğer beatrun.toolsmenu.misc.desc=Çeşitli Ayarlar diff --git a/beatrun/gamemodes/beatrun/content/resource/localization/uk/beatrun.properties b/beatrun/gamemodes/beatrun/content/resource/localization/uk/beatrun.properties index 87eb30e..c8e3b7b 100644 --- a/beatrun/gamemodes/beatrun/content/resource/localization/uk/beatrun.properties +++ b/beatrun/gamemodes/beatrun/content/resource/localization/uk/beatrun.properties @@ -110,8 +110,8 @@ beatrun.toolsmenu.hud.hudxpdesc=Показує весь XP в HUD beatrun.toolsmenu.hud.showSpeedometer=Показувати швидкість (спідометр) beatrun.toolsmenu.hud.showSpeedometerDesc=Показує спідометр на HUD (приховування HUD не впливає на видимість) -beatrun.toolsmenu.hud.wind=Ефект Вітру -beatrun.toolsmenu.hud.winddesc=Шум вітру під час бігу +beatrun.toolsmenu.hud.keystrokes=Show Keystrokes +beatrun.toolsmenu.hud.keystrokesdesc=Shows keys that you press beatrun.toolsmenu.hud.hidden=Приховати HUD beatrun.toolsmenu.hud.hiddendesc=0 - Показати\n1 - Тільки режим\n2 - Приховати повністю @@ -149,6 +149,9 @@ beatrun.toolsmenu.gameplay.disablegrappledesc=Відключає викорис beatrun.toolsmenu.gameplay.rollLoseSpeed=Втрата швидкості під час перекату beatrun.toolsmenu.gameplay.rollLoseSpeedDesc=Чи буде гравець втрачати швидкість під час перекату чи ні (як у ME:Catalyst) +beatrun.toolsmenu.gameplay.wind=Ефект Вітру +beatrun.toolsmenu.gameplay.winddesc=Шум вітру під час бігу + # Tools Menu Misc Section beatrun.toolsmenu.misc.name=Інше beatrun.toolsmenu.misc.desc=Інші налаштування diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/BodyAnim.lua b/beatrun/gamemodes/beatrun/gamemode/cl/BodyAnim.lua index c4c1f16..c3eb69b 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/BodyAnim.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/BodyAnim.lua @@ -42,15 +42,8 @@ hook.Add("Think", "beatrun_detect_tool", function() end end) --- local BodyAnimPos = Vector(0, 0, 0) --- local BodyAnimAngLerp = Angle(0, 0, 0) --- local DidDraw = false local AnimString = "nil" --- local angclosenuff = false local savedeyeangb = Angle(0, 0, 0) --- local bodylockview = false --- local bodyanimdone = false --- local holstertime = 0 local animmodelstring = "" local showweapon = false @@ -93,7 +86,6 @@ function RemoveBodyAnim(noang) if shouldremove then return end local ply = LocalPlayer() - -- local ang = ply:EyeAngles() local newang = ply:EyeAngles() local noang = noang or false @@ -245,7 +237,6 @@ function CacheLerpBodyAnim() BodyAnimMDL:SetNoDraw(true) local pos = LocalPlayer():GetPos() - -- local posdelta = pos - matrixfrompos local this = BodyAnim this.m = this.m or Matrix() diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/Keystrokes.lua b/beatrun/gamemodes/beatrun/gamemode/cl/Keystrokes.lua new file mode 100644 index 0000000..18b3a6c --- /dev/null +++ b/beatrun/gamemodes/beatrun/gamemode/cl/Keystrokes.lua @@ -0,0 +1,134 @@ +local showKeystrokes = CreateClientConVar("Beatrun_ShowKeystrokes", 1, true, true) + +local color_white = Color(255, 255, 255) +local color_white_t = Color(255, 255, 255, 100) +local color_black = Color(0, 0, 0) +local color_black_t = Color(0, 0, 0, 100) +local size = 35 + +local function ShowKeyStrokes() + if showKeystrokes:GetBool() then + -- 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) + else + surface.SetDrawColor(color_black_t) + surface.DrawRect(size, 0, size, size) + draw.SimpleText("W", "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) + else + surface.SetDrawColor(color_black_t) + surface.DrawRect(size * 2, 0, size, size) + draw.SimpleText("E", "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) + else + surface.SetDrawColor(color_black_t) + surface.DrawRect(size * 3, 0, size, size) + draw.SimpleText("R", "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) + else + surface.SetDrawColor(color_black_t) + surface.DrawRect(0, size, size, size) + draw.SimpleText("A", "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) + else + surface.SetDrawColor(color_black_t) + surface.DrawRect(size, size, size, size) + draw.SimpleText("S", "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) + else + surface.SetDrawColor(color_black_t) + surface.DrawRect(size * 2, size, size, size) + draw.SimpleText("D", "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) + else + surface.SetDrawColor(color_black_t) + surface.DrawRect(0, size * 2, size * 3, size) + draw.SimpleText("SPACE", "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) + else + surface.SetDrawColor(color_black_t) + surface.DrawRect(0, size * 3, size * 3, size) + draw.SimpleText("SHIFT", "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) + else + surface.SetDrawColor(color_black_t) + surface.DrawRect(0, size * 4, size * 3, size) + draw.SimpleText("CTRL", "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) + else + surface.SetDrawColor(color_black_t) + surface.DrawRect(size * 3, size, size * 2, size) + draw.SimpleText("LMB", "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) + 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) + end + end +end + +hook.Add("HUDPaint", "KeyStrokes", ShowKeyStrokes) \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/PacketLossFix.lua b/beatrun/gamemodes/beatrun/gamemode/cl/PacketLossFix.lua index d221856..70a916a 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/PacketLossFix.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/PacketLossFix.lua @@ -1,4 +1,3 @@ --- local checktimer = 0 local errorc = Color(255, 25, 25) local whitelist = { @@ -8,11 +7,7 @@ local whitelist = { local whitelistanims = fbanims local function BodyAnimAntiStuck() - if not IsValid(BodyAnim) then - checktimer = 0 - - return - end + if not IsValid(BodyAnim) then return end local ply = LocalPlayer() diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua b/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua index bbef6ca..3a77c7a 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua @@ -167,8 +167,8 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function() panel:CheckBox("#beatrun.toolsmenu.hud.showspeedometer", "Beatrun_ShowSpeedometer") panel:ControlHelp("#beatrun.toolsmenu.hud.showspeedometerdesc") - panel:CheckBox("#beatrun.toolsmenu.hud.wind", "Beatrun_Wind") - panel:ControlHelp("#beatrun.toolsmenu.hud.winddesc") + panel:CheckBox("#beatrun.toolsmenu.hud.keystrokes", "Beatrun_ShowKeystrokes") + panel:ControlHelp("#beatrun.toolsmenu.hud.keystrokesdesc") panel:NumSlider("#beatrun.toolsmenu.hud.hidden", "Beatrun_HUDHidden", 0, 2, 0) panel:ControlHelp(language.GetPhrase("beatrun.toolsmenu.hud.hiddendesc")) @@ -250,6 +250,9 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function() panel:CheckBox("#beatrun.toolsmenu.moves.totsugekiaudio", "Beatrun_TotsugekiAudio") panel:ControlHelp(language.GetPhrase("beatrun.toolsmenu.moves.totsugekiaudiodesc")) + + panel:CheckBox("#beatrun.toolsmenu.gameplay.wind", "Beatrun_Wind") + panel:ControlHelp("#beatrun.toolsmenu.gameplay.winddesc") end) spawnmenu.AddToolMenuOption("Beatrun", "Server", "beatrun_misc", "#beatrun.toolsmenu.misc.name", "", "", function(panel)