diff options
author | Revolution | 2010-01-22 18:09:33 -0600 |
---|---|---|
committer | Melanie | 2010-01-23 15:18:52 +0000 |
commit | ec3c31e61e5e540f822891110df9bc978655bbaf (patch) | |
tree | b0b34a239eab48e163a3ca064edcd7567948423c /OpenSim/Region/OptionalModules/Scripting | |
parent | add a target position to agent updates to ScenePresence to support alternativ... (diff) | |
download | opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.zip opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.gz opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.bz2 opensim-SC-ec3c31e61e5e540f822891110df9bc978655bbaf.tar.xz |
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
5 files changed, 84 insertions, 45 deletions
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; | |||
38 | using System.Text; | 38 | using System.Text; |
39 | using log4net; | 39 | using log4net; |
40 | using Microsoft.CSharp; | 40 | using Microsoft.CSharp; |
41 | using Mono.Addins; | ||
41 | using Nini.Config; | 42 | using Nini.Config; |
42 | using OpenMetaverse; | 43 | using OpenMetaverse; |
43 | using OpenSim.Framework; | 44 | using OpenSim.Framework; |
@@ -46,7 +47,8 @@ using OpenSim.Region.Framework.Scenes; | |||
46 | 47 | ||
47 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 48 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
48 | { | 49 | { |
49 | public class MRMModule : IRegionModule, IMRMModule | 50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
51 | public class MRMModule : INonSharedRegionModule, IMRMModule | ||
50 | { | 52 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | private Scene m_scene; | 54 | private Scene m_scene; |
@@ -62,12 +64,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
62 | 64 | ||
63 | private IConfig m_config; | 65 | private IConfig m_config; |
64 | 66 | ||
67 | private bool m_hidden = true; | ||
68 | |||
65 | public void RegisterExtension<T>(T instance) | 69 | public void RegisterExtension<T>(T instance) |
66 | { | 70 | { |
67 | m_extensions[typeof (T)] = instance; | 71 | m_extensions[typeof (T)] = instance; |
68 | } | 72 | } |
69 | 73 | ||
70 | public void Initialise(Scene scene, IConfigSource source) | 74 | public void Initialise(IConfigSource source) |
71 | { | 75 | { |
72 | if (source.Configs["MRM"] != null) | 76 | if (source.Configs["MRM"] != null) |
73 | { | 77 | { |
@@ -76,19 +80,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
76 | if (source.Configs["MRM"].GetBoolean("Enabled", false)) | 80 | if (source.Configs["MRM"].GetBoolean("Enabled", false)) |
77 | { | 81 | { |
78 | m_log.Info("[MRM] Enabling MRM Module"); | 82 | m_log.Info("[MRM] Enabling MRM Module"); |
79 | m_scene = scene; | 83 | |
80 | |||
81 | // when hidden, we don't listen for client initiated script events | 84 | // when hidden, we don't listen for client initiated script events |
82 | // only making the MRM engine available for region modules | 85 | // only making the MRM engine available for region modules |
83 | if (!source.Configs["MRM"].GetBoolean("Hidden", false)) | 86 | m_hidden = source.Configs["MRM"].GetBoolean("Hidden", false); |
84 | { | ||
85 | scene.EventManager.OnRezScript += EventManager_OnRezScript; | ||
86 | scene.EventManager.OnStopScript += EventManager_OnStopScript; | ||
87 | } | ||
88 | |||
89 | scene.EventManager.OnFrame += EventManager_OnFrame; | ||
90 | |||
91 | scene.RegisterModuleInterface<IMRMModule>(this); | ||
92 | } | 87 | } |
93 | else | 88 | else |
94 | { | 89 | { |
@@ -101,6 +96,39 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
101 | } | 96 | } |
102 | } | 97 | } |
103 | 98 | ||
99 | public Type ReplaceableInterface | ||
100 | { | ||
101 | get { return null; } | ||
102 | } | ||
103 | |||
104 | public void AddRegion(Scene scene) | ||
105 | { | ||
106 | m_scene = scene; | ||
107 | if (!m_hidden) | ||
108 | { | ||
109 | scene.EventManager.OnRezScript += EventManager_OnRezScript; | ||
110 | scene.EventManager.OnStopScript += EventManager_OnStopScript; | ||
111 | } | ||
112 | scene.EventManager.OnFrame += EventManager_OnFrame; | ||
113 | |||
114 | scene.RegisterModuleInterface<IMRMModule>(this); | ||
115 | } | ||
116 | public void RegionLoaded(Scene scene) | ||
117 | { | ||
118 | } | ||
119 | |||
120 | public void RemoveRegion(Scene scene) | ||
121 | { | ||
122 | if (!m_hidden) | ||
123 | { | ||
124 | scene.EventManager.OnRezScript -= EventManager_OnRezScript; | ||
125 | scene.EventManager.OnStopScript -= EventManager_OnStopScript; | ||
126 | } | ||
127 | scene.EventManager.OnFrame -= EventManager_OnFrame; | ||
128 | |||
129 | scene.UnregisterModuleInterface<IMRMModule>(this); | ||
130 | } | ||
131 | |||
104 | void EventManager_OnStopScript(uint localID, UUID itemID) | 132 | void EventManager_OnStopScript(uint localID, UUID itemID) |
105 | { | 133 | { |
106 | if (m_scripts.ContainsKey(itemID)) | 134 | if (m_scripts.ContainsKey(itemID)) |
@@ -302,11 +330,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
302 | mmb.InitMiniModule(world, host, itemID); | 330 | mmb.InitMiniModule(world, host, itemID); |
303 | } | 331 | } |
304 | 332 | ||
305 | public void PostInitialise() | ||
306 | { | ||
307 | |||
308 | } | ||
309 | |||
310 | public void Close() | 333 | public void Close() |
311 | { | 334 | { |
312 | foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts) | 335 | foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts) |
@@ -320,11 +343,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
320 | get { return "MiniRegionModule"; } | 343 | get { return "MiniRegionModule"; } |
321 | } | 344 | } |
322 | 345 | ||
323 | public bool IsSharedModule | ||
324 | { | ||
325 | get { return false; } | ||
326 | } | ||
327 | |||
328 | /// <summary> | 346 | /// <summary> |
329 | /// Stolen from ScriptEngine Common | 347 | /// Stolen from ScriptEngine Common |
330 | /// </summary> | 348 | /// </summary> |
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 | |||
100 | if (!m_enabled) | 100 | if (!m_enabled) |
101 | return; | 101 | return; |
102 | 102 | ||
103 | m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; | 103 | scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; |
104 | m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; | 104 | scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; |
105 | 105 | ||
106 | m_scene = null; | 106 | scene = null; |
107 | } | 107 | } |
108 | 108 | ||
109 | public void Close() | 109 | 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 | |||
58 | 58 | ||
59 | public void RemoveRegion(Scene scene) | 59 | public void RemoveRegion(Scene scene) |
60 | { | 60 | { |
61 | scene.UnregisterModuleInterface<IScriptModuleComms>(this); | ||
61 | } | 62 | } |
62 | 63 | ||
63 | public void RegionLoaded(Scene scene) | 64 | 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; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | 31 | ||
32 | using log4net; | 32 | using log4net; |
33 | using Mono.Addins; | ||
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | 36 | ||
@@ -49,7 +50,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
49 | public string uri; | 50 | public string uri; |
50 | } | 51 | } |
51 | 52 | ||
52 | public class XmlRpcGridRouter : IRegionModule, IXmlRpcRouter | 53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
54 | public class XmlRpcGridRouter : INonSharedRegionModule, IXmlRpcRouter | ||
53 | { | 55 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 56 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | 57 | ||
@@ -59,7 +61,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
59 | private bool m_Enabled = false; | 61 | private bool m_Enabled = false; |
60 | private string m_ServerURI = String.Empty; | 62 | private string m_ServerURI = String.Empty; |
61 | 63 | ||
62 | public void Initialise(Scene scene, IConfigSource config) | 64 | public void Initialise(IConfigSource config) |
63 | { | 65 | { |
64 | IConfig startupConfig = config.Configs["Startup"]; | 66 | IConfig startupConfig = config.Configs["Startup"]; |
65 | if (startupConfig == null) | 67 | if (startupConfig == null) |
@@ -75,27 +77,35 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
75 | return; | 77 | return; |
76 | } | 78 | } |
77 | 79 | ||
78 | scene.RegisterModuleInterface<IXmlRpcRouter>(this); | ||
79 | m_Enabled = true; | 80 | m_Enabled = true; |
80 | } | 81 | } |
81 | } | 82 | } |
82 | 83 | ||
83 | public void PostInitialise() | 84 | public void AddRegion(Scene scene) |
85 | { | ||
86 | scene.RegisterModuleInterface<IXmlRpcRouter>(this); | ||
87 | } | ||
88 | public void RegionLoaded(Scene scene) | ||
84 | { | 89 | { |
85 | } | 90 | } |
86 | 91 | ||
87 | public void Close() | 92 | public void RemoveRegion(Scene scene) |
88 | { | 93 | { |
94 | scene.UnregisterModuleInterface<IXmlRpcRouter>(this); | ||
89 | } | 95 | } |
90 | 96 | ||
91 | public string Name | 97 | public Type ReplaceableInterface |
92 | { | 98 | { |
93 | get { return "XmlRpcGridRouterModule"; } | 99 | get { return null; } |
94 | } | 100 | } |
95 | 101 | ||
96 | public bool IsSharedModule | 102 | public void Close() |
97 | { | 103 | { |
98 | get { return false; } | 104 | } |
105 | |||
106 | public string Name | ||
107 | { | ||
108 | get { return "XmlRpcGridRouterModule"; } | ||
99 | } | 109 | } |
100 | 110 | ||
101 | public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) | 111 | 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; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | 30 | ||
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | 35 | ||
@@ -39,11 +40,12 @@ using OpenSim.Region.Framework.Scenes; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule | 41 | namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule |
41 | { | 42 | { |
42 | public class XmlRpcRouter : IRegionModule, IXmlRpcRouter | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
44 | public class XmlRpcRouter : INonSharedRegionModule, IXmlRpcRouter | ||
43 | { | 45 | { |
44 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 47 | private bool m_enabled = false; | |
46 | public void Initialise(Scene scene, IConfigSource config) | 48 | public void Initialise(IConfigSource config) |
47 | { | 49 | { |
48 | IConfig startupConfig = config.Configs["Startup"]; | 50 | IConfig startupConfig = config.Configs["Startup"]; |
49 | if (startupConfig == null) | 51 | if (startupConfig == null) |
@@ -52,26 +54,34 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule | |||
52 | if (startupConfig.GetString("XmlRpcRouterModule", | 54 | if (startupConfig.GetString("XmlRpcRouterModule", |
53 | "XmlRpcRouterModule") == "XmlRpcRouterModule") | 55 | "XmlRpcRouterModule") == "XmlRpcRouterModule") |
54 | { | 56 | { |
55 | scene.RegisterModuleInterface<IXmlRpcRouter>(this); | 57 | m_enabled = true; |
56 | } | 58 | } |
57 | } | 59 | } |
60 | public void AddRegion(Scene scene) | ||
61 | { | ||
62 | scene.RegisterModuleInterface<IXmlRpcRouter>(this); | ||
63 | } | ||
64 | public void RegionLoaded(Scene scene) | ||
65 | { | ||
66 | } | ||
58 | 67 | ||
59 | public void PostInitialise() | 68 | public void RemoveRegion(Scene scene) |
60 | { | 69 | { |
70 | scene.UnregisterModuleInterface<IXmlRpcRouter>(this); | ||
61 | } | 71 | } |
62 | 72 | ||
63 | public void Close() | 73 | public Type ReplaceableInterface |
64 | { | 74 | { |
75 | get { return null; } | ||
65 | } | 76 | } |
66 | 77 | ||
67 | public string Name | 78 | public void Close() |
68 | { | 79 | { |
69 | get { return "XmlRpcRouterModule"; } | ||
70 | } | 80 | } |
71 | 81 | ||
72 | public bool IsSharedModule | 82 | public string Name |
73 | { | 83 | { |
74 | get { return false; } | 84 | get { return "XmlRpcRouterModule"; } |
75 | } | 85 | } |
76 | 86 | ||
77 | public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) | 87 | public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) |