aboutsummaryrefslogtreecommitdiff
path: root/gamemode/nrequire.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2018-07-15 19:57:27 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2018-07-15 19:57:27 -0400
commit534103be54a129d8255988fc1e75a21a63c6021f (patch)
treec172b0884b4ca26452c5a74f5033b3b1526b6e3a /gamemode/nrequire.lua
parent34d9ae7c4f4176fa9a943e9c2776afc32a867163 (diff)
downloadartery-534103be54a129d8255988fc1e75a21a63c6021f.tar.gz
artery-534103be54a129d8255988fc1e75a21a63c6021f.tar.bz2
artery-534103be54a129d8255988fc1e75a21a63c6021f.zip
Finished gather quest arcs
Finished base quest system, and added "Gather" arcs, where players gather a certain number of a certain item.
Diffstat (limited to 'gamemode/nrequire.lua')
-rw-r--r--gamemode/nrequire.lua32
1 files changed, 16 insertions, 16 deletions
diff --git a/gamemode/nrequire.lua b/gamemode/nrequire.lua
index 94f7215..af066f0 100644
--- a/gamemode/nrequire.lua
+++ b/gamemode/nrequire.lua
@@ -36,14 +36,14 @@ local function BuildIncludeTable(tbl)
local pathparts = {}
for part in filepath:gmatch("/?[%w_]+/") do
local foldername = part:gsub("/$",""):gsub("^/","")
- pathparts[#pathparts+1] = foldername
+ pathparts[#pathparts + 1] = foldername
end
local filename = filepath:gfind("[%w_%.]+%.[%w_]+$")()
if output[filename] == nil then
output[filename] = {}
end
local cursor = output[filename]
- for folder= #pathparts, 2, -1 do
+ for folder = #pathparts, 2, -1 do
if cursor[pathparts[folder]] == nil then
cursor[pathparts[folder]] = {}
end
@@ -151,11 +151,12 @@ function nrequire(req,...)
return
end
local filetime = file.Time(tpath[1],tpath[2])
+ local skip_compile = true
if lastcall[tpath[1]] and lastcall[tpath[1]] < filetime then
- goto cleanup
+ skip_compile = false
end
-
- do -- Needed to follow the scoping rules of lua in regards to goto
+
+ if skip_compile then -- Needed to follow the scoping rules of lua in regards to goto
local filefunc = CompileString(filetxt,tpath[1],false)
if type(filefunc) ~= "function" then
error(filefunc)
@@ -171,12 +172,11 @@ function nrequire(req,...)
end)
end
end
-
- ::cleanup::
+
pathstack[#pathstack] = nil
-
+
return reqtbl[tpath[1]]
-
+
end
if SERVER then
@@ -270,7 +270,7 @@ local function doincludes()
reqtbl = reqtbl or {}
for k,v in pairs(paths) do
local filename = v[1]
- MsgN("Filename:",filename)
+ -- MsgN("Filename:",filename)
if filename == "gamemodes/artery/gamemode/init.lua" then
continue
end
@@ -306,11 +306,11 @@ local function redoincludes()
print("redoing includes")
paths = {} -- Defined above somewhere
for k,v in pairs(searchpaths) do
- print("Searching path:")
- PrintTable(v)
+ -- print("Searching path:")
+ -- PrintTable(v)
TraverseFolder(v,function(n)
- print("found file:")
- PrintTable(n)
+ -- print("found file:")
+ -- PrintTable(n)
paths[#paths + 1] = n
end)
end
@@ -404,7 +404,7 @@ else
coroutine.resume(routine)
end)
end)
-
+
net.Receive("art_respondfile",function(ln,pl)
local tbl = net.ReadTable()
print("Received response file:",tbl.name)
@@ -414,7 +414,7 @@ else
print("Writing to ", fullpath)
file.Write(fullpath,tbl.text)
end)
-
+
net.Receive("artery_downloadfile",function(ln,pl)
print("Asked to download file")
local clientfiles = net.ReadTable()