aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2009-04-10 19:07:41 +0000
committerMelanie Thielker2009-04-10 19:07:41 +0000
commit0377ddb5de48406f6d72d676ca853fcb0b8ff497 (patch)
treec922312fa040ebed786db3531b1ed720c0aaec0d
parentThank you, OwenOyen, for a patch that corrects the behavior of llRot2Euler. (diff)
downloadopensim-SC_OLD-0377ddb5de48406f6d72d676ca853fcb0b8ff497.zip
opensim-SC_OLD-0377ddb5de48406f6d72d676ca853fcb0b8ff497.tar.gz
opensim-SC_OLD-0377ddb5de48406f6d72d676ca853fcb0b8ff497.tar.bz2
opensim-SC_OLD-0377ddb5de48406f6d72d676ca853fcb0b8ff497.tar.xz
Add events to IScriptEngine to notify scripting modules of the removal
of objects from the scene, and of scripts from objects. This facilitates the development of modules that can register prims with externall servers for inbound email and XMLRPC. Currently implemented in XEngine only. Also applying cmickeyb's compiler locking patch, since it seems risk-free.
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs14
4 files changed, 29 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index c2b07fc..b850227 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -96,6 +96,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
96 get { return "ScriptEngine.DotNetEngine"; } 96 get { return "ScriptEngine.DotNetEngine"; }
97 } 97 }
98 98
99 public event ScriptRemoved OnScriptRemoved;
100 public event ObjectRemoved OnObjectRemoved;
101
99 public ScriptEngine() 102 public ScriptEngine()
100 { 103 {
101 // For logging, just need any instance, doesn't matter 104 // For logging, just need any instance, doesn't matter
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
index 95a8530..8da46f4 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
@@ -41,6 +41,10 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
41 /// An interface for a script API module to communicate with 41 /// An interface for a script API module to communicate with
42 /// the engine it's running under 42 /// the engine it's running under
43 /// </summary> 43 /// </summary>
44
45 public delegate void ScriptRemoved(UUID script);
46 public delegate void ObjectRemoved(UUID prim);
47
44 public interface IScriptEngine 48 public interface IScriptEngine
45 { 49 {
46 /// <summary> 50 /// <summary>
@@ -50,6 +54,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
50 54
51 Scene World { get; } 55 Scene World { get; }
52 56
57 event ScriptRemoved OnScriptRemoved;
58 event ObjectRemoved OnObjectRemoved;
59
53 /// <summary> 60 /// <summary>
54 /// Post an event to a single script 61 /// Post an event to a single script
55 /// </summary> 62 /// </summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 162f323..1029184 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -527,8 +527,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
527 break; 527 break;
528 case enumCompileType.cs: 528 case enumCompileType.cs:
529 case enumCompileType.lsl: 529 case enumCompileType.lsl:
530 results = CScodeProvider.CompileAssemblyFromSource( 530 lock (CScodeProvider)
531 parameters, Script); 531 {
532 results = CScodeProvider.CompileAssemblyFromSource(
533 parameters, Script);
534 }
532 break; 535 break;
533 case enumCompileType.js: 536 case enumCompileType.js:
534 results = JScodeProvider.CompileAssemblyFromSource( 537 results = JScodeProvider.CompileAssemblyFromSource(
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 09480f6..357ee32 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -142,6 +142,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
142 get { return m_ScriptConfig; } 142 get { return m_ScriptConfig; }
143 } 143 }
144 144
145 public event ScriptRemoved OnScriptRemoved;
146 public event ObjectRemoved OnObjectRemoved;
147
145 // 148 //
146 // IRegionModule functions 149 // IRegionModule functions
147 // 150 //
@@ -702,6 +705,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
702 if (part != null) 705 if (part != null)
703 part.RemoveScriptEvents(itemID); 706 part.RemoveScriptEvents(itemID);
704 707
708 bool objectRemoved = false;
709
705 lock (m_PrimObjects) 710 lock (m_PrimObjects)
706 { 711 {
707 // Remove the script from it's prim 712 // Remove the script from it's prim
@@ -715,6 +720,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
715 if (m_PrimObjects[localID].Count == 0) 720 if (m_PrimObjects[localID].Count == 0)
716 { 721 {
717 m_PrimObjects.Remove(localID); 722 m_PrimObjects.Remove(localID);
723 objectRemoved = true;
718 } 724 }
719 } 725 }
720 } 726 }
@@ -731,8 +737,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
731 737
732 instance = null; 738 instance = null;
733 739
740 ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
741 if (handlerObjectRemoved != null)
742 handlerObjectRemoved(part.UUID);
743
734 CleanAssemblies(); 744 CleanAssemblies();
735 } 745 }
746
747 ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
748 if (handlerScriptRemoved != null)
749 handlerScriptRemoved(itemID);
736 } 750 }
737 751
738 public void OnScriptReset(uint localID, UUID itemID) 752 public void OnScriptReset(uint localID, UUID itemID)