----------------------------
-- CakeScript (March 29, 2008)
-- by LuaBanana
--
-- Alpha Version
-- plugins.lua
----------------------------

Plugins = {};

-- Plugin loader function
function CAKE.LoadPlugins()

	local list = file.FindInLua( "ECPA/gamemode/plugins/*.lua" );
	
	for k, v in pairs(list) do
	
		CAKE.LoadPlugin(v);
		
	end
	
end

function CAKE.LoadPlugin(filename)

	local path = "plugins/" .. filename;
	
	PLUGIN = {};
	
	include(path);
	AddCSLuaFile(path);
	
	table.insert(Plugins, PLUGIN);
	
end

function CAKE.ReRoute()

	for k, v in pairs(CAKE) do
	
		if(type(v) == "function") then
		
			GM[k] = CAKE[k];
			
		end
		
	end
	
end

CAKE.ReRoute() -- Reroute the functions so plugins can hook into them
CAKE.LoadPlugins()
CAKE.ReRoute() -- If any new functions were made by plugins, reroute them.
