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.
0.6.5-rc1
Melanie Thielker 2009-04-10 19:07:41 +00:00
parent 292672675a
commit 0377ddb5de
4 changed files with 29 additions and 2 deletions

View File

@ -96,6 +96,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
get { return "ScriptEngine.DotNetEngine"; }
}
public event ScriptRemoved OnScriptRemoved;
public event ObjectRemoved OnObjectRemoved;
public ScriptEngine()
{
// For logging, just need any instance, doesn't matter

View File

@ -41,6 +41,10 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
/// An interface for a script API module to communicate with
/// the engine it's running under
/// </summary>
public delegate void ScriptRemoved(UUID script);
public delegate void ObjectRemoved(UUID prim);
public interface IScriptEngine
{
/// <summary>
@ -50,6 +54,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
Scene World { get; }
event ScriptRemoved OnScriptRemoved;
event ObjectRemoved OnObjectRemoved;
/// <summary>
/// Post an event to a single script
/// </summary>

View File

@ -527,8 +527,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
break;
case enumCompileType.cs:
case enumCompileType.lsl:
results = CScodeProvider.CompileAssemblyFromSource(
parameters, Script);
lock (CScodeProvider)
{
results = CScodeProvider.CompileAssemblyFromSource(
parameters, Script);
}
break;
case enumCompileType.js:
results = JScodeProvider.CompileAssemblyFromSource(

View File

@ -142,6 +142,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
get { return m_ScriptConfig; }
}
public event ScriptRemoved OnScriptRemoved;
public event ObjectRemoved OnObjectRemoved;
//
// IRegionModule functions
//
@ -702,6 +705,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (part != null)
part.RemoveScriptEvents(itemID);
bool objectRemoved = false;
lock (m_PrimObjects)
{
// Remove the script from it's prim
@ -715,6 +720,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (m_PrimObjects[localID].Count == 0)
{
m_PrimObjects.Remove(localID);
objectRemoved = true;
}
}
}
@ -731,8 +737,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
instance = null;
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
if (handlerObjectRemoved != null)
handlerObjectRemoved(part.UUID);
CleanAssemblies();
}
ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
if (handlerScriptRemoved != null)
handlerScriptRemoved(itemID);
}
public void OnScriptReset(uint localID, UUID itemID)