Put the previous state back in the attachments in case the agent transfer fails.
parent
df7dacd004
commit
6c503e75ac
|
@ -1759,11 +1759,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
protected void ReInstantiateScripts(ScenePresence sp)
|
protected void ReInstantiateScripts(ScenePresence sp)
|
||||||
{
|
{
|
||||||
|
int i = 0;
|
||||||
sp.Attachments.ForEach(delegate(SceneObjectGroup sog)
|
sp.Attachments.ForEach(delegate(SceneObjectGroup sog)
|
||||||
{
|
{
|
||||||
|
sog.SetState(sp.InTransitScriptStates[i++], sp.Scene);
|
||||||
sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0);
|
sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0);
|
||||||
sog.ResumeScripts();
|
sog.ResumeScripts();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sp.InTransitScriptStates.Clear();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -231,6 +231,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// holds the seed cap for the child agent in that region
|
// holds the seed cap for the child agent in that region
|
||||||
private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>();
|
private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copy of the script states while the agent is in transit. This state may
|
||||||
|
/// need to be placed back in case of transfer fail.
|
||||||
|
/// </summary>
|
||||||
|
public List<string> InTransitScriptStates
|
||||||
|
{
|
||||||
|
get { return m_InTransitScriptStates; }
|
||||||
|
}
|
||||||
|
private List<string> m_InTransitScriptStates = new List<string>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implemented Control Flags
|
/// Implemented Control Flags
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -3142,6 +3152,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
cAgent.AttachmentObjects = new List<ISceneObject>();
|
cAgent.AttachmentObjects = new List<ISceneObject>();
|
||||||
cAgent.AttachmentObjectStates = new List<string>();
|
cAgent.AttachmentObjectStates = new List<string>();
|
||||||
IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
|
IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
|
||||||
|
m_InTransitScriptStates.Clear();
|
||||||
foreach (SceneObjectGroup sog in m_attachments)
|
foreach (SceneObjectGroup sog in m_attachments)
|
||||||
{
|
{
|
||||||
// We need to make a copy and pass that copy
|
// We need to make a copy and pass that copy
|
||||||
|
@ -3151,7 +3162,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
|
((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
|
||||||
((SceneObjectGroup)clone).RootPart.IsAttachment = false;
|
((SceneObjectGroup)clone).RootPart.IsAttachment = false;
|
||||||
cAgent.AttachmentObjects.Add(clone);
|
cAgent.AttachmentObjects.Add(clone);
|
||||||
cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot());
|
string state = sog.GetStateSnapshot();
|
||||||
|
cAgent.AttachmentObjectStates.Add(state);
|
||||||
|
m_InTransitScriptStates.Add(state);
|
||||||
// Let's remove the scripts of the original object here
|
// Let's remove the scripts of the original object here
|
||||||
sog.RemoveScriptInstances(true);
|
sog.RemoveScriptInstances(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue