From 7a77a069ddbe32c3df2f2fd19ac131073a1b334f Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Tue, 27 May 2008 21:06:48 +0000 Subject: * Added new InstallPlugin interface to ITerrainModule. * This is to allow other region modules to install Terrain Effects. --- .../Modules/World/Terrain/TerrainModule.cs | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs') diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index 4562fb6..20c0086 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs @@ -242,24 +242,19 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain if (pluginType.IsAbstract || pluginType.IsNotPublic) continue; + string typeName = pluginType.Name; + if (pluginType.GetInterface("ITerrainEffect", false) != null) { ITerrainEffect terEffect = (ITerrainEffect) Activator.CreateInstance(library.GetType(pluginType.ToString())); - if (!m_plugineffects.ContainsKey(pluginType.Name)) - { - m_plugineffects.Add(pluginType.Name, terEffect); - m_log.Info("E ... " + pluginType.Name); - } - else - { - m_log.Warn("E ... " + pluginType.Name + " (Already added)"); - } + + InstallPlugin(typeName, terEffect); } else if (pluginType.GetInterface("ITerrainLoader", false) != null) { ITerrainLoader terLoader = (ITerrainLoader) Activator.CreateInstance(library.GetType(pluginType.ToString())); m_loaders[terLoader.FileExtension] = terLoader; - m_log.Info("L ... " + pluginType.Name); + m_log.Info("L ... " + typeName); } } catch (AmbiguousMatchException) @@ -273,6 +268,22 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain } } + public void InstallPlugin(string pluginName, ITerrainEffect effect) + { + lock (m_plugineffects) + { + if (!m_plugineffects.ContainsKey(pluginName)) + { + m_plugineffects.Add(pluginName, effect); + m_log.Info("E ... " + pluginName); + } + else + { + m_log.Warn("E ... " + pluginName + " (Skipping)"); + } + } + } + #endregion #endregion -- cgit v1.1