From 534103be54a129d8255988fc1e75a21a63c6021f Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sun, 15 Jul 2018 19:57:27 -0400 Subject: Finished gather quest arcs Finished base quest system, and added "Gather" arcs, where players gather a certain number of a certain item. --- gamemode/nrequire.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'gamemode/nrequire.lua') 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() -- cgit v1.2.3-70-g09d2