From 84f30a290e3e0dfdf47a00f5ff9c0d57bcba6397 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 25 Jul 2018 12:07:22 -0400 Subject: Moved network strings Moved all network strings used in nrequire() to the top of the file. --- gamemode/nrequire.lua | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'gamemode/nrequire.lua') 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 = {} -- cgit v1.2.3-70-g09d2