local mods = file.FindDir("../gamemodes/MRP/gamemode/mods/*")
Msg("=============================Mod loader running\n");
for k, v in pairs(mods) do
local init = file.Find("../gamemodes/MRP/gamemode/mods/"..v.."/init.lua")
local cl = file.Find("../gamemodes/MRP/gamemode/mods/"..v.."/cl_*")
local sh = file.Find("../gamemodes/MRP/gamemode/mods/"..v.."/sh_*")
if( SERVER && #init > 0 ) then
if( string.find(init[1], "MRP_dont_use") ) then return end
include(v.."/"..init[1])
print("server: including \""..v.."/"..init[1].."\"\n");
end
if( #cl > 0 ) then
for i=1, #cl do
local cl_file= file.Read("../gamemodes/MRP/gamemode/mods/"..v.."/"..cl[i])
if( string.find(cl_file, "MRP_dont_use") ) then return end
if( SERVER ) then
AddCSLuaFile("MRP/gamemode/mods/"..v.."/"..cl[i])
print("server: addcsluafile \"MRP/gamemode/mods/"..v.."/"..cl[i].."\"\n");
end
if( CLIENT ) then
include(v.."/"..cl[i])
print("client: include \""..v.."/"..cl[i].."\"\n");
end
end
end
if( #sh > 0 ) then
for i=1, #sh do
local sh_file = file.Read("../gamemodes/MRP/gamemode/mods/"..v.."/"..sh[i])
if(string.find(sh_file, "MRP_dont_use")) then return end
if( SERVER ) then
AddCSLuaFile("MRP/gamemode/mods/"..v.."/"..sh[i])
include("MRP/gamemode/mods/"..v.."/"..sh[i])
print("server: addcsluafile and include \""..v.."/"..sh[i].."\"\n");
elseif( CLIENT ) then
include("MRP/gamemode/mods/"..v.."/"..sh[i])
print("client: including \"MRP/gamemode/mods/"..v.."/"..sh[i].."\"\n");
end
end
end
end