From ec3c31e61e5e540f822891110df9bc978655bbaf Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 22 Jan 2010 18:09:33 -0600 Subject: Updates all IRegionModules to the new style region modules. Signed-off-by: Melanie --- .../InternetRelayClientView/IRCStackModule.cs | 32 +++++++--- .../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 72 ++++++++++++++++------ .../ContentManagementModule.cs | 47 ++++++++------ .../Scripting/Minimodule/MRMModule.cs | 64 ++++++++++++------- .../RegionReadyModule/RegionReadyModule.cs | 6 +- .../ScriptModuleComms/ScriptModuleCommsModule.cs | 1 + .../XmlRpcRouterModule/XmlRpcGridRouterModule.cs | 28 ++++++--- .../XmlRpcRouterModule/XmlRpcRouterModule.cs | 30 ++++++--- .../FreeswitchServiceInConnectorModule.cs | 2 +- .../SvnSerialiser/SvnBackupModule.cs | 28 ++++++--- .../Region/OptionalModules/World/NPC/NPCModule.cs | 28 ++++++--- .../World/TreePopulator/TreePopulatorModule.cs | 41 +++++++----- 12 files changed, 254 insertions(+), 125 deletions(-) (limited to 'OpenSim/Region/OptionalModules') diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs index cfe1278..ec040db 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs @@ -25,9 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Net; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -35,24 +37,23 @@ using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server; namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView { - public class IRCStackModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class IRCStackModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IRCServer m_server; // private Scene m_scene; + private int portNo; - #region Implementation of IRegionModule + #region Implementation of ISharedRegionModule - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) { if (null != source.Configs["IRCd"] && source.Configs["IRCd"].GetBoolean("Enabled",false)) { - int portNo = source.Configs["IRCd"].GetInt("Port",6666); -// m_scene = scene; - m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene); - m_server.OnNewIRCClient += m_server_OnNewIRCClient; + portNo = source.Configs["IRCd"].GetInt("Port",6666); } } @@ -68,9 +69,20 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView m_log.Info("[IRCd] Added user to Scene"); } - public void PostInitialise() + public void AddRegion(Scene scene) + { + if (portNo != null) + { + m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene); + m_server.OnNewIRCClient += m_server_OnNewIRCClient; + } + } + public void RegionLoaded(Scene scene) { + } + public void RemoveRegion(Scene scene) + { } public void Close() @@ -83,9 +95,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView get { return "IRCClientStackModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return false; } + get { return null; } } #endregion diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index b04b076..23ae307 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -38,6 +38,7 @@ using System.Collections.Generic; using System.Reflection; using OpenMetaverse; using log4net; +using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenSim.Framework; @@ -53,7 +54,8 @@ using System.Text.RegularExpressions; namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { - public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class FreeSwitchVoiceModule : ISharedRegionModule, IVoiceModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -108,9 +110,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice private IConfig m_config; - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - m_scene = scene; m_config = config.Configs["FreeSwitchVoice"]; if (null == m_config) @@ -224,17 +225,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice return; } } + } - if (m_pluginEnabled) + public void AddRegion(Scene scene) + { + m_scene = scene; + if (m_pluginEnabled) { // we need to capture scene in an anonymous method // here as we need it later in the callbacks scene.EventManager.OnRegisterCaps += delegate(UUID agentID, Caps caps) - { - OnRegisterCaps(scene, agentID, caps); - }; - - + { + OnRegisterCaps(scene, agentID, caps); + }; + + try { @@ -254,33 +259,60 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions."); } } - + } - } - - public void PostInitialise() - { if (m_pluginEnabled) { m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); - + // register the voice interface for this module, so the script engine can call us m_scene.RegisterModuleInterface(this); } } - public void Close() + public void RegionLoaded(Scene scene) { } - public string Name + public void RemoveRegion(Scene scene) + { + if (UseProxy) + { + MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/", m_freeSwitchAPIPrefix)); + } + else + { + MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix)); + + MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix)); + + MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix)); + + MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix)); + } + scene.EventManager.OnRegisterCaps -= delegate(UUID agentID, Caps caps) + { + OnRegisterCaps(scene, agentID, caps); + }; + scene.UnregisterModuleInterface(this); + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void PostInitialise() { - get { return "FreeSwitchVoiceModule"; } } - public bool IsSharedModule + public void Close() { - get { return true; } + } + + public string Name + { + get { return "FreeSwitchVoiceModule"; } } // diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs index 3d1c346..6769d59 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -38,6 +38,7 @@ using System.Threading; using OpenMetaverse; +using Mono.Addins; using Nini.Config; using OpenSim; @@ -50,7 +51,8 @@ using log4net; namespace OpenSim.Region.OptionalModules.ContentManagement { - public class ContentManagementModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class ContentManagementModule : ISharedRegionModule { #region Static Fields @@ -60,22 +62,20 @@ namespace OpenSim.Region.OptionalModules.ContentManagement #region Fields - bool initialised = false; - CMController m_control = null; - bool m_enabled = false; - CMModel m_model = null; - bool m_posted = false; - CMView m_view = null; + private bool initialised = false; + private CMController m_control = null; + private bool m_enabled = false; + private CMModel m_model = null; + private bool m_posted = false; + private CMView m_view = null; + private string databaseDir = "./"; + private string database = "FileSystemDatabase"; + private int channel = 345; #endregion Fields #region Public Properties - public bool IsSharedModule - { - get { return true; } - } - public string Name { get { return "ContentManagementModule"; } @@ -89,11 +89,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement { } - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) { - string databaseDir = "./"; - string database = "FileSystemDatabase"; - int channel = 345; try { if (source.Configs["CMS"] == null) @@ -115,13 +112,15 @@ namespace OpenSim.Region.OptionalModules.ContentManagement m_log.ErrorFormat("[Content Management]: Exception thrown while reading parameters from configuration file. Message: " + e); m_enabled = false; } + } + public void AddRegion(Scene scene) + { if (!m_enabled) { m_log.Info("[Content Management]: Content Management System is not Enabled."); return; } - lock (this) { if (!initialised) //only init once @@ -142,6 +141,18 @@ namespace OpenSim.Region.OptionalModules.ContentManagement } } } + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + } + + public Type ReplaceableInterface + { + get { return null; } + } public void PostInitialise() { diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 4521f8e..f24bcdc 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs @@ -38,6 +38,7 @@ using System.Security.Policy; using System.Text; using log4net; using Microsoft.CSharp; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -46,7 +47,8 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { - public class MRMModule : IRegionModule, IMRMModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class MRMModule : INonSharedRegionModule, IMRMModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; @@ -62,12 +64,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule private IConfig m_config; + private bool m_hidden = true; + public void RegisterExtension(T instance) { m_extensions[typeof (T)] = instance; } - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) { if (source.Configs["MRM"] != null) { @@ -76,19 +80,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (source.Configs["MRM"].GetBoolean("Enabled", false)) { m_log.Info("[MRM] Enabling MRM Module"); - m_scene = scene; - + // when hidden, we don't listen for client initiated script events // only making the MRM engine available for region modules - if (!source.Configs["MRM"].GetBoolean("Hidden", false)) - { - scene.EventManager.OnRezScript += EventManager_OnRezScript; - scene.EventManager.OnStopScript += EventManager_OnStopScript; - } - - scene.EventManager.OnFrame += EventManager_OnFrame; - - scene.RegisterModuleInterface(this); + m_hidden = source.Configs["MRM"].GetBoolean("Hidden", false); } else { @@ -101,6 +96,39 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule } } + public Type ReplaceableInterface + { + get { return null; } + } + + public void AddRegion(Scene scene) + { + m_scene = scene; + if (!m_hidden) + { + scene.EventManager.OnRezScript += EventManager_OnRezScript; + scene.EventManager.OnStopScript += EventManager_OnStopScript; + } + scene.EventManager.OnFrame += EventManager_OnFrame; + + scene.RegisterModuleInterface(this); + } + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + if (!m_hidden) + { + scene.EventManager.OnRezScript -= EventManager_OnRezScript; + scene.EventManager.OnStopScript -= EventManager_OnStopScript; + } + scene.EventManager.OnFrame -= EventManager_OnFrame; + + scene.UnregisterModuleInterface(this); + } + void EventManager_OnStopScript(uint localID, UUID itemID) { if (m_scripts.ContainsKey(itemID)) @@ -302,11 +330,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule mmb.InitMiniModule(world, host, itemID); } - public void PostInitialise() - { - - } - public void Close() { foreach (KeyValuePair pair in m_scripts) @@ -320,11 +343,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule get { return "MiniRegionModule"; } } - public bool IsSharedModule - { - get { return false; } - } - /// /// Stolen from ScriptEngine Common /// diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index c653e98..999756a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -100,10 +100,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady if (!m_enabled) return; - m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; - m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; + scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; + scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; - m_scene = null; + scene = null; } public void Close() diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index 44c9ada..df01938 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs @@ -58,6 +58,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms public void RemoveRegion(Scene scene) { + scene.UnregisterModuleInterface(this); } public void RegionLoaded(Scene scene) diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs index d18ac0a..f2a0e53 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; @@ -49,7 +50,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule public string uri; } - public class XmlRpcGridRouter : IRegionModule, IXmlRpcRouter + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class XmlRpcGridRouter : INonSharedRegionModule, IXmlRpcRouter { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -59,7 +61,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule private bool m_Enabled = false; private string m_ServerURI = String.Empty; - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { IConfig startupConfig = config.Configs["Startup"]; if (startupConfig == null) @@ -75,27 +77,35 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule return; } - scene.RegisterModuleInterface(this); m_Enabled = true; } } - public void PostInitialise() + public void AddRegion(Scene scene) + { + scene.RegisterModuleInterface(this); + } + public void RegionLoaded(Scene scene) { } - public void Close() + public void RemoveRegion(Scene scene) { + scene.UnregisterModuleInterface(this); } - public string Name + public Type ReplaceableInterface { - get { return "XmlRpcGridRouterModule"; } + get { return null; } } - public bool IsSharedModule + public void Close() { - get { return false; } + } + + public string Name + { + get { return "XmlRpcGridRouterModule"; } } public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs index 32659c8..4d39345 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs @@ -29,6 +29,7 @@ using System; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; @@ -39,11 +40,12 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule { - public class XmlRpcRouter : IRegionModule, IXmlRpcRouter + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class XmlRpcRouter : INonSharedRegionModule, IXmlRpcRouter { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public void Initialise(Scene scene, IConfigSource config) + private bool m_enabled = false; + public void Initialise(IConfigSource config) { IConfig startupConfig = config.Configs["Startup"]; if (startupConfig == null) @@ -52,26 +54,34 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule if (startupConfig.GetString("XmlRpcRouterModule", "XmlRpcRouterModule") == "XmlRpcRouterModule") { - scene.RegisterModuleInterface(this); + m_enabled = true; } } + public void AddRegion(Scene scene) + { + scene.RegisterModuleInterface(this); + } + public void RegionLoaded(Scene scene) + { + } - public void PostInitialise() + public void RemoveRegion(Scene scene) { + scene.UnregisterModuleInterface(this); } - public void Close() + public Type ReplaceableInterface { + get { return null; } } - public string Name + public void Close() { - get { return "XmlRpcRouterModule"; } } - public bool IsSharedModule + public string Name { - get { return false; } + get { return "XmlRpcRouterModule"; } } public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) diff --git a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs index 97fa63c..801f1f8 100644 --- a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Freeswitch private IConfigSource m_Config; bool m_Registered = false; - #region IRegionModule interface + #region ISharedRegionModule interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs index 3490a8b..fa5878d 100644 --- a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs +++ b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs @@ -31,6 +31,7 @@ using System.IO; using System.Reflection; using System.Timers; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.World.Serialiser; @@ -42,7 +43,8 @@ using Slash = System.IO.Path; namespace OpenSim.Region.Modules.SvnSerialiser { - public class SvnBackupModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class SvnBackupModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -200,9 +202,9 @@ namespace OpenSim.Region.Modules.SvnSerialiser #endregion - #region IRegionModule Members + #region ISharedRegionModule Members - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) { m_scenes = new List(); m_timer = new Timer(); @@ -225,7 +227,10 @@ namespace OpenSim.Region.Modules.SvnSerialiser catch (Exception) { } + } + public void AddRegion(Scene scene) + { lock (m_scenes) { m_scenes.Add(scene); @@ -236,6 +241,18 @@ namespace OpenSim.Region.Modules.SvnSerialiser scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; } } + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + } + + public Type ReplaceableInterface + { + get { return null; } + } public void PostInitialise() { @@ -277,11 +294,6 @@ namespace OpenSim.Region.Modules.SvnSerialiser get { return "SvnBackupModule"; } } - public bool IsSharedModule - { - get { return true; } - } - #endregion private void EventManager_OnPluginConsole(string[] args) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index ac39a53..521d01a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -25,9 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using System.Threading; using OpenMetaverse; +using Mono.Addins; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -37,7 +39,8 @@ using Timer=System.Timers.Timer; namespace OpenSim.Region.OptionalModules.World.NPC { - public class NPCModule : IRegionModule, INPCModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class NPCModule : ISharedRegionModule, INPCModule { // private const bool m_enabled = false; @@ -134,15 +137,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC } - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) { m_createMutex = new Mutex(false); m_timer = new Timer(500); m_timer.Elapsed += m_timer_Elapsed; m_timer.Start(); - - scene.RegisterModuleInterface(this); } void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) @@ -173,6 +174,19 @@ namespace OpenSim.Region.OptionalModules.World.NPC } } + public void AddRegion(Scene scene) + { + scene.RegisterModuleInterface(this); + } + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + scene.UnregisterModuleInterface(this); + } + public void PostInitialise() { } @@ -186,9 +200,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC get { return "NPCModule"; } } - public bool IsSharedModule + public Type ReplaceableInterface { - get { return true; } - } + get { return null; } + } } } diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index e3fbb6e..b59d07a 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -31,6 +31,7 @@ using System.Reflection; using System.Timers; using OpenMetaverse; using log4net; +using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; @@ -46,7 +47,8 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator /// /// Version 2.02 - Still hacky /// - public class TreePopulatorModule : IRegionModule, ICommandableModule, IVegetationModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class TreePopulatorModule : INonSharedRegionModule, ICommandableModule, IVegetationModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private readonly Commander m_commander = new Commander("tree"); @@ -168,15 +170,10 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator #endregion - #region IRegionModule Members + #region ISharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - - m_scene = scene; - m_scene.RegisterModuleInterface(this); - m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; - // ini file settings try { @@ -196,12 +193,18 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator m_log.Debug("[TREES]: ini failure for update_rate - using default"); } - InstallCommands(); - m_log.Debug("[TREES]: Initialised tree module"); } - public void PostInitialise() + public void AddRegion(Scene scene) + { + m_scene = scene; + m_scene.RegisterModuleInterface(this); + m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; + InstallCommands(); + } + + public void RegionLoaded(Scene scene) { ReloadCopse(); if (m_copse.Count > 0) @@ -211,18 +214,24 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator activeizeTreeze(true); } - public void Close() + public void RemoveRegion(Scene scene) { + scene.UnregisterModuleInterface(this); + scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; } - public string Name + public Type ReplaceableInterface + { + get { return null; } + } + + public void Close() { - get { return "TreePopulatorModule"; } } - public bool IsSharedModule + public string Name { - get { return false; } + get { return "TreePopulatorModule"; } } #endregion -- cgit v1.1