aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-25 17:26:32 +0000
committerMelanie Thielker2008-09-25 17:26:32 +0000
commitf11107821e259d544dc42648f4cdba2b123cd71e (patch)
tree5d288d96a2eb07788ae40130736215599eb9bcec /OpenSim/Region/ScriptEngine/XEngine
parentMantis#2017. Thank you kindly, Tyre, for a patch that solves: (diff)
downloadopensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.zip
opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.gz
opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.bz2
opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.xz
Add an extension to allow registering multiple interfaces of a type with
Scene. Make the script engines check that the engine name in the //Engine:language comment is a valid engine and treat it as a normal comment if it's not. //DotNetEngine: needs to be written as //ScriptEngine.DotNetEngine: now, since that is it's real internal name. //XEngine: still works
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs26
1 files changed, 23 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 701ad60..f11ccc4 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -39,6 +39,7 @@ using log4net;
39using Nini.Config; 39using Nini.Config;
40using Amib.Threading; 40using Amib.Threading;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Region.Interfaces;
42using OpenSim.Region.Environment; 43using OpenSim.Region.Environment;
43using OpenSim.Region.Environment.Scenes; 44using OpenSim.Region.Environment.Scenes;
44using OpenSim.Region.Environment.Interfaces; 45using OpenSim.Region.Environment.Interfaces;
@@ -50,7 +51,7 @@ using OpenSim.Region.ScriptEngine.Interfaces;
50 51
51namespace OpenSim.Region.ScriptEngine.XEngine 52namespace OpenSim.Region.ScriptEngine.XEngine
52{ 53{
53 public class XEngine : IRegionModule, IScriptEngine 54 public class XEngine : IRegionModule, IScriptModule, IScriptEngine
54 { 55 {
55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56 57
@@ -213,6 +214,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
213 // 214 //
214 SetupEngine(m_MinThreads, m_MaxThreads, m_IdleTimeout, m_Prio, 215 SetupEngine(m_MinThreads, m_MaxThreads, m_IdleTimeout, m_Prio,
215 m_MaxScriptQueue, m_StackSize); 216 m_MaxScriptQueue, m_StackSize);
217
218 m_Scene.StackModuleInterface<IScriptModule>(this);
216 } 219 }
217 220
218 public void PostInitialise() 221 public void PostInitialise()
@@ -331,6 +334,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
331 334
332 public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) 335 public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine)
333 { 336 {
337 List<IScriptModule> engines = new List<IScriptModule>(m_Scene.RequestModuleInterfaces<IScriptModule>());
338
339 List<string> names = new List<string>();
340 foreach (IScriptModule m in engines)
341 names.Add(m.ScriptEngineName);
342
334 int lineEnd = script.IndexOf('\n'); 343 int lineEnd = script.IndexOf('\n');
335 344
336 if (lineEnd != 1) 345 if (lineEnd != 1)
@@ -340,8 +349,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
340 int colon = firstline.IndexOf(':'); 349 int colon = firstline.IndexOf(':');
341 if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1) 350 if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1)
342 { 351 {
343 engine = firstline.Substring(2, colon-2); 352 string engineName = firstline.Substring(2, colon-2);
344 script = "//" + script.Substring(script.IndexOf(':')+1); 353
354 if (names.Contains(engineName))
355 {
356 engine = engineName;
357 script = "//" + script.Substring(script.IndexOf(':')+1);
358 }
345 } 359 }
346 } 360 }
347 361
@@ -454,14 +468,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
454// m_log.DebugFormat("[XEngine] Compiling script {0} ({1})", 468// m_log.DebugFormat("[XEngine] Compiling script {0} ({1})",
455// item.Name, itemID.ToString()); 469// item.Name, itemID.ToString());
456 470
471 ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID);
472
457 string assembly = ""; 473 string assembly = "";
458 try 474 try
459 { 475 {
460 assembly = m_Compiler.PerformScriptCompile(script, 476 assembly = m_Compiler.PerformScriptCompile(script,
461 assetID.ToString()); 477 assetID.ToString());
478 if (presence != null)
479 presence.ControllingClient.SendAgentAlertMessage("Compile successful", false);
462 } 480 }
463 catch (Exception e) 481 catch (Exception e)
464 { 482 {
483 if (presence != null)
484 presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
465 try 485 try
466 { 486 {
467 // DISPLAY ERROR INWORLD 487 // DISPLAY ERROR INWORLD