local mods = "";
if CLIENT then mods = file.FindDir("../lua/_downloaded/lua/MRP/gamemode/mods/*")
else mods = file.FindDir("../gamemodes/MRP/gamemode/mods/*") end
Msg("=============================Mod loader running\n");
for k, v in pairs(mods) do
print("===Mod loader debug: k=\""..k.."\" v=\""..v.."\"");
local init = file.Find("../gamemodes/MRP/gamemode/mods/"..v.."/init.lua")
local cl = file.Find("../lua/_downloaded/lua/MRP/gamemode/mods/"..v.."/cl_*")
local sh = "";
if CLIENT then sh = file.Find("../lua/_downloaded/lua/MRP/gamemode/mods/"..v.."/sh_*")
else sh = file.Find("../gamemodes/MRP/gamemode/mods/"..v.."/sh_*") end
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].."\"");
end
if( #cl > 0 ) then
for i=1, #cl do
local cl_file= file.Read("../lua/_downloaded/lua/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].."\"");
end
if( CLIENT ) then
include(v.."/"..cl[i])
print("client: include \""..v.."/"..cl[i].."\"");
end
end
end
if( #sh > 0 ) then
for i=1, #sh do
local sh_file = "";
if SERVER then sh_file = file.Read("../gamemodes/MRP/gamemode/mods/"..v.."/"..sh[i])
else sh_file = file.Read("../lua/_downloaded/lua/MRP/gamemode/mods/"..v.."/"..sh[i]) end
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].."\"");
elseif( CLIENT ) then
include("MRP/gamemode/mods/"..v.."/"..sh[i])
print("client: including \"MRP/gamemode/mods/"..v.."/"..sh[i].."\"");
end
end
end
end