From f8e4805d98dc464b703beb21b5896b62a9efded2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Aug 2014 01:34:16 +0100 Subject: [PATCH] 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 ) --- .../EntityTransfer/EntityTransferModule.cs | 18 +++- .../Region/Framework/Scenes/ScenePresence.cs | 97 ++++++++++++------- 2 files changed, 74 insertions(+), 41 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index feeb0d5cd6..0208676036 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -980,7 +980,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } // 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. KillEntity(sp.Scene, sp.LocalId); @@ -1147,7 +1148,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.CloseChildAgents(newRegionX, newRegionY); // 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. KillEntity(sp.Scene, sp.LocalId); @@ -1262,7 +1264,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) { if (sp.Scene.AttachmentsModule != null) - sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true); + sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, logout); } protected void KillEntity(Scene scene, uint localID) @@ -1740,6 +1742,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } // No turning back + + + agent.IsChildAgent = true; 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. m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); - agent.parcelRegionCross(false); + AgentHasMovedAway(agent, false); + + KillEntity(agent.Scene, agent.LocalId); +// agent.parcelRegionCross(false); agent.MakeChildAgent(); @@ -1803,7 +1811,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.CloseChildAgents(neighbourx, neighboury); - AgentHasMovedAway(agent, false); + // the user may change their profile information in other region, // so the userinfo in UserProfileCache is not reliable any more, delete it diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5af6a6c132..977ff24985 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1400,7 +1400,7 @@ namespace OpenSim.Region.Framework.Scenes else Animator.ResetAnimations(); - + // m_log.DebugFormat( // "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", // Name, UUID, m_scene.RegionInfo.RegionName); @@ -1876,17 +1876,14 @@ namespace OpenSim.Region.Framework.Scenes if (!IsChildAgent) { - newhide = m_currentParcelHide; - m_currentParcelHide = false; - // take this region out of children Neighbours list - // possible should be done elsewhere - DropThisRootRegionFromNeighbours(); ValidateAndSendAppearanceAndAgentData(); m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + List attachments = GetAttachments(); + // attachments if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) { @@ -1899,8 +1896,6 @@ namespace OpenSim.Region.Framework.Scenes } else { - List attachments = GetAttachments(); - if (attachments.Count > 0) { m_log.DebugFormat( @@ -1930,7 +1925,7 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); // send the rest of the world - if (m_teleportFlags > 0 && !isNPC) + if (m_teleportFlags > 0 && !isNPC || m_currentParcelHide) SendInitialDataToMe(); m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); @@ -1961,11 +1956,11 @@ namespace OpenSim.Region.Framework.Scenes m_inTransit = false; } // if hide force a check - if (!IsChildAgent && newhide) - { - ParcelLoginCheck(m_currentParcelUUID); - m_currentParcelHide = newhide; - } + // if (!IsChildAgent && newhide) + // { + // ParcelLoginCheck(m_currentParcelUUID); + // m_currentParcelHide = newhide; + // } m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts)); } @@ -3533,14 +3528,25 @@ namespace OpenSim.Region.Framework.Scenes m_scene.AvatarFactory.QueueAppearanceSave(UUID); } + bool newhide = m_currentParcelHide; + m_currentParcelHide = false; + SendAvatarDataToAllAgents(); + + if (newhide) + { + ParcelLoginCheck(m_currentParcelUUID); + m_currentParcelHide = true; + } + SendAppearanceToAgent(this); // if (cachedappearance) // { SendAppearanceToAllOtherAgents(); // } - Animator.SendAnimPack(); + if(Animator!= null) + Animator.SendAnimPack(); } /// @@ -5481,7 +5487,7 @@ namespace OpenSim.Region.Framework.Scenes private void ParcelLoginCheck(UUID currentParcelID) { List killsToSendto = new List(); - List killsToSendme = new List(); + List killsToSendme = new List(); List viewsToSendto = new List(); List viewsToSendme = new List(); List allpresences = null; @@ -5498,7 +5504,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.GodLevel < 200) killsToSendto.Add(p); if (GodLevel < 200 && p.ParcelHideThisAvatar) - killsToSendme.Add(p); + killsToSendme.Add(p.LocalId); } else { @@ -5522,14 +5528,15 @@ namespace OpenSim.Region.Framework.Scenes 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); - try { ControllingClient.SendKillObject(new List { p.LocalId }); } - catch (NullReferenceException) { } + ControllingClient.SendKillObject(killsToSendme); } - } + catch (NullReferenceException) { } + } +/* if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) { foreach (ScenePresence p in viewsToSendto) @@ -5557,16 +5564,18 @@ namespace OpenSim.Region.Framework.Scenes p.Animator.SendAnimPackToClient(ControllingClient); } } +*/ } public void parcelRegionCross(bool abort) { - if (!ParcelHideThisAvatar) - return; +// if (!ParcelHideThisAvatar) +// return; List allpresences = null; allpresences = m_scene.GetScenePresences(); +// abort no longer complet if (abort) { List viewsToSendme = new List(); @@ -5588,7 +5597,7 @@ namespace OpenSim.Region.Framework.Scenes { if (p.IsChildAgent) continue; -// m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); + // m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); ControllingClient.SendAvatarDataImmediate(p); p.SendAppearanceToAgent(this); p.SendAttachmentsToClient(ControllingClient); @@ -5599,22 +5608,36 @@ namespace OpenSim.Region.Framework.Scenes } else { - if (GodLevel >= 200) - return; + bool inprivate = ParcelHideThisAvatar && GodLevel < 200; List killsToSendme = new List(); - foreach (ScenePresence p in allpresences) - { - 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); + if (inprivate) + { + foreach (ScenePresence p in allpresences) + { + 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); } } - +*/ if (killsToSendme.Count > 0) { try @@ -5623,8 +5646,10 @@ namespace OpenSim.Region.Framework.Scenes } catch (NullReferenceException) { } } + + if (Scene.AttachmentsModule != null) + Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); - } }