diff options
author | Melanie Thielker | 2008-09-21 21:47:00 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-21 21:47:00 +0000 |
commit | 94aaf67dfaafbcbd4d871f674c465a34c1c1f332 (patch) | |
tree | 33476e5660a95bdf7d29d14beae67a6294af28a7 /OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |
parent | * minor: warnings removal (diff) | |
download | opensim-SC-94aaf67dfaafbcbd4d871f674c465a34c1c1f332.zip opensim-SC-94aaf67dfaafbcbd4d871f674c465a34c1c1f332.tar.gz opensim-SC-94aaf67dfaafbcbd4d871f674c465a34c1c1f332.tar.bz2 opensim-SC-94aaf67dfaafbcbd4d871f674c465a34c1c1f332.tar.xz |
Change the scirpt engine loading mechanism. Script engines are now
ordinary region modules and are able to coexist in one instance.
See http://opensimulator.org/wiki/ScriptEngines for details. There were
changes to OpenSim.ini.example, please note DefaultScriptEngine.
Also see the User docs and FAQ on the Wiki. Default is DotNetEngine.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index d6e6dae..c72d281 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -67,6 +67,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
67 | private int m_SleepTime; | 67 | private int m_SleepTime; |
68 | private int m_SaveTime; | 68 | private int m_SaveTime; |
69 | private ThreadPriority m_Prio; | 69 | private ThreadPriority m_Prio; |
70 | private bool m_Enabled = true; | ||
70 | 71 | ||
71 | // disable warning: need to keep a reference to XEngine.EventManager | 72 | // disable warning: need to keep a reference to XEngine.EventManager |
72 | // alive to avoid it being garbage collected | 73 | // alive to avoid it being garbage collected |
@@ -151,21 +152,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
151 | // | 152 | // |
152 | public void Initialise(Scene scene, IConfigSource configSource) | 153 | public void Initialise(Scene scene, IConfigSource configSource) |
153 | { | 154 | { |
154 | AppDomain.CurrentDomain.AssemblyResolve += | ||
155 | OnAssemblyResolve; | ||
156 | |||
157 | m_log.InfoFormat("[XEngine] Initializing scripts in region {0}", | ||
158 | scene.RegionInfo.RegionName); | ||
159 | m_Scene = scene; | ||
160 | |||
161 | m_ScriptConfig = configSource.Configs["XEngine"]; | 155 | m_ScriptConfig = configSource.Configs["XEngine"]; |
162 | 156 | ||
163 | if (m_ScriptConfig == null) | 157 | if (m_ScriptConfig == null) |
164 | { | 158 | { |
165 | m_log.ErrorFormat("[XEngine] No script configuration found. Scripts disabled"); | 159 | // m_log.ErrorFormat("[XEngine] No script configuration found. Scripts disabled"); |
166 | return; | 160 | return; |
167 | } | 161 | } |
168 | 162 | ||
163 | m_Enabled = m_ScriptConfig.GetBoolean("Enabled", true); | ||
164 | |||
165 | if (!m_Enabled) | ||
166 | return; | ||
167 | |||
168 | AppDomain.CurrentDomain.AssemblyResolve += | ||
169 | OnAssemblyResolve; | ||
170 | |||
171 | m_log.InfoFormat("[XEngine] Initializing scripts in region {0}", | ||
172 | scene.RegionInfo.RegionName); | ||
173 | m_Scene = scene; | ||
174 | |||
169 | m_MinThreads = m_ScriptConfig.GetInt("MinThreads", 2); | 175 | m_MinThreads = m_ScriptConfig.GetInt("MinThreads", 2); |
170 | m_MaxThreads = m_ScriptConfig.GetInt("MaxThreads", 100); | 176 | m_MaxThreads = m_ScriptConfig.GetInt("MaxThreads", 100); |
171 | m_IdleTimeout = m_ScriptConfig.GetInt("IdleTimeout", 60); | 177 | m_IdleTimeout = m_ScriptConfig.GetInt("IdleTimeout", 60); |
@@ -220,6 +226,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
220 | 226 | ||
221 | public void PostInitialise() | 227 | public void PostInitialise() |
222 | { | 228 | { |
229 | if (!m_Enabled) | ||
230 | return; | ||
231 | |||
223 | m_EventManager = new EventManager(this); | 232 | m_EventManager = new EventManager(this); |
224 | 233 | ||
225 | m_Compiler = new Compiler(this); | 234 | m_Compiler = new Compiler(this); |
@@ -330,8 +339,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
330 | get { return false; } | 339 | get { return false; } |
331 | } | 340 | } |
332 | 341 | ||
333 | public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez) | 342 | public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) |
334 | { | 343 | { |
344 | if (engine != "XEngine") | ||
345 | return; | ||
346 | |||
335 | Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez}; | 347 | Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez}; |
336 | 348 | ||
337 | lock (m_CompileQueue) | 349 | lock (m_CompileQueue) |