Cache couse when loaded from database

This commit is contained in:
Jonny_Bro (Nikita) 2023-08-03 08:53:32 +05:00 committed by GitHub
parent 7f16185de1
commit cee696a4c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,17 @@ function GetCourse(sharecode)
PrintTable(headers)
LoadCourseRaw(util.Compress(body))
local dir = "beatrun/courses/" .. game.GetMap() .. "/"
file.CreateDir(dir)
local coursedata = util.Compress(body)
if not file.Exists(dir .. sharecode .. ".txt", "DATA") then
file.Write(dir .. sharecode .. ".txt", coursedata)
end
LoadCourseRaw(coursedata)
return true
else