From 756c5170694fa3dc4146c2b4034f52bd5c97ec86 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 26 Feb 2009 22:51:52 +0000 Subject: Added IRegionCreator interface that all ApplicationPlugins that are creators of Scenes should implement and register with the ApplicationRegistry.StackModuleInterface<>(); So that other plugins can attach to their OnNewRegionCreated event. Made some changes to IRegistryCore and RegistryCore so they support "Stacked" interfaces. --- .../CreateCommsManager/CreateCommsManagerPlugin.cs | 1 + OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | 4 +--- OpenSim/Framework/IRegionCreator.cs | 12 ++++++++++++ OpenSim/Framework/IRegistryCore.cs | 5 ++++- OpenSim/Framework/RegistryCore.cs | 10 ++++++++++ OpenSim/Region/Application/OpenSimBase.cs | 7 ++++++- 6 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 OpenSim/Framework/IRegionCreator.cs diff --git a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs index 0633e63..83c2426 100644 --- a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs +++ b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs @@ -114,6 +114,7 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager private void InitialiseCommsManager(OpenSimBase openSim) { LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_openSim.ConfigurationSettings.LibrariesXMLFile); + bool hgrid = m_openSim.ConfigSource.Source.Configs["Startup"].GetBoolean("hypergrid", false); if (hgrid) diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 962f7b3..4a6a6b1 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -42,9 +42,7 @@ using OpenSim.Framework.Servers; namespace OpenSim.ApplicationPlugins.LoadRegions { - public delegate void NewRegionCreated(IScene scene); - - public class LoadRegionsPlugin : IApplicationPlugin + public class LoadRegionsPlugin : IApplicationPlugin, IRegionCreator { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Framework/IRegionCreator.cs b/OpenSim/Framework/IRegionCreator.cs new file mode 100644 index 0000000..7920ee4 --- /dev/null +++ b/OpenSim/Framework/IRegionCreator.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework +{ + public delegate void NewRegionCreated(IScene scene); + public interface IRegionCreator + { + event NewRegionCreated OnNewRegionCreated; + } +} diff --git a/OpenSim/Framework/IRegistryCore.cs b/OpenSim/Framework/IRegistryCore.cs index 486dee6..9f251c5 100644 --- a/OpenSim/Framework/IRegistryCore.cs +++ b/OpenSim/Framework/IRegistryCore.cs @@ -4,10 +4,13 @@ using System.Text; namespace OpenSim.Framework { - public interface IRegistryCore + public interface IRegistryCore { T Get(); void RegisterInterface(T iface); bool TryGet(out T iface); + + void StackModuleInterface(M mod); + T[] RequestModuleInterfaces(); } } diff --git a/OpenSim/Framework/RegistryCore.cs b/OpenSim/Framework/RegistryCore.cs index c703f9f..ee15845 100644 --- a/OpenSim/Framework/RegistryCore.cs +++ b/OpenSim/Framework/RegistryCore.cs @@ -40,5 +40,15 @@ namespace OpenSim.Framework return (T)m_moduleInterfaces[typeof(T)]; } + public void StackModuleInterface(M mod) + { + + } + + public T[] RequestModuleInterfaces() + { + return new T[] { default(T) }; + } + } } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 3f7c757..5927c5c 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -212,6 +212,12 @@ namespace OpenSim m_commsManager.GridService.RegionLoginsEnabled = true; } + AddPluginCommands(); + + } + + protected virtual void AddPluginCommands() + { // If console exists add plugin commands. if (m_console != null) { @@ -251,7 +257,6 @@ namespace OpenSim } } } - } private void HandleCommanderCommand(string module, string[] cmd) -- cgit v1.1