NOT GOOD. Changed hide code on crossing/tp. Send needed avatar and attachments

kills, visible so we can see what is going on, to try to improve later
(this are always needed, hidding just made issues more visible )
avinationmerge
UbitUmarov 2014-08-18 01:34:16 +01:00
parent 31a2c07e83
commit f8e4805d98
2 changed files with 74 additions and 41 deletions

View File

@ -980,7 +980,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
// May need to logout or other cleanup // May need to logout or other cleanup
AgentHasMovedAway(sp, logout); // AgentHasMovedAway(sp, logout);
AgentHasMovedAway(sp, true); // until logout use is checked
// Well, this is it. The agent is over there. // Well, this is it. The agent is over there.
KillEntity(sp.Scene, sp.LocalId); KillEntity(sp.Scene, sp.LocalId);
@ -1147,7 +1148,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.CloseChildAgents(newRegionX, newRegionY); sp.CloseChildAgents(newRegionX, newRegionY);
// May need to logout or other cleanup // May need to logout or other cleanup
AgentHasMovedAway(sp, logout); // AgentHasMovedAway(sp, logout);
AgentHasMovedAway(sp, true);
// Well, this is it. The agent is over there. // Well, this is it. The agent is over there.
KillEntity(sp.Scene, sp.LocalId); KillEntity(sp.Scene, sp.LocalId);
@ -1262,7 +1264,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
{ {
if (sp.Scene.AttachmentsModule != null) if (sp.Scene.AttachmentsModule != null)
sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true); sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, logout);
} }
protected void KillEntity(Scene scene, uint localID) protected void KillEntity(Scene scene, uint localID)
@ -1740,6 +1742,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
// No turning back // No turning back
agent.IsChildAgent = true; agent.IsChildAgent = true;
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
@ -1777,7 +1782,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Unlike a teleport, here we do not wait for the destination region to confirm the receipt. // Unlike a teleport, here we do not wait for the destination region to confirm the receipt.
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
agent.parcelRegionCross(false); AgentHasMovedAway(agent, false);
KillEntity(agent.Scene, agent.LocalId);
// agent.parcelRegionCross(false);
agent.MakeChildAgent(); agent.MakeChildAgent();
@ -1803,7 +1811,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agent.CloseChildAgents(neighbourx, neighboury); agent.CloseChildAgents(neighbourx, neighboury);
AgentHasMovedAway(agent, false);
// the user may change their profile information in other region, // the user may change their profile information in other region,
// so the userinfo in UserProfileCache is not reliable any more, delete it // so the userinfo in UserProfileCache is not reliable any more, delete it

View File

@ -1876,17 +1876,14 @@ namespace OpenSim.Region.Framework.Scenes
if (!IsChildAgent) if (!IsChildAgent)
{ {
newhide = m_currentParcelHide;
m_currentParcelHide = false;
// take this region out of children Neighbours list
// possible should be done elsewhere
DropThisRootRegionFromNeighbours();
ValidateAndSendAppearanceAndAgentData(); ValidateAndSendAppearanceAndAgentData();
m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts));
List<SceneObjectGroup> attachments = GetAttachments();
// attachments // attachments
if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0)
{ {
@ -1899,8 +1896,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
List<SceneObjectGroup> attachments = GetAttachments();
if (attachments.Count > 0) if (attachments.Count > 0)
{ {
m_log.DebugFormat( m_log.DebugFormat(
@ -1930,7 +1925,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts));
// send the rest of the world // send the rest of the world
if (m_teleportFlags > 0 && !isNPC) if (m_teleportFlags > 0 && !isNPC || m_currentParcelHide)
SendInitialDataToMe(); SendInitialDataToMe();
m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@ -1961,11 +1956,11 @@ namespace OpenSim.Region.Framework.Scenes
m_inTransit = false; m_inTransit = false;
} }
// if hide force a check // if hide force a check
if (!IsChildAgent && newhide) // if (!IsChildAgent && newhide)
{ // {
ParcelLoginCheck(m_currentParcelUUID); // ParcelLoginCheck(m_currentParcelUUID);
m_currentParcelHide = newhide; // m_currentParcelHide = newhide;
} // }
m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts)); m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts));
} }
@ -3533,14 +3528,25 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.AvatarFactory.QueueAppearanceSave(UUID); m_scene.AvatarFactory.QueueAppearanceSave(UUID);
} }
bool newhide = m_currentParcelHide;
m_currentParcelHide = false;
SendAvatarDataToAllAgents(); SendAvatarDataToAllAgents();
if (newhide)
{
ParcelLoginCheck(m_currentParcelUUID);
m_currentParcelHide = true;
}
SendAppearanceToAgent(this); SendAppearanceToAgent(this);
// if (cachedappearance) // if (cachedappearance)
// { // {
SendAppearanceToAllOtherAgents(); SendAppearanceToAllOtherAgents();
// } // }
Animator.SendAnimPack(); if(Animator!= null)
Animator.SendAnimPack();
} }
/// <summary> /// <summary>
@ -5481,7 +5487,7 @@ namespace OpenSim.Region.Framework.Scenes
private void ParcelLoginCheck(UUID currentParcelID) private void ParcelLoginCheck(UUID currentParcelID)
{ {
List<ScenePresence> killsToSendto = new List<ScenePresence>(); List<ScenePresence> killsToSendto = new List<ScenePresence>();
List<ScenePresence> killsToSendme = new List<ScenePresence>(); List<uint> killsToSendme = new List<uint>();
List<ScenePresence> viewsToSendto = new List<ScenePresence>(); List<ScenePresence> viewsToSendto = new List<ScenePresence>();
List<ScenePresence> viewsToSendme = new List<ScenePresence>(); List<ScenePresence> viewsToSendme = new List<ScenePresence>();
List<ScenePresence> allpresences = null; List<ScenePresence> allpresences = null;
@ -5498,7 +5504,7 @@ namespace OpenSim.Region.Framework.Scenes
if (p.GodLevel < 200) if (p.GodLevel < 200)
killsToSendto.Add(p); killsToSendto.Add(p);
if (GodLevel < 200 && p.ParcelHideThisAvatar) if (GodLevel < 200 && p.ParcelHideThisAvatar)
killsToSendme.Add(p); killsToSendme.Add(p.LocalId);
} }
else else
{ {
@ -5522,14 +5528,15 @@ namespace OpenSim.Region.Framework.Scenes
if (killsToSendme.Count > 0) if (killsToSendme.Count > 0)
{ {
foreach (ScenePresence p in killsToSendme) m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + killsToSendme.Count.ToString());
try
{ {
m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); ControllingClient.SendKillObject(killsToSendme);
try { ControllingClient.SendKillObject(new List<uint> { p.LocalId }); }
catch (NullReferenceException) { }
} }
} catch (NullReferenceException) { }
}
/*
if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc)
{ {
foreach (ScenePresence p in viewsToSendto) foreach (ScenePresence p in viewsToSendto)
@ -5557,16 +5564,18 @@ namespace OpenSim.Region.Framework.Scenes
p.Animator.SendAnimPackToClient(ControllingClient); p.Animator.SendAnimPackToClient(ControllingClient);
} }
} }
*/
} }
public void parcelRegionCross(bool abort) public void parcelRegionCross(bool abort)
{ {
if (!ParcelHideThisAvatar) // if (!ParcelHideThisAvatar)
return; // return;
List<ScenePresence> allpresences = null; List<ScenePresence> allpresences = null;
allpresences = m_scene.GetScenePresences(); allpresences = m_scene.GetScenePresences();
// abort no longer complet
if (abort) if (abort)
{ {
List<ScenePresence> viewsToSendme = new List<ScenePresence>(); List<ScenePresence> viewsToSendme = new List<ScenePresence>();
@ -5588,7 +5597,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (p.IsChildAgent) if (p.IsChildAgent)
continue; continue;
// m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); // m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname);
ControllingClient.SendAvatarDataImmediate(p); ControllingClient.SendAvatarDataImmediate(p);
p.SendAppearanceToAgent(this); p.SendAppearanceToAgent(this);
p.SendAttachmentsToClient(ControllingClient); p.SendAttachmentsToClient(ControllingClient);
@ -5599,22 +5608,36 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
if (GodLevel >= 200)
return;
bool inprivate = ParcelHideThisAvatar && GodLevel < 200;
List<uint> killsToSendme = new List<uint>(); List<uint> killsToSendme = new List<uint>();
foreach (ScenePresence p in allpresences)
{
if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
continue;
if (p.currentParcelUUID == m_currentParcelUUID) if (inprivate)
{
foreach (ScenePresence p in allpresences)
{ {
m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
continue;
if (p.currentParcelUUID == m_currentParcelUUID)
{
m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname);
killsToSendme.Add(p.LocalId);
}
}
}
/*
else
{
foreach (ScenePresence p in allpresences)
{
if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
continue;
killsToSendme.Add(p.LocalId); killsToSendme.Add(p.LocalId);
} }
} }
*/
if (killsToSendme.Count > 0) if (killsToSendme.Count > 0)
{ {
try try
@ -5624,6 +5647,8 @@ namespace OpenSim.Region.Framework.Scenes
catch (NullReferenceException) { } catch (NullReferenceException) { }
} }
if (Scene.AttachmentsModule != null)
Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true);
} }
} }