Merge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Melanie 2010-08-24 19:22:00 +01:00
commit ef5b628191
2 changed files with 39 additions and 0 deletions

View File

@ -446,6 +446,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Now let's make it officially a child agent
sp.MakeChildAgent();
sp.Scene.CleanDroppedAttachments();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))

View File

@ -3209,6 +3209,9 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Debug("[Scene] Beginning OnRemovePresence");
m_eventManager.TriggerOnRemovePresence(agentID);
m_log.Debug("[Scene] Finished OnRemovePresence");
CleanDroppedAttachments();
ForEachClient(
delegate(IClientAPI client)
{
@ -3442,6 +3445,8 @@ namespace OpenSim.Region.Framework.Scenes
if (vialogin)
{
CleanDroppedAttachments();
if (TestBorderCross(agent.startpos, Cardinals.E))
{
Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E);
@ -5040,5 +5045,37 @@ namespace OpenSim.Region.Framework.Scenes
throw new Exception(error);
}
}
public void CleanDroppedAttachments()
{
List<SceneObjectGroup> objectsToDelete =
new List<SceneObjectGroup>();
ForEachSOG(delegate (SceneObjectGroup grp)
{
if (grp.RootPart.Shape.State != 0)
{
UUID agentID = grp.OwnerID;
if (agentID == UUID.Zero)
{
objectsToDelete.Add(grp);
return;
}
ScenePresence sp = GetScenePresence(agentID);
if (sp == null)
{
objectsToDelete.Add(grp);
return;
}
}
});
foreach (SceneObjectGroup grp in objectsToDelete)
{
m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID);
DeleteSceneObject(grp, true);
}
}
}
}