Allow replay system to actually work (idiot move)

This commit is contained in:
LostTrackpad 2024-08-07 16:37:07 +07:00
parent a7dd8b9624
commit 1c1e58ac98
2 changed files with 18 additions and 21 deletions

View file

@ -44,7 +44,7 @@ function ENT:StartTouch(ent)
ent:SetNW2Int("CPNum", ent:GetNW2Int("CPNum", 1) + 1)
if ent:GetNW2Int("CPNum", 1) > table.Count(Checkpoints) then
-- ReplayStop(ent)
ReplayStop(ent)
FinishCourse(ent)
else
ent.CPSavePos = ent:GetPos()

View file

@ -134,7 +134,7 @@ if CLIENT then
LocalPlayer():EmitSound("A_TT_Finish_Positive.wav")
SaveCheckpointTime()
-- SaveReplayData()
SaveReplayData()
else
timetext = "+" .. string.FormattedTime(math.abs(timestr), "%02i:%02i:%02i")
timecolor = color_negative
@ -169,7 +169,7 @@ local finishcolor = Color(45, 45, 175, 100)
function FinishCourse(ply)
ply:ScreenFade(SCREENFADE.IN, finishcolor, 0, 4)
-- ply:SetLaggedMovementValue(0.1)
ply:SetLaggedMovementValue(0.1)
ply:DrawViewModel(false)
net.Start("Checkpoint_Finish")
@ -178,7 +178,7 @@ function FinishCourse(ply)
ply:SetNW2Int("CPNum", -1)
timer.Simple(4, function()
-- ply:SetLaggedMovementValue(1)
ply:SetLaggedMovementValue(1)
ply:DrawViewModel(true)
end)
end
@ -354,23 +354,20 @@ function LoadCheckpointTime()
return times or nil
end
-- function SaveReplayData()
-- local replay = util.Compress(util.TableToJSON(LocalPlayer().ReplayTicks))
-- local dir = "beatrun/replays/" .. game.GetMap() .. "/"
-- if not replay then return end
-- file.CreateDir(dir)
-- file.Write(dir .. Course_ID .. ".txt", replay)
-- end
-- function LoadReplayData()
-- local dir = "beatrun/replays/" .. game.GetMap() .. "/"
-- local replay = file.Read(dir .. Course_ID .. ".txt")
-- replay = replay and util.JSONToTable(util.Decompress(replay))
-- return replay or nil
-- end
function SaveReplayData()
PrintTable(LocalPlayer().ReplayTicks)
local replay = util.Compress(util.TableToJSON(LocalPlayer().ReplayTicks))
local dir = "beatrun/replays/" .. game.GetMap() .. "/"
if not replay then return end
file.CreateDir(dir)
file.Write(dir .. Course_ID .. ".txt", replay)
end
function LoadReplayData()
local dir = "beatrun/replays/" .. game.GetMap() .. "/"
local replay = file.Read(dir .. Course_ID .. ".txt")
replay = replay and util.JSONToTable(util.Decompress(replay))
return replay or nil
end
function StartCourse(spawntime)
local faststartmult = LocalPlayer():GetInfoNum("Beatrun_FastStart", 0) > 0 and 0.5 or 1