diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-11-06 23:20:38 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-11-06 23:20:38 -0500 |
| commit | 021d8e86d264e098f9fdce265300ceeb9207506e (patch) | |
| tree | ad530489ea180c25a45efe3015f071105f22d4ed /gamemode/autolua.lua | |
| parent | d7ebd5808e28d3d309eb28b36becfc758bec5a2f (diff) | |
| download | artery-021d8e86d264e098f9fdce265300ceeb9207506e.tar.gz artery-021d8e86d264e098f9fdce265300ceeb9207506e.tar.bz2 artery-021d8e86d264e098f9fdce265300ceeb9207506e.zip | |
Removed unused code
Diffstat (limited to 'gamemode/autolua.lua')
| -rw-r--r-- | gamemode/autolua.lua | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/gamemode/autolua.lua b/gamemode/autolua.lua deleted file mode 100644 index e38a107..0000000 --- a/gamemode/autolua.lua +++ /dev/null @@ -1,99 +0,0 @@ ---[[ - A few functions to make it easier to include files and folders - Thanks to TheMaw for this idea, this entire file is basically ripped form GearFox. - - module functions: - a.AddMixedFolder(foldername, recursive) :: nil - DarkRP style file include(cl_,sv_,sh_) - a.AddCSLuaFolder(foldername,recursive) :: nil - a.AddSHLuaFolder(foldername,recursive) :: nil - a.AddSVLuaFolder(foldername,recursive) :: nil -]] -do return end --- @module autolua -local auto = {} - -local function ExecuteOnFolder(dir, recursive, func) - recursive = recursive ~= nil and recursive or false - local path = GM.Folder:gsub("gamemodes/","") .. "/gamemode/" - local fpath = table.concat({path,dir,"/*"}) - local files, directories = file.Find(fpath,"LUA") - for k,v in pairs(files) do - if string.GetExtensionFromFilename(v) ~= "lua" then continue end - local callpath = table.concat({path,dir,"/",v}) - func(callpath) - end - if recursive then - for k,v in pairs(directories) do - local npath = table.concat({dir,"/",v}) - ExecuteOnFolder(npath,true,func) - end - end -end - -auto.AddMixedFolder = function(dir,recursive) - ExecuteOnFolder(dir,recursive,function(f) - print("Doing file" .. f) - if f:find("/cl_%w+%.lua$") then - print("found cl") - if SERVER then AddCSLuaFile(f) else include(f) end - elseif f:find("/sv_%w+%.lua$") then - print("Foudn sv") - if SERVER then include(f) end - else - print("otherwise") - if SERVER then AddCSLuaFile(f) end - include(f) - end - end) -end - ---- Adds files client side. --- Calls AddCSLuaFile on all files under a folder server side, and include() client side, if the recursive flag is checked, calls all files under all folders as well. --- @string dir The directory relative to /gamemode/ to add client side --- @param recursive boolean value that when true includes all sub-folders recursively. -auto.AddLuaCSFolder = function(dir,recursive) - ExecuteOnFolder(dir,recursive,function(f) - if SERVER then AddCSLuaFile(f) - else include(f) end - end) -end - ---- Adds files server side. --- Calls include() on all files under a folder, if the recursive flag is checked, calls all files under all folders as well. --- @string dir The directory relative to /gamemode/ to add client side --- @param recursive boolean value that when true includes all sub-folders recursively. -auto.AddLuaSVFolder = function(dir,recursive) - if CLIENT then return end - ExecuteOnFolder(dir,recursive,function(f) - include(f) - end) -end - ---- Adds files server side. --- Calls include() and AddCSLuaFile() on all files under a folder server side, and include() client side, if the recursive flag is checked, calls all files under all folders as well. --- @string dir The directory relative to /gamemode/ to add client side --- @param recursive boolean value that when true includes all sub-folders recursively. -auto.AddLuaSHFolder = function(dir,recursive) - ExecuteOnFolder(dir,recursive,function(f) - if SERVER then AddCSLuaFile(f) end - include(f) - end) -end - ---- Adds resources for the client to download --- Calls resource.AddFile() on all files under a directory, recursive. --- @param the path to add all files under, relative to the /content/ directory. -auto.AddContentFolder = function(dir) - local path = string.format("gamemodes/artery/content/%s/",dir) - local files, directories = file.Find(path .. "*","MOD") - for k,v in pairs(files) do - resource.AddFile(path .. v) - end - for k,v in pairs(directories) do - local npath = table.concat({dir,"/",v}) - auto.AddContentFolder(npath) - end -end - -return auto |
