Remove the scripts of the attachments in the departing region and recreate them if fail.

bulletsim
Diva Canto 2011-04-29 15:52:06 -07:00
parent 73caa4e94a
commit 0d49611f6d
2 changed files with 12 additions and 2 deletions

View File

@ -479,7 +479,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Fail. Reset it back
sp.IsChildAgent = false;
ReInstantiateScripts(sp);
ResetFromTransit(sp.UUID);
EnableChildAgents(sp);
@ -930,6 +930,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (!WaitForCallback(agent.UUID))
{
m_log.Debug("[ENTITY TRANSFER MODULE]: Callback never came in crossing agent");
ReInstantiateScripts(agent);
ResetFromTransit(agent.UUID);
// Yikes! We should just have a ref to scene here.
@ -1756,7 +1757,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return false;
}
protected void ReInstantiateScripts(ScenePresence sp)
{
sp.Attachments.ForEach(delegate(SceneObjectGroup sog)
{
sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0);
sog.ResumeScripts();
});
}
#endregion
}

View File

@ -3113,6 +3113,8 @@ namespace OpenSim.Region.Framework.Scenes
((SceneObjectGroup)clone).RootPart.IsAttachment = false;
cAgent.AttachmentObjects.Add(clone);
cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot());
// Let's remove the scripts of the original object here
sog.RemoveScriptInstances(true);
}
}
}