-------------------------------
-- SSTRP
-- Author: MNWRP
--
-- plugins.lua
-- Loads and handles the plugins.
-------------------------------


Plugins = {  };

function LoadPlugin( schema, filename )
	
	CallHook( "LoadPlugin", schema, filename );
	
	local path = "schemas/" .. schema .. "/plugins/" .. filename;
	
	PLUGIN = {  };
	
	include( path );
	
	DayLog( "script.txt", "Loading plugin " .. PLUGIN.Name .. " by " .. PLUGIN.Author .. " ( " .. PLUGIN.Description .. " )" );
	
	table.insert( Plugins, PLUGIN );
	
end

function InitPlugins( )

	for _, PLUGIN in pairs( Plugins ) do
		
		CallHook( "InitPlugin", _, PLUGIN );
		DayLog("script.txt", "Initializing " .. PLUGIN.Name);
		
		if(PLUGIN.Init) then
			PLUGIN.Init( );
		end
		
	end
	
end
