SOG copy bug fix, now new group has own empty list of sitted avatars. Also changed crossing code to restore sitting avas in case of group cross fail

avinationmerge
UbitUmarov 2012-05-04 11:32:37 +01:00
parent 2af7f50f26
commit 58a1a0710c
1 changed files with 52 additions and 10 deletions

View File

@ -466,6 +466,14 @@ namespace OpenSim.Region.Framework.Scenes
return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0));
}
private struct avtocrossInfo
{
public ScenePresence av;
public uint ParentID;
}
/// <summary>
/// The absolute position of this scene object in the scene
/// </summary>
@ -517,15 +525,24 @@ namespace OpenSim.Region.Framework.Scenes
{
// We unparent the SP quietly so that it won't
// be made to stand up
List<avtocrossInfo> avsToCross = new List<avtocrossInfo>();
foreach (ScenePresence av in m_linkedAvatars)
{
avtocrossInfo avinfo = new avtocrossInfo();
SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID);
if (parentPart != null)
av.ParentUUID = parentPart.UUID;
avinfo.av = av;
avinfo.ParentID = av.ParentID;
avsToCross.Add(avinfo);
av.ParentID = 0;
}
// m_linkedAvatars.Clear();
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
// Normalize
@ -541,18 +558,37 @@ namespace OpenSim.Region.Framework.Scenes
// If it's deleted, crossing was successful
if (IsDeleted)
{
foreach (ScenePresence av in m_linkedAvatars)
// foreach (ScenePresence av in m_linkedAvatars)
foreach (avtocrossInfo avinfo in avsToCross)
{
m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);
ScenePresence av = avinfo.av;
if (!av.IsInTransit) // just in case...
{
m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);
av.IsInTransit = true;
av.IsInTransit = true;
CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync;
d.BeginInvoke(av, val, x, y, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d);
CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync;
d.BeginInvoke(av, val, x, y, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d);
}
else
m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val);
}
avsToCross.Clear();
return;
}
else // cross failed, put avas back ??
{
foreach (avtocrossInfo avinfo in avsToCross)
{
ScenePresence av = avinfo.av;
av.ParentUUID = UUID.Zero;
av.ParentID = avinfo.ParentID;
// m_linkedAvatars.Add(av);
}
}
avsToCross.Clear();
}
else if (RootPart.PhysActor != null)
{
@ -565,6 +601,7 @@ namespace OpenSim.Region.Framework.Scenes
val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f);
}
}
/* don't see the need but worse don't see where is restored to false if things stay in
foreach (SceneObjectPart part in m_parts.GetArray())
{
@ -640,9 +677,12 @@ namespace OpenSim.Region.Framework.Scenes
{
agent.ParentPart = null;
agent.ParentPosition = Vector3.Zero;
// agent.ParentUUID = UUID.Zero;
}
}
agent.ParentUUID = UUID.Zero;
// agent.Reset();
// else // Not successful
// agent.RestoreInCurrentScene();
@ -1787,7 +1827,6 @@ namespace OpenSim.Region.Framework.Scenes
});
}
}
public void AddScriptLPS(int count)
@ -2069,6 +2108,9 @@ namespace OpenSim.Region.Framework.Scenes
dupe.m_isBackedUp = false;
dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>();
// new group as no sitting avatars
dupe.m_linkedAvatars = new List<ScenePresence>();
// Warning, The following code related to previousAttachmentStatus is needed so that clones of
// attachments do not bordercross while they're being duplicated. This is hacktastic!
// Normally, setting AbsolutePosition will bordercross a prim if it's outside the region!