diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-07-25 12:07:22 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-07-25 12:07:22 -0400 |
| commit | 84f30a290e3e0dfdf47a00f5ff9c0d57bcba6397 (patch) | |
| tree | f8ed49935718d064b0949457febadfda52bfd00f | |
| parent | 81d3d4eb333e226432a591461b84ed12f5ac9a3f (diff) | |
| download | artery-84f30a290e3e0dfdf47a00f5ff9c0d57bcba6397.tar.gz artery-84f30a290e3e0dfdf47a00f5ff9c0d57bcba6397.tar.bz2 artery-84f30a290e3e0dfdf47a00f5ff9c0d57bcba6397.zip | |
Moved network strings
Moved all network strings used in nrequire() to the top of the file.
| -rw-r--r-- | gamemode/nrequire.lua | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/gamemode/nrequire.lua b/gamemode/nrequire.lua index 7be9772..1b6be2f 100644 --- a/gamemode/nrequire.lua +++ b/gamemode/nrequire.lua @@ -14,6 +14,24 @@ local searchpaths = { {"data/artery/global","GAME"}, } +if SERVER then + --Network messages + util.AddNetworkString("artery_downloadfile") + util.AddNetworkString("art_downloadfiles") + util.AddNetworkString("art_requestfile") + util.AddNetworkString("art_respondfile") + util.AddNetworkString("artery_request_client_download") + --[[Server tells the client to load a file]] + util.AddNetworkString("artery_loadfile") + --[[Client tells server we don't have that file]] + util.AddNetworkString("artery_requestcsfile") + --[[Server gives client the contents of a file]] + util.AddNetworkString("artery_respondfile") + util.AddNetworkString("art_requestclientreload") + util.AddNetworkString("art_refresh") + util.AddNetworkString("art_manualrefresh") +end + --dir is a table of {string_path, string_directory} local function TraverseFolder(dir,func) local find_path = table.concat({dir[1],"/*"},"") @@ -184,12 +202,6 @@ function nrequire(req,...) end if SERVER then - --[[Server tells the client to load a file]] - util.AddNetworkString("artery_loadfile") - --[[Client tells server we don't have that file]] - util.AddNetworkString("artery_requestcsfile") - --[[Server gives client the contents of a file]] - util.AddNetworkString("artery_respondfile") net.Receive("artery_requestcsfile",function(ln,ply) local which = net.ReadString() local path = net.ReadString() @@ -331,11 +343,6 @@ if SERVER then end local runclient = nil if SERVER then - util.AddNetworkString("artery_downloadfile") - util.AddNetworkString("art_downloadfiles") - util.AddNetworkString("art_requestfile") - util.AddNetworkString("art_respondfile") - util.AddNetworkString("artery_request_client_download") local function downloadclient(who) print("Loading client",who) net.Start("art_downloadfiles") @@ -461,7 +468,6 @@ if SERVER then end if SERVER then - util.AddNetworkString("art_requestclientreload") net.Receive("art_requestclientreload",function(ln,pl) loadclient(pl) end) @@ -485,7 +491,6 @@ else end if SERVER then - util.AddNetworkString("art_refresh") concommand.Add("art_refresh",function(ply,cmd,args) print("Doing soft refresh") doincludes() @@ -497,7 +502,6 @@ else end if SERVER then - util.AddNetworkString("art_manualrefresh") concommand.Add("art_manualrefresh",function(ply,cmd,args) if not ply:IsAdmin() then return end reqtbl = {} |
