mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
This commit is contained in:
@@ -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>(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<IMRMModule>(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<IMRMModule>(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<IMRMModule>(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<UUID, MRMBase> pair in m_scripts)
|
||||
@@ -320,11 +343,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
||||
get { return "MiniRegionModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stolen from ScriptEngine Common
|
||||
/// </summary>
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
scene.UnregisterModuleInterface<IScriptModuleComms>(this);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
|
||||
@@ -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,13 +77,26 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||
return;
|
||||
}
|
||||
|
||||
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
|
||||
m_Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
|
||||
}
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void Close()
|
||||
@@ -93,11 +108,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
|
||||
get { return "XmlRpcGridRouterModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
|
||||
{
|
||||
if (!m_Channels.ContainsKey(itemID))
|
||||
|
||||
@@ -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,12 +54,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
|
||||
if (startupConfig.GetString("XmlRpcRouterModule",
|
||||
"XmlRpcRouterModule") == "XmlRpcRouterModule")
|
||||
{
|
||||
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
|
||||
m_enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
scene.RegisterModuleInterface<IXmlRpcRouter>(this);
|
||||
}
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public void Close()
|
||||
@@ -69,11 +84,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
|
||||
get { return "XmlRpcRouterModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
|
||||
{
|
||||
scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri});
|
||||
|
||||
Reference in New Issue
Block a user