diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-02-18 21:55:55 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-02-18 21:55:55 -0500 |
| commit | a22cbeddc5f8fb61e87a30aa14ba354de5cf4431 (patch) | |
| tree | 297c1dbfb23185c5246e1dd7bdec52253a24ba60 /gamemode/nrequire.lua | |
| parent | f4ee62bb0725a3ae94477b2818071f506e4dfd9f (diff) | |
| download | artery-a22cbeddc5f8fb61e87a30aa14ba354de5cf4431.tar.gz artery-a22cbeddc5f8fb61e87a30aa14ba354de5cf4431.tar.bz2 artery-a22cbeddc5f8fb61e87a30aa14ba354de5cf4431.zip | |
Updates
Diffstat (limited to 'gamemode/nrequire.lua')
| -rw-r--r-- | gamemode/nrequire.lua | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/gamemode/nrequire.lua b/gamemode/nrequire.lua index 702790c..d437a5e 100644 --- a/gamemode/nrequire.lua +++ b/gamemode/nrequire.lua @@ -179,12 +179,40 @@ local function doincludes() end end +local function refresh(filename) + local filepath = scan(ntbl,filename) + if filepath:match("/?sv_[%w_]+%.lua$") then + if SERVER then + reqtbl[filepath] = nil + nrequire(filepath) + end + elseif filepath:match("/?cl_[%w_]+%.lua$") then + if CLIENT then + reqtbl[filepath] = nil + nrequire(filepath) + end + else + reqtbl[filepath] = nil + nrequire(filepath) + end +end + doincludes() --Do it the first time through + +--Totaly refresh all files server and client side if SERVER then util.AddNetworkString("art_refresh") end if CLIENT then net.Receive("art_refresh",doincludes) end - concommand.Add("art_manualrefresh",function(ply,cmd,args) doincludes() net.Start("art_refresh") net.Broadcast() end) + +if SERVER then util.AddNetworkString("art_reffile") end +if CLIENT then net.Receive("art_reffile",function() refresh(net.ReadString()) end) end +concommand.Add("art_refreshfile", function(ply,cmd,args) + refresh(args[1]) + net.Start("art_reffile") + net.WriteString(args[1]) + net.Broadcast() +end) |
