mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-29 21:33:02 +05:00
Allow replay system to actually work (idiot move)
This commit is contained in:
parent
a7dd8b9624
commit
1c1e58ac98
2 changed files with 18 additions and 21 deletions
|
@ -44,7 +44,7 @@ function ENT:StartTouch(ent)
|
||||||
ent:SetNW2Int("CPNum", ent:GetNW2Int("CPNum", 1) + 1)
|
ent:SetNW2Int("CPNum", ent:GetNW2Int("CPNum", 1) + 1)
|
||||||
|
|
||||||
if ent:GetNW2Int("CPNum", 1) > table.Count(Checkpoints) then
|
if ent:GetNW2Int("CPNum", 1) > table.Count(Checkpoints) then
|
||||||
-- ReplayStop(ent)
|
ReplayStop(ent)
|
||||||
FinishCourse(ent)
|
FinishCourse(ent)
|
||||||
else
|
else
|
||||||
ent.CPSavePos = ent:GetPos()
|
ent.CPSavePos = ent:GetPos()
|
||||||
|
|
|
@ -134,7 +134,7 @@ if CLIENT then
|
||||||
|
|
||||||
LocalPlayer():EmitSound("A_TT_Finish_Positive.wav")
|
LocalPlayer():EmitSound("A_TT_Finish_Positive.wav")
|
||||||
SaveCheckpointTime()
|
SaveCheckpointTime()
|
||||||
-- SaveReplayData()
|
SaveReplayData()
|
||||||
else
|
else
|
||||||
timetext = "+" .. string.FormattedTime(math.abs(timestr), "%02i:%02i:%02i")
|
timetext = "+" .. string.FormattedTime(math.abs(timestr), "%02i:%02i:%02i")
|
||||||
timecolor = color_negative
|
timecolor = color_negative
|
||||||
|
@ -169,7 +169,7 @@ local finishcolor = Color(45, 45, 175, 100)
|
||||||
|
|
||||||
function FinishCourse(ply)
|
function FinishCourse(ply)
|
||||||
ply:ScreenFade(SCREENFADE.IN, finishcolor, 0, 4)
|
ply:ScreenFade(SCREENFADE.IN, finishcolor, 0, 4)
|
||||||
-- ply:SetLaggedMovementValue(0.1)
|
ply:SetLaggedMovementValue(0.1)
|
||||||
ply:DrawViewModel(false)
|
ply:DrawViewModel(false)
|
||||||
|
|
||||||
net.Start("Checkpoint_Finish")
|
net.Start("Checkpoint_Finish")
|
||||||
|
@ -178,7 +178,7 @@ function FinishCourse(ply)
|
||||||
ply:SetNW2Int("CPNum", -1)
|
ply:SetNW2Int("CPNum", -1)
|
||||||
|
|
||||||
timer.Simple(4, function()
|
timer.Simple(4, function()
|
||||||
-- ply:SetLaggedMovementValue(1)
|
ply:SetLaggedMovementValue(1)
|
||||||
ply:DrawViewModel(true)
|
ply:DrawViewModel(true)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -354,23 +354,20 @@ function LoadCheckpointTime()
|
||||||
return times or nil
|
return times or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function SaveReplayData()
|
function SaveReplayData()
|
||||||
-- local replay = util.Compress(util.TableToJSON(LocalPlayer().ReplayTicks))
|
PrintTable(LocalPlayer().ReplayTicks)
|
||||||
-- local dir = "beatrun/replays/" .. game.GetMap() .. "/"
|
local replay = util.Compress(util.TableToJSON(LocalPlayer().ReplayTicks))
|
||||||
|
local dir = "beatrun/replays/" .. game.GetMap() .. "/"
|
||||||
-- if not replay then return end
|
if not replay then return end
|
||||||
|
file.CreateDir(dir)
|
||||||
-- file.CreateDir(dir)
|
file.Write(dir .. Course_ID .. ".txt", replay)
|
||||||
-- file.Write(dir .. Course_ID .. ".txt", replay)
|
end
|
||||||
-- end
|
function LoadReplayData()
|
||||||
|
local dir = "beatrun/replays/" .. game.GetMap() .. "/"
|
||||||
-- function LoadReplayData()
|
local replay = file.Read(dir .. Course_ID .. ".txt")
|
||||||
-- local dir = "beatrun/replays/" .. game.GetMap() .. "/"
|
replay = replay and util.JSONToTable(util.Decompress(replay))
|
||||||
-- local replay = file.Read(dir .. Course_ID .. ".txt")
|
return replay or nil
|
||||||
-- replay = replay and util.JSONToTable(util.Decompress(replay))
|
end
|
||||||
|
|
||||||
-- return replay or nil
|
|
||||||
-- end
|
|
||||||
|
|
||||||
function StartCourse(spawntime)
|
function StartCourse(spawntime)
|
||||||
local faststartmult = LocalPlayer():GetInfoNum("Beatrun_FastStart", 0) > 0 and 0.5 or 1
|
local faststartmult = LocalPlayer():GetInfoNum("Beatrun_FastStart", 0) > 0 and 0.5 or 1
|
||||||
|
|
Loading…
Reference in a new issue