Stop an exception being thrown and a teleport/border cross failing if the desintation sim has no active script engines.
This involves getting IScene.RequestModuleInterfaces() to return an empty array (as was stated in the method doc) rather than an array containing one null entry. Callers adjusted to stop checking for the list reference being null (which never happened anyway)0.7.2-post-fixes
parent
8ab2d42143
commit
7be35d5a9a
|
@ -102,12 +102,28 @@ namespace OpenSim.Framework
|
|||
|
||||
bool TryGetScenePresence(UUID agentID, out object scenePresence);
|
||||
|
||||
T RequestModuleInterface<T>();
|
||||
T[] RequestModuleInterfaces<T>();
|
||||
|
||||
/// <summary>
|
||||
/// Register an interface to a region module. This allows module methods to be called directly as
|
||||
/// well as via events. If there is already a module registered for this interface, it is not replaced
|
||||
/// (is this the best behaviour?)
|
||||
/// </summary>
|
||||
/// <param name="mod"></param>
|
||||
void RegisterModuleInterface<M>(M mod);
|
||||
|
||||
void StackModuleInterface<M>(M mod);
|
||||
|
||||
/// <summary>
|
||||
/// For the given interface, retrieve the region module which implements it.
|
||||
/// </summary>
|
||||
/// <returns>null if there is no registered module implementing that interface</returns>
|
||||
T RequestModuleInterface<T>();
|
||||
|
||||
/// <summary>
|
||||
/// For the given interface, retrieve an array of region modules that implement it.
|
||||
/// </summary>
|
||||
/// <returns>an empty array if there are no registered modules implementing that interface</returns>
|
||||
T[] RequestModuleInterfaces<T>();
|
||||
|
||||
// void AddCommand(object module, string command, string shorthelp, string longhelp, CommandDelegate callback);
|
||||
|
||||
ISceneObject DeserializeObject(string representation);
|
||||
|
|
|
@ -82,16 +82,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
|
||||
|
||||
IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
|
||||
if (engines != null)
|
||||
{
|
||||
foreach (IScriptModule engine in engines)
|
||||
{
|
||||
if (engine != null)
|
||||
{
|
||||
engine.StartProcessing();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (IScriptModule engine in engines)
|
||||
engine.StartProcessing();
|
||||
}
|
||||
|
||||
public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)
|
||||
|
|
|
@ -449,7 +449,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
return new T[] { default(T) };
|
||||
return new T[] {};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -232,8 +232,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
ArrayList ret = new ArrayList();
|
||||
|
||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
||||
if (engines == null) // No engine at all
|
||||
return ret;
|
||||
|
||||
foreach (IScriptModule e in engines)
|
||||
{
|
||||
|
@ -329,7 +327,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private void RestoreSavedScriptState(UUID oldID, UUID newID)
|
||||
{
|
||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
||||
if (engines == null) // No engine at all
|
||||
if (engines.Length == 0) // No engine at all
|
||||
return;
|
||||
|
||||
if (m_part.ParentGroup.m_savedScriptState.ContainsKey(oldID))
|
||||
|
@ -369,6 +367,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml;
|
||||
}
|
||||
|
||||
foreach (IScriptModule e in engines)
|
||||
{
|
||||
if (e != null)
|
||||
|
@ -377,6 +376,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_part.ParentGroup.m_savedScriptState.Remove(oldID);
|
||||
}
|
||||
}
|
||||
|
@ -1129,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
||||
|
||||
if (engines == null) // No engine at all
|
||||
if (engines.Length == 0) // No engine at all
|
||||
return ret;
|
||||
|
||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||
|
@ -1157,7 +1157,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void ResumeScripts()
|
||||
{
|
||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
||||
if (engines == null)
|
||||
if (engines.Length == 0)
|
||||
return;
|
||||
|
||||
List<TaskInventoryItem> scripts = GetInventoryScripts();
|
||||
|
|
|
@ -3566,23 +3566,23 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="args">The arguments for the event</param>
|
||||
public void SendScriptEventToAttachments(string eventName, Object[] args)
|
||||
{
|
||||
if (m_scriptEngines != null)
|
||||
{
|
||||
lock (m_attachments)
|
||||
{
|
||||
foreach (SceneObjectGroup grp in m_attachments)
|
||||
{
|
||||
// 16384 is CHANGED_ANIMATION
|
||||
//
|
||||
// Send this to all attachment root prims
|
||||
//
|
||||
foreach (IScriptModule m in m_scriptEngines)
|
||||
{
|
||||
if (m == null) // No script engine loaded
|
||||
continue;
|
||||
if (m_scriptEngines.Length == 0)
|
||||
return;
|
||||
|
||||
m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION });
|
||||
}
|
||||
lock (m_attachments)
|
||||
{
|
||||
foreach (SceneObjectGroup grp in m_attachments)
|
||||
{
|
||||
// 16384 is CHANGED_ANIMATION
|
||||
//
|
||||
// Send this to all attachment root prims
|
||||
//
|
||||
foreach (IScriptModule m in m_scriptEngines)
|
||||
{
|
||||
if (m == null) // No script engine loaded
|
||||
continue;
|
||||
|
||||
m.PostObjectEvent(grp.RootPart.UUID, "changed", new Object[] { (int)Changed.ANIMATION });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue