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
parent
292672675a
commit
0377ddb5de
|
@ -96,6 +96,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
get { return "ScriptEngine.DotNetEngine"; }
|
get { return "ScriptEngine.DotNetEngine"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event ScriptRemoved OnScriptRemoved;
|
||||||
|
public event ObjectRemoved OnObjectRemoved;
|
||||||
|
|
||||||
public ScriptEngine()
|
public ScriptEngine()
|
||||||
{
|
{
|
||||||
// For logging, just need any instance, doesn't matter
|
// For logging, just need any instance, doesn't matter
|
||||||
|
|
|
@ -41,6 +41,10 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
/// An interface for a script API module to communicate with
|
/// An interface for a script API module to communicate with
|
||||||
/// the engine it's running under
|
/// the engine it's running under
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
|
public delegate void ScriptRemoved(UUID script);
|
||||||
|
public delegate void ObjectRemoved(UUID prim);
|
||||||
|
|
||||||
public interface IScriptEngine
|
public interface IScriptEngine
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -50,6 +54,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
|
|
||||||
Scene World { get; }
|
Scene World { get; }
|
||||||
|
|
||||||
|
event ScriptRemoved OnScriptRemoved;
|
||||||
|
event ObjectRemoved OnObjectRemoved;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Post an event to a single script
|
/// Post an event to a single script
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -527,8 +527,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||||
break;
|
break;
|
||||||
case enumCompileType.cs:
|
case enumCompileType.cs:
|
||||||
case enumCompileType.lsl:
|
case enumCompileType.lsl:
|
||||||
|
lock (CScodeProvider)
|
||||||
|
{
|
||||||
results = CScodeProvider.CompileAssemblyFromSource(
|
results = CScodeProvider.CompileAssemblyFromSource(
|
||||||
parameters, Script);
|
parameters, Script);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case enumCompileType.js:
|
case enumCompileType.js:
|
||||||
results = JScodeProvider.CompileAssemblyFromSource(
|
results = JScodeProvider.CompileAssemblyFromSource(
|
||||||
|
|
|
@ -142,6 +142,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
get { return m_ScriptConfig; }
|
get { return m_ScriptConfig; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event ScriptRemoved OnScriptRemoved;
|
||||||
|
public event ObjectRemoved OnObjectRemoved;
|
||||||
|
|
||||||
//
|
//
|
||||||
// IRegionModule functions
|
// IRegionModule functions
|
||||||
//
|
//
|
||||||
|
@ -702,6 +705,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
if (part != null)
|
if (part != null)
|
||||||
part.RemoveScriptEvents(itemID);
|
part.RemoveScriptEvents(itemID);
|
||||||
|
|
||||||
|
bool objectRemoved = false;
|
||||||
|
|
||||||
lock (m_PrimObjects)
|
lock (m_PrimObjects)
|
||||||
{
|
{
|
||||||
// Remove the script from it's prim
|
// Remove the script from it's prim
|
||||||
|
@ -715,6 +720,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
if (m_PrimObjects[localID].Count == 0)
|
if (m_PrimObjects[localID].Count == 0)
|
||||||
{
|
{
|
||||||
m_PrimObjects.Remove(localID);
|
m_PrimObjects.Remove(localID);
|
||||||
|
objectRemoved = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -731,8 +737,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
instance = null;
|
instance = null;
|
||||||
|
|
||||||
|
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
|
||||||
|
if (handlerObjectRemoved != null)
|
||||||
|
handlerObjectRemoved(part.UUID);
|
||||||
|
|
||||||
CleanAssemblies();
|
CleanAssemblies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
|
||||||
|
if (handlerScriptRemoved != null)
|
||||||
|
handlerScriptRemoved(itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnScriptReset(uint localID, UUID itemID)
|
public void OnScriptReset(uint localID, UUID itemID)
|
||||||
|
|
Loading…
Reference in New Issue