* Added new InstallPlugin interface to ITerrainModule.

* This is to allow other region modules to install Terrain Effects.
0.6.0-stable
Adam Frisby 2008-05-27 21:06:48 +00:00
parent 1487699045
commit 7a77a069dd
2 changed files with 22 additions and 10 deletions

View File

@ -31,5 +31,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
{
void LoadFromFile(string filename);
void SaveToFile(string filename);
void InstallPlugin(string name, ITerrainEffect plug);
}
}

View File

@ -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