From 9adcb3c73a8d0e7ecfe66b30da630c6c2e67f03a Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 27 Aug 2016 17:08:46 -0400 Subject: Moved prayers to their own system --- gamemode/autolua.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'gamemode/autolua.lua') diff --git a/gamemode/autolua.lua b/gamemode/autolua.lua index 12e1d97..d550b83 100644 --- a/gamemode/autolua.lua +++ b/gamemode/autolua.lua @@ -1,6 +1,9 @@ --[[ 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 + Thanks to TheMaw for this idea, this entire file is basically ripped form GearFox. + + You can AddLua(SV|SH|CS)Folder(foldername) to add that folder in the domain. + Additionally, in the shared domain, if a folder has the folders sv_*.lua and cl_*.lua, and optionally sh_*.lua, these will be included in the server, client, and shared domain respectively. ]] -- @module autolua local auto = {} @@ -46,13 +49,19 @@ auto.AddLuaSVFolder = function(dir,recursive) 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. +-- 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. If the file starts with cl_ it will only be included on the client side, if the files starts with sv_ it will only be included on the server side. -- @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) + if f:find("cl_%a*.lua") then + AddCSLuaFile(f) + elseif f:find("sv_%a.lua") then + if SERVER then include(f) end + else + if SERVER then AddCSLuaFile(f) end + include(f) + end end) end -- cgit v1.2.3-70-g09d2