aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/pac/cl_pac.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/core/pac/cl_pac.lua')
-rw-r--r--gamemode/core/pac/cl_pac.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/gamemode/core/pac/cl_pac.lua b/gamemode/core/pac/cl_pac.lua
index 477d65d..69e993a 100644
--- a/gamemode/core/pac/cl_pac.lua
+++ b/gamemode/core/pac/cl_pac.lua
@@ -1,4 +1,5 @@
+local log = nrequire("log.lua")
--As soon as the client connects, request the names of all the pac's on the server
--If the player dosen't have PAC3 installed, then overwrite all pac-related network events to display an error.
@@ -42,12 +43,12 @@ local function loadpac(ent,name,hash)
return
end
end
- if filetext and (tonumber(util.CRC(filetext)) == hash) then
+ if filetext and tonumber(util.CRC(filetext)) then
print("The file on our local system is up to date, applying!")
local pactbl = CompileString(string.format("return {%s}",filetext),name)()
ent:AttachPACPart(pactbl)
else--Cache is old, download the new pac!
- print("The file on our local system was out of date! Downloading...")
+ log.debug(string.format("File out of date (%d vs %d) Re-downloading...", filetext and tonumber(util.CRC(filetext)) or 0 , hash))
net.Start("artery_requestpac")
net.WriteString(name)
net.SendToServer()
@@ -68,7 +69,8 @@ end
net.Receive("artery_downloadpac",function()
local pac_name = net.ReadString()
local pac_txt = net.ReadString()
- --local pac_hash = net.ReadUInt(32)
+ local pac_hash = net.ReadUInt(32)
+ log.debug(string.format("Received file %s with hash %d", pac_name, pac_hash))
local filepath = string.format(CLIENT_PAC_DIR .. "/%s.txt",pac_name)
file.Write(filepath,pac_txt)
end)