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.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/gamemode/core/pac/cl_pac.lua b/gamemode/core/pac/cl_pac.lua
index 490ad31..477d65d 100644
--- a/gamemode/core/pac/cl_pac.lua
+++ b/gamemode/core/pac/cl_pac.lua
@@ -19,22 +19,28 @@ if pac == nil then
return --Don't execute this file!
end
-timer.Simple(0,function()
- net.Start("artery_getworldpacs")
- net.SendToServer()
-end)
-
local CLIENT_PAC_DIR = "artery/client/pacs"
file.CreateDir(CLIENT_PAC_DIR)
local function loadpac(ent,name,hash)
+ if (not ent) or (not ent:IsValid()) then
+ timer.Simple(1,function()
+ loadpac(ent,name,hash)
+ end)
+ return
+ end
print("Told to apply pac", name, "to ent", ent)
local filepath = string.format(CLIENT_PAC_DIR .. "/%s.txt",name)
local filetext = file.Read(filepath,"DATA")
if ent.AttachPACPart == nil then
pac.SetupENT(ent)
- assert(ent.AttachPACPart ~= nil,"Failed to set up ent",ent)
+ if ent.AttachPACPart == nil then
+ timer.Simple(1,function()
+ loadpac(ent,name,hash)
+ end)
+ return
+ end
end
if filetext and (tonumber(util.CRC(filetext)) == hash) then
print("The file on our local system is up to date, applying!")