aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
diff options
context:
space:
mode:
authorAdam Frisby2009-04-21 04:55:53 +0000
committerAdam Frisby2009-04-21 04:55:53 +0000
commit594c7c3eb13695304c755ec1bc65c5f239754222 (patch)
tree5de4d356929e3afa7efd0045167a92e44f710c21 /OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
parentChange a bad use of a type name as a variable. Thanks, Fly-Man (diff)
downloadopensim-SC-594c7c3eb13695304c755ec1bc65c5f239754222.zip
opensim-SC-594c7c3eb13695304c755ec1bc65c5f239754222.tar.gz
opensim-SC-594c7c3eb13695304c755ec1bc65c5f239754222.tar.bz2
opensim-SC-594c7c3eb13695304c755ec1bc65c5f239754222.tar.xz
* Implements Extensions to MRM. This allows Region Modules to insert new classes into OpenSim MRM's.
* Example in region module: Scene.GetModuleInterface<IMRMModule>.RegisterExtension<IMyInterface>(this); * In the MRM: //@DEPENDS:MyExtensionModule.dll ... Host.Extensions<IMyInterface>.DoStuff();
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs13
1 files changed, 11 insertions, 2 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index 0572fc7..b0fe222 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -41,15 +41,22 @@ using OpenSim.Region.Framework.Scenes;
41 41
42namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 42namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
43{ 43{
44 public class MRMModule : IRegionModule 44 public class MRMModule : IRegionModule, IMRMModule
45 { 45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private Scene m_scene; 47 private Scene m_scene;
48 48
49 private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>(); 49 private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>();
50 50
51 private readonly Dictionary<Type,object> m_extensions = new Dictionary<Type, object>();
52
51 private static readonly CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); 53 private static readonly CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
52 54
55 public void RegisterExtension<T>(T instance)
56 {
57 m_extensions[typeof (T)] = instance;
58 }
59
53 public void Initialise(Scene scene, IConfigSource source) 60 public void Initialise(Scene scene, IConfigSource source)
54 { 61 {
55 if (source.Configs["MRM"] != null) 62 if (source.Configs["MRM"] != null)
@@ -59,6 +66,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
59 m_log.Info("[MRM] Enabling MRM Module"); 66 m_log.Info("[MRM] Enabling MRM Module");
60 m_scene = scene; 67 m_scene = scene;
61 scene.EventManager.OnRezScript += EventManager_OnRezScript; 68 scene.EventManager.OnRezScript += EventManager_OnRezScript;
69
70 scene.RegisterModuleInterface<IMRMModule>(this);
62 } 71 }
63 else 72 else
64 { 73 {
@@ -82,7 +91,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
82 { 91 {
83 m_log.Info("[MRM] Found C# MRM"); 92 m_log.Info("[MRM] Found C# MRM");
84 IWorld m_world = new World(m_scene); 93 IWorld m_world = new World(m_scene);
85 IHost m_host = new Host(new SOPObject(m_scene, localID), m_scene); 94 IHost m_host = new Host(new SOPObject(m_scene, localID), m_scene, new ExtensionHandler(m_extensions));
86 95
87 MRMBase mmb = (MRMBase)AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap( 96 MRMBase mmb = (MRMBase)AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap(
88 CompileFromDotNetText(script, itemID.ToString()), 97 CompileFromDotNetText(script, itemID.ToString()),