aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/pac/cl_pac.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2018-03-25 12:58:22 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2018-03-25 12:58:22 -0400
commit025ef8554016a2647f31244cf6413d80dba91847 (patch)
tree32280de04737bf4a90f96cfe3120c3fd10a06a76 /gamemode/core/pac/cl_pac.lua
parent563f3e3960221fd9144e9adbde53c09392f772dd (diff)
downloadartery-025ef8554016a2647f31244cf6413d80dba91847.tar.gz
artery-025ef8554016a2647f31244cf6413d80dba91847.tar.bz2
artery-025ef8554016a2647f31244cf6413d80dba91847.zip
Fix #3
Allows pacs that have been loaded on join to be removed Also loads player data much sooner after the player spawns in.
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!")