aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorAdam Frisby2008-05-27 21:06:48 +0000
committerAdam Frisby2008-05-27 21:06:48 +0000
commit7a77a069ddbe32c3df2f2fd19ac131073a1b334f (patch)
tree228802097d873c20d2401015f260124c380b980b /OpenSim/Region/Environment
parent* Revert last commit as it opens sim owners up to all sorts of nasty scripts.... (diff)
downloadopensim-SC-7a77a069ddbe32c3df2f2fd19ac131073a1b334f.zip
opensim-SC-7a77a069ddbe32c3df2f2fd19ac131073a1b334f.tar.gz
opensim-SC-7a77a069ddbe32c3df2f2fd19ac131073a1b334f.tar.bz2
opensim-SC-7a77a069ddbe32c3df2f2fd19ac131073a1b334f.tar.xz
* Added new InstallPlugin interface to ITerrainModule.
* This is to allow other region modules to install Terrain Effects.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs1
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs31
2 files changed, 22 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs
index dc8c41b..6ab2372 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/ITerrainModule.cs
@@ -31,5 +31,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
31 { 31 {
32 void LoadFromFile(string filename); 32 void LoadFromFile(string filename);
33 void SaveToFile(string filename); 33 void SaveToFile(string filename);
34 void InstallPlugin(string name, ITerrainEffect plug);
34 } 35 }
35} 36}
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
242 if (pluginType.IsAbstract || pluginType.IsNotPublic) 242 if (pluginType.IsAbstract || pluginType.IsNotPublic)
243 continue; 243 continue;
244 244
245 string typeName = pluginType.Name;
246
245 if (pluginType.GetInterface("ITerrainEffect", false) != null) 247 if (pluginType.GetInterface("ITerrainEffect", false) != null)
246 { 248 {
247 ITerrainEffect terEffect = (ITerrainEffect) Activator.CreateInstance(library.GetType(pluginType.ToString())); 249 ITerrainEffect terEffect = (ITerrainEffect) Activator.CreateInstance(library.GetType(pluginType.ToString()));
248 if (!m_plugineffects.ContainsKey(pluginType.Name)) 250
249 { 251 InstallPlugin(typeName, terEffect);
250 m_plugineffects.Add(pluginType.Name, terEffect);
251 m_log.Info("E ... " + pluginType.Name);
252 }
253 else
254 {
255 m_log.Warn("E ... " + pluginType.Name + " (Already added)");
256 }
257 } 252 }
258 else if (pluginType.GetInterface("ITerrainLoader", false) != null) 253 else if (pluginType.GetInterface("ITerrainLoader", false) != null)
259 { 254 {
260 ITerrainLoader terLoader = (ITerrainLoader) Activator.CreateInstance(library.GetType(pluginType.ToString())); 255 ITerrainLoader terLoader = (ITerrainLoader) Activator.CreateInstance(library.GetType(pluginType.ToString()));
261 m_loaders[terLoader.FileExtension] = terLoader; 256 m_loaders[terLoader.FileExtension] = terLoader;
262 m_log.Info("L ... " + pluginType.Name); 257 m_log.Info("L ... " + typeName);
263 } 258 }
264 } 259 }
265 catch (AmbiguousMatchException) 260 catch (AmbiguousMatchException)
@@ -273,6 +268,22 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
273 } 268 }
274 } 269 }
275 270
271 public void InstallPlugin(string pluginName, ITerrainEffect effect)
272 {
273 lock (m_plugineffects)
274 {
275 if (!m_plugineffects.ContainsKey(pluginName))
276 {
277 m_plugineffects.Add(pluginName, effect);
278 m_log.Info("E ... " + pluginName);
279 }
280 else
281 {
282 m_log.Warn("E ... " + pluginName + " (Skipping)");
283 }
284 }
285 }
286
276 #endregion 287 #endregion
277 288
278 #endregion 289 #endregion