From 2d9eef6d8ac98720693d5567848c45c687e90e6a Mon Sep 17 00:00:00 2001 From: LostTrackpad Date: Wed, 7 Aug 2024 19:55:39 +0700 Subject: [PATCH] Fix in-course timer (how did this not get committed) --- .../beatrun/gamemode/sh/Checkpoints.lua | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua index 9ced775..a1ed074 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua @@ -240,56 +240,48 @@ function CourseHUD() local vpz = vp.z local incourse = Course_Name ~= "" local totaltime = CheckpointNumber ~= -1 and math.max(0, CurTime() - Course_StartTime) or Course_EndTime - - if incourse then - local text = string.FormattedTime(totaltime, "%02i:%02i:%02i") - local w, _ = surface.GetTextSize(text) - surface.SetFont("BeatrunHUD") - surface.SetTextPos(ScrW() * 0.85 - w * 0.5 + vpx, ScrH() * 0.075 + vpz) - surface.DrawText(text) - end - + if GetConVar("Beatrun_ShowSpeedometer"):GetBool() then local speed = math.Round(ply:GetVelocity():Length2D() * 0.06858125) - + if speed < 10 then speed = "0" .. speed end - + text = language.GetPhrase("beatrun.checkpoints.speedometer"):format(speed) - + local w, _ = surface.GetTextSize(text) w = w or 0 - + local r, g, b, a = string.ToColor(GetConVar("Beatrun_HUDTextColor"):GetString()) - + surface.SetDrawColor(255, 255, 255, 255) surface.SetFont("BeatrunHUD") surface.SetTextColor(r, g, b, a) surface.SetTextPos(ScrW() * 0.85 - w * 0.5 + vpx, ScrH() * 0.85 + vpz) surface.DrawText(text) - + if GetConVar("Beatrun_HUDStats"):GetBool() then local ang1 = ply:GetAimVector() ang1 = math.Round(ang1:Angle()[2] % 90, 0) surface.SetTextPos(ScrW() * 0.85 - w * 0.5 + vpx, ScrH() * 0.88 + vpz) surface.DrawText(ang1) - + surface.SetTextPos(ScrW() * 0.87 - w * 0.5 + vpx, ScrH() * 0.88 + vpz) surface.DrawText("Angle") - + surface.SetTextPos(ScrW() * 0.85 - w * 0.5 + vpx, ScrH() * 0.90 + vpz) surface.DrawText(ply:GetWallrun()) surface.SetTextPos(ScrW() * 0.87 - w * 0.5 + vpx, ScrH() * 0.90 + vpz) surface.DrawText("Wall stat") - + if ply:UsingRH() then surface.SetTextPos(ScrW() * 0.85 - w * 0.5 + vpx, ScrH() * 0.92 + vpz) surface.DrawText(tostring(ply:GetActiveWeapon():GetQuakeJumping())) surface.SetTextPos(ScrW() * 0.89 - w * 0.5 + vpx, ScrH() * 0.92 + vpz) surface.DrawText("Quake") end - + surface.SetTextPos(ScrW() * 0.85 - w * 0.5 + vpx, ScrH() * 0.94 + vpz) if (ply:GetWallrunTime() - CurTime()) < 0 then surface.DrawText("0.00") @@ -299,21 +291,29 @@ function CourseHUD() surface.SetTextPos(ScrW() * 0.89 - w * 0.5 + vpx, ScrH() * 0.94 + vpz) surface.DrawText("Wallrun Time Remains") - + surface.SetTextPos(ScrW() * 0.85 - w * 0.5 + vpx, ScrH() * 0.96 + vpz) surface.DrawText(tostring(CurTime() < ply:GetWallrunTime())) - + surface.SetTextPos(ScrW() * 0.89 - w * 0.5 + vpx, ScrH() * 0.96 + vpz) surface.DrawText("Wallrunning") end end + if incourse then + local text = string.FormattedTime(totaltime, "%02i:%02i:%02i") + local w, _ = surface.GetTextSize(text) + surface.SetFont("BeatrunHUD") + surface.SetTextPos(ScrW() * 0.87 - w + vpx, ScrH() * 0.075 + vpz) + surface.DrawText(text) + end + if incourse and pbtimes then local text = string.FormattedTime(pbtotal, "%02i:%02i:%02i") local w, h = surface.GetTextSize(text) - + surface.SetFont("BeatrunHUD") - surface.SetTextPos(ScrW() * 0.85 - w * 0.5 + vpx, ScrH() * 0.075 + h + vpz) + surface.SetTextPos(ScrW() * 0.87 - w + vpx, ScrH() * 0.075 + h + vpz) surface.SetTextColor(255, 255, 255, 125) surface.DrawText(text) end