Some other enhancements?

This commit is contained in:
LostTrackpad 2024-08-07 22:51:14 +07:00
parent 2d9eef6d8a
commit 3d542ec507
2 changed files with 28 additions and 5 deletions

View file

@ -240,6 +240,8 @@ function CourseHUD()
local vpz = vp.z local vpz = vp.z
local incourse = Course_Name ~= "" local incourse = Course_Name ~= ""
local totaltime = CheckpointNumber ~= -1 and math.max(0, CurTime() - Course_StartTime) or Course_EndTime local totaltime = CheckpointNumber ~= -1 and math.max(0, CurTime() - Course_StartTime) or Course_EndTime
local text_color = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDTextColor"))
if GetConVar("Beatrun_ShowSpeedometer"):GetBool() then if GetConVar("Beatrun_ShowSpeedometer"):GetBool() then
local speed = math.Round(ply:GetVelocity():Length2D() * 0.06858125) local speed = math.Round(ply:GetVelocity():Length2D() * 0.06858125)
@ -300,21 +302,42 @@ function CourseHUD()
end end
end end
if incourse then if incourse and !ply.InReplay then
local text = string.FormattedTime(totaltime, "%02i:%02i:%02i") local text = string.FormattedTime(totaltime, "%02i:%02i:%02i")
local w, _ = surface.GetTextSize(text) local w, _ = surface.GetTextSize(text)
surface.SetFont("BeatrunHUD") surface.SetFont("BeatrunHUD")
surface.SetTextColor(text_color)
surface.SetTextPos(ScrW() * 0.87 - w + vpx, ScrH() * 0.075 + vpz) surface.SetTextPos(ScrW() * 0.87 - w + vpx, ScrH() * 0.075 + vpz)
surface.DrawText(text) surface.DrawText(text)
end end
if incourse and pbtimes then if incourse and pbtimes and !ply.InReplay then
local text = string.FormattedTime(pbtotal, "%02i:%02i:%02i") local text = string.FormattedTime(pbtotal, "%02i:%02i:%02i")
local w, h = surface.GetTextSize(text) local w, h = surface.GetTextSize(text)
pbcolor = text_color
pbcolor.r = text_color.r * 0.6
pbcolor.g = text_color.g * 0.6
pbcolor.b = text_color.b * 0.6
surface.SetFont("BeatrunHUD") surface.SetFont("BeatrunHUD")
surface.SetTextPos(ScrW() * 0.87 - w + 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.SetTextColor(pbcolor)
surface.DrawText(text)
end
if incourse and ply.InReplay then
local text = string.FormattedTime(tickcount * engine.TickInterval(), "%02i:%02i:%02i") .. " / " .. string.FormattedTime(#ply.ReplayTicks * engine.TickInterval(), "%02i:%02i:%02i")
local w, _ = surface.GetTextSize(text)
surface.SetFont("BeatrunHUD")
surface.SetTextColor(text_color)
surface.SetTextPos(ScrW() * 0.87 - w + vpx, ScrH() * 0.075 + vpz)
surface.DrawText(text)
local text = "REPLAY MODE - MAY BE INACCURATE"
local w, h = surface.GetTextSize(text)
surface.SetTextColor(text_color)
surface.SetTextPos(ScrW() * 0.87 - w + vpx, ScrH() * 0.075 + vpz + h)
surface.DrawText(text) surface.DrawText(text)
end end

View file

@ -133,6 +133,7 @@ end
function ReplaySendToClient(ply, args) function ReplaySendToClient(ply, args)
--if not game.SinglePlayer() then return end --if not game.SinglePlayer() then return end
ply.InReplay = true
ply:Spawn() ply:Spawn()
local replaydata = util.JSONToTable(util.Decompress(file.Read("beatrun/replays/" .. game.GetMap() .. "/"..Course_Name.."/"..args..".txt", "DATA"))) local replaydata = util.JSONToTable(util.Decompress(file.Read("beatrun/replays/" .. game.GetMap() .. "/"..Course_Name.."/"..args..".txt", "DATA")))
@ -152,7 +153,6 @@ function ReplaySendToClient(ply, args)
net.WriteData(compressedreplay, #compressedreplay) net.WriteData(compressedreplay, #compressedreplay)
net.Send(ply) net.Send(ply)
ply.InReplay = true
ply:SetPos(ply.ReplayStartPos) ply:SetPos(ply.ReplayStartPos)
ply:SetVelocity(vector_origin) ply:SetVelocity(vector_origin)
@ -197,7 +197,7 @@ if CLIENT then
RFF = CurTime() + 1 RFF = CurTime() + 1
hook.Add("StartCommand", "ReplayPlay", ReplayPlayback) hook.Add("StartCommand", "ReplayPlay", ReplayPlayback)
hook.Add("RenderScreenspaceEffects", "BeatrunReplayVision", BeatrunReplayVision) --hook.Add("RenderScreenspaceEffects", "BeatrunReplayVision", BeatrunReplayVision)
hook.Add("HUDPaint", "BeatrunReplayHUD", BeatrunReplayHUD) hook.Add("HUDPaint", "BeatrunReplayHUD", BeatrunReplayHUD)
surface.PlaySound("friends/friend_join.wav") surface.PlaySound("friends/friend_join.wav")