aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/IScene.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs53
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs5
-rw-r--r--OpenSim/Region/Interfaces/IScriptModule.cs38
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api_Base.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs126
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs26
11 files changed, 199 insertions, 81 deletions
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index d3e79d0..b6043ac 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -65,5 +65,6 @@ namespace OpenSim.Framework
65 string GetCapsPath(UUID agentId); 65 string GetCapsPath(UUID agentId);
66 66
67 T RequestModuleInterface<T>(); 67 T RequestModuleInterface<T>();
68 T[] RequestModuleInterfaces<T>();
68 } 69 }
69} 70}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 2a9be81..8fec13f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -178,6 +178,7 @@ namespace OpenSim.Region.Environment.Scenes
178 remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); 178 remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false);
179 return UUID.Zero; 179 return UUID.Zero;
180 } 180 }
181 remoteClient.SendAgentAlertMessage("Notecard saved", false);
181 } 182 }
182 else if ((InventoryType) item.InvType == InventoryType.LSL) 183 else if ((InventoryType) item.InvType == InventoryType.LSL)
183 { 184 {
@@ -186,6 +187,7 @@ namespace OpenSim.Region.Environment.Scenes
186 remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); 187 remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false);
187 return UUID.Zero; 188 return UUID.Zero;
188 } 189 }
190 remoteClient.SendAgentAlertMessage("Script saved", false);
189 } 191 }
190 192
191 AssetBase asset = 193 AssetBase asset =
@@ -287,6 +289,10 @@ namespace OpenSim.Region.Environment.Scenes
287 // 289 //
288 part.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine); 290 part.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine);
289 } 291 }
292 else
293 {
294 remoteClient.SendAgentAlertMessage("Script saved", false);
295 }
290 } 296 }
291 297
292 /// <summary> 298 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 74502b8..e5f10b8 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Scenes
124 { 124 {
125 get { return m_modules; } 125 get { return m_modules; }
126 } 126 }
127 protected Dictionary<Type, object> ModuleInterfaces = new Dictionary<Type, object>(); 127 protected Dictionary<Type, List<object> > ModuleInterfaces = new Dictionary<Type, List<object> >();
128 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); 128 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
129 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); 129 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
130 130
@@ -3025,10 +3025,27 @@ namespace OpenSim.Region.Environment.Scenes
3025 { 3025 {
3026 if (!ModuleInterfaces.ContainsKey(typeof(M))) 3026 if (!ModuleInterfaces.ContainsKey(typeof(M)))
3027 { 3027 {
3028 ModuleInterfaces.Add(typeof(M), mod); 3028 List<Object> l = new List<Object>();
3029 l.Add(mod);
3030 ModuleInterfaces.Add(typeof(M), l);
3029 } 3031 }
3030 } 3032 }
3031 3033
3034 public void StackModuleInterface<M>(M mod)
3035 {
3036 List<Object> l;
3037 if (ModuleInterfaces.ContainsKey(typeof(M)))
3038 l = ModuleInterfaces[typeof(M)];
3039 else
3040 l = new List<Object>();
3041
3042 if (l.Contains(mod))
3043 return;
3044
3045 l.Add(mod);
3046 ModuleInterfaces[typeof(M)] = l;
3047 }
3048
3032 /// <summary> 3049 /// <summary>
3033 /// For the given interface, retrieve the region module which implements it. 3050 /// For the given interface, retrieve the region module which implements it.
3034 /// </summary> 3051 /// </summary>
@@ -3037,7 +3054,7 @@ namespace OpenSim.Region.Environment.Scenes
3037 { 3054 {
3038 if (ModuleInterfaces.ContainsKey(typeof(T))) 3055 if (ModuleInterfaces.ContainsKey(typeof(T)))
3039 { 3056 {
3040 return (T)ModuleInterfaces[typeof(T)]; 3057 return (T)ModuleInterfaces[typeof(T)][0];
3041 } 3058 }
3042 else 3059 else
3043 { 3060 {
@@ -3045,6 +3062,22 @@ namespace OpenSim.Region.Environment.Scenes
3045 } 3062 }
3046 } 3063 }
3047 3064
3065 public override T[] RequestModuleInterfaces<T>()
3066 {
3067 if (ModuleInterfaces.ContainsKey(typeof(T)))
3068 {
3069 List<T> ret = new List<T>();
3070
3071 foreach(Object o in ModuleInterfaces[typeof(T)])
3072 ret.Add((T)o);
3073 return ret.ToArray();
3074 }
3075 else
3076 {
3077 return new T[] { default(T) };
3078 }
3079 }
3080
3048 public void SetObjectCapacity(int objects) 3081 public void SetObjectCapacity(int objects)
3049 { 3082 {
3050 if (m_statsReporter != null) 3083 if (m_statsReporter != null)
@@ -3628,7 +3661,7 @@ namespace OpenSim.Region.Environment.Scenes
3628 m_eventManager.TriggerNotAtTargetEvent(localID); 3661 m_eventManager.TriggerNotAtTargetEvent(localID);
3629 } 3662 }
3630 3663
3631 private bool scriptDanger(SceneObjectPart part,Vector3 pos) 3664 private bool ScriptDanger(SceneObjectPart part,Vector3 pos)
3632 { 3665 {
3633 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); 3666 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
3634 if (part != null) 3667 if (part != null)
@@ -3684,12 +3717,12 @@ namespace OpenSim.Region.Environment.Scenes
3684 } 3717 }
3685 } 3718 }
3686 3719
3687 public bool scriptDanger(uint localID, Vector3 pos) 3720 public bool ScriptDanger(uint localID, Vector3 pos)
3688 { 3721 {
3689 SceneObjectPart part = GetSceneObjectPart(localID); 3722 SceneObjectPart part = GetSceneObjectPart(localID);
3690 if (part != null) 3723 if (part != null)
3691 { 3724 {
3692 return scriptDanger(part, pos); 3725 return ScriptDanger(part, pos);
3693 } 3726 }
3694 else 3727 else
3695 { 3728 {
@@ -3697,19 +3730,19 @@ namespace OpenSim.Region.Environment.Scenes
3697 } 3730 }
3698 } 3731 }
3699 3732
3700 public bool pipeEventsForScript(uint localID) 3733 public bool PipeEventsForScript(uint localID)
3701 { 3734 {
3702 SceneObjectPart part = GetSceneObjectPart(localID); 3735 SceneObjectPart part = GetSceneObjectPart(localID);
3703 if (part != null) 3736 if (part != null)
3704 { 3737 {
3705 // Changed so that child prims of attachments return scriptDanger for their parent, so that 3738 // Changed so that child prims of attachments return ScriptDanger for their parent, so that
3706 // their scripts will actually run. 3739 // their scripts will actually run.
3707 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 3740 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008
3708 SceneObjectPart parent = part.ParentGroup.RootPart; 3741 SceneObjectPart parent = part.ParentGroup.RootPart;
3709 if (parent != null && parent.IsAttachment) 3742 if (parent != null && parent.IsAttachment)
3710 return scriptDanger(parent, parent.GetWorldPosition()); 3743 return ScriptDanger(parent, parent.GetWorldPosition());
3711 else 3744 else
3712 return scriptDanger(part, part.GetWorldPosition()); 3745 return ScriptDanger(part, part.GetWorldPosition());
3713 } 3746 }
3714 else 3747 else
3715 { 3748 {
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 955fd22..1406b47 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -225,5 +225,10 @@ namespace OpenSim.Region.Environment.Scenes
225 { 225 {
226 return default(T); 226 return default(T);
227 } 227 }
228
229 public virtual T[] RequestModuleInterfaces<T>()
230 {
231 return new T[] { default(T) };
232 }
228 } 233 }
229} 234}
diff --git a/OpenSim/Region/Interfaces/IScriptModule.cs b/OpenSim/Region/Interfaces/IScriptModule.cs
new file mode 100644
index 0000000..e01b472
--- /dev/null
+++ b/OpenSim/Region/Interfaces/IScriptModule.cs
@@ -0,0 +1,38 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenSim.Framework;
30using OpenMetaverse;
31
32namespace OpenSim.Region.Interfaces
33{
34 public interface IScriptModule
35 {
36 string ScriptEngineName { get; }
37 }
38}
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
index c8c9cd8..0308169 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs
@@ -215,6 +215,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
215 215
216 public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) 216 public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine)
217 { 217 {
218 List<IScriptModule> engines = new List<IScriptModule>(myScriptEngine.World.RequestModuleInterfaces<IScriptModule>());
219
220 List<string> names = new List<string>();
221 foreach (IScriptModule m in engines)
222 names.Add(m.ScriptEngineName);
223
218 int lineEnd = script.IndexOf('\n'); 224 int lineEnd = script.IndexOf('\n');
219 225
220 if (lineEnd != 1) 226 if (lineEnd != 1)
@@ -224,8 +230,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
224 int colon = firstline.IndexOf(':'); 230 int colon = firstline.IndexOf(':');
225 if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1) 231 if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1)
226 { 232 {
227 engine = firstline.Substring(2, colon-2); 233 string engineName = firstline.Substring(2, colon-2);
228 script = "//" + script.Substring(script.IndexOf(':')+1); 234
235 if (names.Contains(engineName))
236 {
237 engine = engineName;
238 script = "//" + script.Substring(script.IndexOf(':')+1);
239 }
229 } 240 }
230 } 241 }
231 242
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
index 1e71ae5..7f52793 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
@@ -282,7 +282,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
282 // QIS.functionName); 282 // QIS.functionName);
283#endif 283#endif
284 // Only pipe event if land supports it. 284 // Only pipe event if land supports it.
285 if (m_ScriptEngine.World.pipeEventsForScript(QIS.localID)) 285 if (m_ScriptEngine.World.PipeEventsForScript(QIS.localID))
286 { 286 {
287 LastExecutionStarted = DateTime.Now.Ticks; 287 LastExecutionStarted = DateTime.Now.Ticks;
288 KillCurrentScript = false; 288 KillCurrentScript = false;
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
index d423311..2bcd949 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Region.Interfaces;
33using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
35using OpenSim.Region.ScriptEngine.Interfaces; 36using OpenSim.Region.ScriptEngine.Interfaces;
@@ -43,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
43 /// </summary> 44 /// </summary>
44 /// 45 ///
45 [Serializable] 46 [Serializable]
46 public abstract class ScriptEngine : IRegionModule, ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule, IEventReceiver 47 public abstract class ScriptEngine : IRegionModule, IScriptModule, ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule, IEventReceiver
47 { 48 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 50
@@ -126,8 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
126 m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\""); 127 m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\"");
127 ReadConfig(); 128 ReadConfig();
128 129
129 // Should we iterate the region for scripts that needs starting? 130 m_Scene.StackModuleInterface<IScriptModule>(this);
130 // Or can we assume we are loaded before anything else so we can use proper events?
131 } 131 }
132 132
133 public void PostInitialise() 133 public void PostInitialise()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api_Base.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api_Base.cs
index 320e878..396d924 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api_Base.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api_Base.cs
@@ -5114,7 +5114,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5114 public LSL_Integer llScriptDanger(LSL_Vector pos) 5114 public LSL_Integer llScriptDanger(LSL_Vector pos)
5115 { 5115 {
5116 m_host.AddScriptLPS(1); 5116 m_host.AddScriptLPS(1);
5117 bool result = World.scriptDanger(m_host.LocalId, new Vector3((float)pos.x, (float)pos.y, (float)pos.z)); 5117 bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.x, (float)pos.y, (float)pos.z));
5118 if (result) 5118 if (result)
5119 { 5119 {
5120 return 1; 5120 return 1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 28a3b11..6e6d169 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -567,86 +567,90 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
567 } 567 }
568 else 568 else
569 { 569 {
570 SceneObjectPart part = m_Engine.World.GetSceneObjectPart( 570 if (m_Engine.World.PipeEventsForScript(m_LocalID) ||
571 m_LocalID); 571 data.EventName == "control") // Don't freeze avies!
572 // m_Engine.Log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
573 // m_PrimName, m_ScriptName, data.EventName, m_State);
574
575 try
576 { 572 {
577 m_CurrentEvent = data.EventName; 573 SceneObjectPart part = m_Engine.World.GetSceneObjectPart(
578 m_EventStart = DateTime.Now; 574 m_LocalID);
579 m_InEvent = true; 575 // m_Engine.Log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
576 // m_PrimName, m_ScriptName, data.EventName, m_State);
580 577
581 m_Script.ExecuteEvent(State, data.EventName, data.Params); 578 try
579 {
580 m_CurrentEvent = data.EventName;
581 m_EventStart = DateTime.Now;
582 m_InEvent = true;
582 583
583 m_InEvent = false; 584 m_Script.ExecuteEvent(State, data.EventName, data.Params);
584 m_CurrentEvent = String.Empty;
585 585
586 if (m_SaveState) 586 m_InEvent = false;
587 { 587 m_CurrentEvent = String.Empty;
588 // This will be the very first event we deliver
589 // (state_entry) in defualt state
590 //
591 588
592 SaveState(m_Assembly); 589 if (m_SaveState)
590 {
591 // This will be the very first event we deliver
592 // (state_entry) in defualt state
593 //
593 594
594 m_SaveState = false; 595 SaveState(m_Assembly);
595 }
596 }
597 catch (Exception e)
598 {
599 m_InEvent = false;
600 m_CurrentEvent = String.Empty;
601 596
602 if (!(e is TargetInvocationException) || (!(e.InnerException is EventAbortException) && (!(e.InnerException is SelfDeleteException)))) 597 m_SaveState = false;
598 }
599 }
600 catch (Exception e)
603 { 601 {
604 if (e is System.Threading.ThreadAbortException) 602 m_InEvent = false;
603 m_CurrentEvent = String.Empty;
604
605 if (!(e is TargetInvocationException) || (!(e.InnerException is EventAbortException) && (!(e.InnerException is SelfDeleteException))))
605 { 606 {
606 lock (m_EventQueue) 607 if (e is System.Threading.ThreadAbortException)
607 { 608 {
608 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) 609 lock (m_EventQueue)
609 { 610 {
610 m_CurrentResult=m_Engine.QueueEventHandler(this); 611 if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
612 {
613 m_CurrentResult=m_Engine.QueueEventHandler(this);
614 }
615 else
616 {
617 m_CurrentResult = null;
618 }
611 } 619 }
612 else
613 {
614 m_CurrentResult = null;
615 }
616 }
617 620
618 m_DetectParams = null; 621 m_DetectParams = null;
619 622
620 return 0; 623 return 0;
621 } 624 }
622 625
623 try 626 try
624 { 627 {
625 // DISPLAY ERROR INWORLD 628 // DISPLAY ERROR INWORLD
626 string text = "Runtime error:\n" + e.InnerException.ToString(); 629 string text = "Runtime error:\n" + e.InnerException.ToString();
627 if (text.Length > 1000) 630 if (text.Length > 1000)
628 text = text.Substring(0, 1000); 631 text = text.Substring(0, 1000);
629 m_Engine.World.SimChat(Utils.StringToBytes(text), 632 m_Engine.World.SimChat(Utils.StringToBytes(text),
630 ChatTypeEnum.DebugChannel, 2147483647, 633 ChatTypeEnum.DebugChannel, 2147483647,
631 part.AbsolutePosition, 634 part.AbsolutePosition,
632 part.Name, part.UUID, false); 635 part.Name, part.UUID, false);
636 }
637 catch (Exception e2) // LEGIT: User Scripting
638 {
639 m_Engine.Log.Error("[Script]: "+
640 "Error displaying error in-world: " +
641 e2.ToString());
642 m_Engine.Log.Error("[Script]: " +
643 "Errormessage: Error compiling script:\r\n" +
644 e.ToString());
645 }
633 } 646 }
634 catch (Exception e2) // LEGIT: User Scripting 647 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
635 { 648 {
636 m_Engine.Log.Error("[Script]: "+ 649 m_InSelfDelete = true;
637 "Error displaying error in-world: " + 650 if (part != null && part.ParentGroup != null)
638 e2.ToString()); 651 m_Engine.World.DeleteSceneObject(part.ParentGroup);
639 m_Engine.Log.Error("[Script]: " +
640 "Errormessage: Error compiling script:\r\n" +
641 e.ToString());
642 } 652 }
643 } 653 }
644 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
645 {
646 m_InSelfDelete = true;
647 if (part != null && part.ParentGroup != null)
648 m_Engine.World.DeleteSceneObject(part.ParentGroup);
649 }
650 } 654 }
651 } 655 }
652 656
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