aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/dataloader/cl_loadglobals.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-06-19 00:07:01 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2017-06-19 00:07:01 -0400
commit461a29d8fdb2fd6c86a77912e9c2232e1f101ca8 (patch)
treeed76c1a1abf64369ee36b88533e78a8a94566631 /gamemode/core/dataloader/cl_loadglobals.lua
parent0ae33ad32868af226fba6d887320aa87aa19d3a4 (diff)
downloadartery-461a29d8fdb2fd6c86a77912e9c2232e1f101ca8.tar.gz
artery-461a29d8fdb2fd6c86a77912e9c2232e1f101ca8.tar.bz2
artery-461a29d8fdb2fd6c86a77912e9c2232e1f101ca8.zip
Massive updates
Lots of stuff was updated, mostly to support addons. Inventory tracking is also updated a little and a bug fixed in inventory. Nrequire now probably won't crash the client, no matter how many times it's used.
Diffstat (limited to 'gamemode/core/dataloader/cl_loadglobals.lua')
-rw-r--r--gamemode/core/dataloader/cl_loadglobals.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/gamemode/core/dataloader/cl_loadglobals.lua b/gamemode/core/dataloader/cl_loadglobals.lua
new file mode 100644
index 0000000..919ecb5
--- /dev/null
+++ b/gamemode/core/dataloader/cl_loadglobals.lua
@@ -0,0 +1,29 @@
+
+net.Receive("artery_respondfile",function()
+ local filename = net.ReadString()
+ local filetext = net.ReadString()
+ local dirname = string.GetPathFromFilename(filename)
+ file.CreateDir("artery/client/files/" .. dirname)
+ file.Write("artery/client/files/" .. filename,filetext)
+ CompileString(filetext,filename)()
+end)
+
+net.Receive("artery_loadfile",function()
+ local filename = net.ReadString()
+ local hash = net.ReadUInt(32)
+ local cache = file.Read("artery/client/files/" .. filename,"DATA")
+ if cache == nil then --We don't have this file downloaded!
+ net.Start("artery_requestcsfile")
+ net.WriteString(filename)
+ net.SendToServer()
+ return
+ end
+ local thash = tonumber(util.CRC(cache))
+ if hash != thash then
+ net.Start("artery_requestcsfile")
+ net.WriteString(filename)
+ net.SendToServer()
+ else
+ CompileString(cache,filename)()
+ end
+end)