From 580604c231a77ab25b49dbbb3e209780ad1bfc4e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 2 Aug 2014 22:32:51 +0100 Subject: [PATCH 01/19] let gods see hidden avatars ( test ) --- .../Region/Framework/Scenes/ScenePresence.cs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a9a6ba43be..3bdfb322a6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3377,7 +3377,7 @@ namespace OpenSim.Region.Framework.Scenes if (!remoteClient.IsActive) return; - if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID) + if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && p.GodLevel < 200) return; @@ -3586,7 +3586,7 @@ namespace OpenSim.Region.Framework.Scenes public void SendAvatarDataToAgent(ScenePresence avatar) { //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); - if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID) + if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) return; avatar.ControllingClient.SendAvatarDataImmediate(this); Animator.SendAnimPackToClient(avatar.ControllingClient); @@ -3653,7 +3653,7 @@ namespace OpenSim.Region.Framework.Scenes { // m_log.DebugFormat( // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); - if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID) + if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) return; avatar.ControllingClient.SendAppearance( UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); @@ -3947,6 +3947,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void GrantGodlikePowers(UUID agentID, UUID sessionID, UUID token, bool godStatus) { + int oldgodlevel = GodLevel; + if (godStatus) { // For now, assign god level 200 to anyone @@ -3967,6 +3969,10 @@ namespace OpenSim.Region.Framework.Scenes } ControllingClient.SendAdminResponse(token, (uint)GodLevel); + + if(oldgodlevel != GodLevel) // force a visibility check + ParcelCrossCheck(m_currentParcelUUID, m_previusParcelUUID, + true, m_previusParcelHide, false, true); } #region Child Agent Updates @@ -5404,7 +5410,7 @@ namespace OpenSim.Region.Framework.Scenes continue; // those on not on parcel see me - if (currentParcelUUID != p.currentParcelUUID) + if (currentParcelUUID != p.currentParcelUUID || p.GodLevel >= 200) { viewsToSendto.Add(p); // they see me } @@ -5419,7 +5425,7 @@ namespace OpenSim.Region.Framework.Scenes continue; // those not on parcel dont see me - if (currentParcelUUID != p.currentParcelUUID) + if (currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) { killsToSendto.Add(p); // they dont see me } @@ -5444,13 +5450,13 @@ namespace OpenSim.Region.Framework.Scenes continue; // only those on previus parcel need receive kills - if (previusParcelUUID == p.currentParcelUUID) + if (previusParcelUUID == p.currentParcelUUID && p.GodLevel < 200) { killsToSendto.Add(p); // they dont see me killsToSendme.Add(p); // i dont see them } // only those on new parcel need see - if (currentParcelUUID == p.currentParcelUUID) + if (currentParcelUUID == p.currentParcelUUID || p.GodLevel >= 200) { viewsToSendto.Add(p); // they see me viewsToSendme.Add(p); // i see them @@ -5468,7 +5474,7 @@ namespace OpenSim.Region.Framework.Scenes continue; // those not on new parcel dont see me - if (currentParcelUUID != p.currentParcelUUID) + if (currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) { killsToSendto.Add(p); // they dont see me } @@ -5494,7 +5500,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; // only those old parcel need receive kills - if (previusParcelUUID == p.currentParcelUUID) + if (previusParcelUUID == p.currentParcelUUID && p.GodLevel < 200) { killsToSendme.Add(p); // i dont see them } From e87f70e277e78fb37100b2750fcb09b3aacb1734 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 2 Aug 2014 22:45:28 +0100 Subject: [PATCH 02/19] god also read local chat --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 7 ++++++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 9b41083991..71ceb656a1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -238,10 +238,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat if (avatar.GodLevel >= 200) { fromNamePrefix = m_adminPrefix; + checkParcelHide = false; + } + else + { + checkParcelHide = true; } destination = UUID.Zero; // Avatars cant "SayTo" ownerID = c.Sender.AgentId; - checkParcelHide = true; + hidePos = fromPos; break; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3bdfb322a6..5327b825fc 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3972,7 +3972,7 @@ namespace OpenSim.Region.Framework.Scenes if(oldgodlevel != GodLevel) // force a visibility check ParcelCrossCheck(m_currentParcelUUID, m_previusParcelUUID, - true, m_previusParcelHide, false, true); + m_currentParcelHide , m_previusParcelHide, false, true); } #region Child Agent Updates From 009e8ee76c23c8ba796d48a99e224c06f8c8e1d8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 2 Aug 2014 23:04:18 +0100 Subject: [PATCH 03/19] testing --- .../Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5327b825fc..2b7c7028fb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3972,7 +3972,7 @@ namespace OpenSim.Region.Framework.Scenes if(oldgodlevel != GodLevel) // force a visibility check ParcelCrossCheck(m_currentParcelUUID, m_previusParcelUUID, - m_currentParcelHide , m_previusParcelHide, false, true); + !m_currentParcelHide, m_previusParcelHide, m_currentParcelHide, true); } #region Child Agent Updates @@ -5402,7 +5402,21 @@ namespace OpenSim.Region.Framework.Scenes allpresences = m_scene.GetScenePresences(); - if (oldhide) + if (GodLevel >= 200) + { + foreach (ScenePresence p in allpresences) + { + if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) + continue; + + if (p.ParcelHideThisAvatar) + { + viewsToSendto.Add(p); // they see me + } + } + } + + else if (oldhide) { // where private foreach (ScenePresence p in allpresences) { From addca0737c10ee813f89e0417f53b22468d39cd1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 2 Aug 2014 23:38:18 +0100 Subject: [PATCH 04/19] testing... --- .../Region/Framework/Scenes/ScenePresence.cs | 87 ++++++++++++++----- 1 file changed, 67 insertions(+), 20 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2b7c7028fb..f3b5a544d3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3970,9 +3970,8 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendAdminResponse(token, (uint)GodLevel); - if(oldgodlevel != GodLevel) // force a visibility check - ParcelCrossCheck(m_currentParcelUUID, m_previusParcelUUID, - !m_currentParcelHide, m_previusParcelHide, m_currentParcelHide, true); + if(oldgodlevel != GodLevel) + parcelGodCheck(m_currentParcelUUID, GodLevel >= 200); } #region Child Agent Updates @@ -5383,6 +5382,68 @@ namespace OpenSim.Region.Framework.Scenes } + private void parcelGodCheck(UUID currentParcelUUID, bool isGod) + { + List allpresences = null; + + + allpresences = m_scene.GetScenePresences(); + + if (isGod) + { + List viewsToSendme = new List(); + + foreach (ScenePresence p in allpresences) + { + if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) + continue; + + if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID) + { + viewsToSendme.Add(p); // i see them + } + } + + if (viewsToSendme.Count > 0) + { + foreach (ScenePresence p in viewsToSendme) + { + ControllingClient.SendAvatarDataImmediate(p); + p.SendAppearanceToAgent(this); + p.SendAttachmentsToClient(ControllingClient); + if (p.Animator != null) + p.Animator.SendAnimPackToClient(ControllingClient); + } + } + } + else + { + List killsToSendme = new List(); + + foreach (ScenePresence p in allpresences) + { + if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) + continue; + + if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID) + { + killsToSendme.Add(p); + } + } + + if (killsToSendme.Count > 0 && PresenceType != PresenceType.Npc) + { + foreach (ScenePresence p in killsToSendme) + { + try { ControllingClient.SendKillObject(new List { p.LocalId }); } + catch (NullReferenceException) { } + } + } + } + + } + + private void ParcelCrossCheck(UUID currentParcelUUID,UUID previusParcelUUID, bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check) { @@ -5397,26 +5458,13 @@ namespace OpenSim.Region.Framework.Scenes if (check) { + // check is relative to current parcel only if (currentParcelUUID == null || oldhide == currentParcelHide) return; allpresences = m_scene.GetScenePresences(); - if (GodLevel >= 200) - { - foreach (ScenePresence p in allpresences) - { - if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) - continue; - - if (p.ParcelHideThisAvatar) - { - viewsToSendto.Add(p); // they see me - } - } - } - - else if (oldhide) + if (oldhide) { // where private foreach (ScenePresence p in allpresences) { @@ -5424,7 +5472,7 @@ namespace OpenSim.Region.Framework.Scenes continue; // those on not on parcel see me - if (currentParcelUUID != p.currentParcelUUID || p.GodLevel >= 200) + if (currentParcelUUID != p.currentParcelUUID) { viewsToSendto.Add(p); // they see me } @@ -5446,7 +5494,6 @@ namespace OpenSim.Region.Framework.Scenes } } // where public end - allpresences.Clear(); } else From 9f5e19127d79a8790c31e80a4c6ae8d04d79d6ac Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 00:22:21 +0100 Subject: [PATCH 05/19] comment out a debug msg. more on gods being Gods --- .../Caps/EventQueue/EventQueueGetModule.cs | 2 +- .../Region/Framework/Scenes/ScenePresence.cs | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index b0d30b68e0..ca6c3ca1a7 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -358,7 +358,7 @@ namespace OpenSim.Region.ClientStack.Linden return queue.Count > 0; } - m_log.WarnFormat("POLLED FOR EVENTS BY {0} unknown agent", agentID); + //m_log.WarnFormat("POLLED FOR EVENTS BY {0} unknown agent", agentID); return true; } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f3b5a544d3..4faad98664 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -164,12 +164,12 @@ namespace OpenSim.Region.Framework.Scenes lock (parcelLock) { bool oldhide = m_currentParcelHide; - bool check = true; + bool checksame = true; if (value != m_currentParcelUUID) { m_previusParcelHide = m_currentParcelHide; m_previusParcelUUID = m_currentParcelUUID; - check = false; + checksame = false; } m_currentParcelUUID = value; m_currentParcelHide = false; @@ -177,8 +177,9 @@ namespace OpenSim.Region.Framework.Scenes ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X, AbsolutePosition.Y); if (land != null && !land.LandData.SeeAVs) m_currentParcelHide = true; + if (m_previusParcelUUID != UUID.Zero) - ParcelCrossCheck(m_currentParcelUUID,m_previusParcelUUID,m_currentParcelHide, m_previusParcelHide, oldhide,check); + ParcelCrossCheck(m_currentParcelUUID,m_previusParcelUUID,m_currentParcelHide, m_previusParcelHide, oldhide,checksame); } } } @@ -1923,8 +1924,11 @@ namespace OpenSim.Region.Framework.Scenes } // if hide force a check if (!IsChildAgent && newhide) + { ParcelCrossCheck(m_currentParcelUUID, m_previusParcelUUID, true, m_previusParcelHide, false, true); + m_currentParcelHide = newhide; + } } /// @@ -5511,13 +5515,15 @@ namespace OpenSim.Region.Framework.Scenes continue; // only those on previus parcel need receive kills - if (previusParcelUUID == p.currentParcelUUID && p.GodLevel < 200) + if (previusParcelUUID == p.currentParcelUUID) { - killsToSendto.Add(p); // they dont see me - killsToSendme.Add(p); // i dont see them + if(p.GodLevel < 200) + killsToSendto.Add(p); // they dont see me + if(GodLevel < 200) + killsToSendme.Add(p); // i dont see them } // only those on new parcel need see - if (currentParcelUUID == p.currentParcelUUID || p.GodLevel >= 200) + if (currentParcelUUID == p.currentParcelUUID) { viewsToSendto.Add(p); // they see me viewsToSendme.Add(p); // i see them @@ -5561,7 +5567,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; // only those old parcel need receive kills - if (previusParcelUUID == p.currentParcelUUID && p.GodLevel < 200) + if (previusParcelUUID == p.currentParcelUUID && GodLevel < 200) { killsToSendme.Add(p); // i dont see them } From 53e95803a554b35305b4931d26b4a15dd422e2d5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 01:20:34 +0100 Subject: [PATCH 06/19] test not rezzing attachments on a FireAndForget --- .../Region/Framework/Scenes/ScenePresence.cs | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4faad98664..e1d0fb49fa 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1854,24 +1854,15 @@ namespace OpenSim.Region.Framework.Scenes // send what we have to us, even if not in cache ( bad? ) ValidateAndSendAppearanceAndAgentData(); - // Create child agents in neighbouring regions - if (openChildAgents && !IsChildAgent) - { - IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); - if (m_agentTransfer != null) - m_agentTransfer.EnableChildAgents(this); - } - - // attachments if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) { - if (Scene.AttachmentsModule != null) - Util.FireAndForget( - o => - { +// if (Scene.AttachmentsModule != null) +// Util.FireAndForget( +// o => +// { Scene.AttachmentsModule.RezAttachments(this); - }); +// }); } else { @@ -1895,6 +1886,14 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); + // Create child agents in neighbouring regions + if (openChildAgents && !IsChildAgent) + { + IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); + if (m_agentTransfer != null) + m_agentTransfer.EnableChildAgents(this); + } + // send the rest of the world if (m_teleportFlags > 0 && !isNPC) SendInitialDataToMe(); From b9443b186ede80bb74e2d3b5e095d13b183ef670 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 02:09:07 +0100 Subject: [PATCH 07/19] test... --- .../Region/Framework/Scenes/ScenePresence.cs | 76 ++++++++++++++++++- 1 file changed, 74 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e1d0fb49fa..eec1b21864 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1924,8 +1924,7 @@ namespace OpenSim.Region.Framework.Scenes // if hide force a check if (!IsChildAgent && newhide) { - ParcelCrossCheck(m_currentParcelUUID, m_previusParcelUUID, - true, m_previusParcelHide, false, true); + ParcelLoginCheck(m_currentParcelUUID); m_currentParcelHide = newhide; } } @@ -5446,6 +5445,79 @@ namespace OpenSim.Region.Framework.Scenes } + private void ParcelLoginCheck(UUID currentParcelUUID) + { + List killsToSendto = new List(); + List killsToSendme = new List(); + List viewsToSendto = new List(); + List viewsToSendme = new List(); + List allpresences = null; + + allpresences = m_scene.GetScenePresences(); + + foreach (ScenePresence p in allpresences) + { + if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) + continue; + + // those not on parcel dont see me + if (currentParcelUUID != p.currentParcelUUID) + { + if (p.GodLevel < 200) + killsToSendto.Add(p); // they dont see me + } + else + { + viewsToSendto.Add(p); + viewsToSendme.Add(p); + } + } + allpresences.Clear(); + + // send the things + // kill main avatar object + if (killsToSendto.Count > 0) + { + foreach (ScenePresence p in killsToSendto) + { + try { p.ControllingClient.SendKillObject(new List { LocalId }); } + catch (NullReferenceException) { } + } + } + + if (killsToSendme.Count > 0 && PresenceType != PresenceType.Npc) + { + foreach (ScenePresence p in killsToSendme) + { + try { ControllingClient.SendKillObject(new List { p.LocalId }); } + catch (NullReferenceException) { } + } + } + + if (viewsToSendto.Count > 0) + { + foreach (ScenePresence p in viewsToSendto) + { + p.ControllingClient.SendAvatarDataImmediate(this); + SendAppearanceToAgent(p); + SendAttachmentsToClient(p.ControllingClient); + if (Animator != null) + Animator.SendAnimPackToClient(p.ControllingClient); + } + } + + if (viewsToSendme.Count > 0 && PresenceType != PresenceType.Npc) + { + foreach (ScenePresence p in viewsToSendme) + { + ControllingClient.SendAvatarDataImmediate(p); + p.SendAppearanceToAgent(this); + p.SendAttachmentsToClient(ControllingClient); + if (p.Animator != null) + p.Animator.SendAnimPackToClient(ControllingClient); + } + } + } private void ParcelCrossCheck(UUID currentParcelUUID,UUID previusParcelUUID, bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check) From cc16fe68ccf64102f1eea718d42234639a5725f3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 02:26:39 +0100 Subject: [PATCH 08/19] .... --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index eec1b21864..61f66d9dc8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5459,12 +5459,13 @@ namespace OpenSim.Region.Framework.Scenes { if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; - - // those not on parcel dont see me + if (currentParcelUUID != p.currentParcelUUID) { if (p.GodLevel < 200) - killsToSendto.Add(p); // they dont see me + killsToSendto.Add(p); + if (GodLevel < 200 && p.ParcelHideThisAvatar) + killsToSendme.Add(p); } else { From bcab663ad7b6495dc63a6dae46f939d530284cc0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 06:16:30 +0100 Subject: [PATCH 09/19] debug... --- .../Region/Framework/Scenes/ScenePresence.cs | 135 ++++++++++++++---- 1 file changed, 110 insertions(+), 25 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 61f66d9dc8..7b0b1033d2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3868,14 +3868,21 @@ namespace OpenSim.Region.Framework.Scenes /// protected bool CrossToNewRegion() { + bool result = false; + parcelRegionCross(false); try { - return m_scene.CrossAgentToNewRegion(this, Flying); + result = m_scene.CrossAgentToNewRegion(this, Flying); } catch { - return m_scene.CrossAgentToNewRegion(this, false); + result = m_scene.CrossAgentToNewRegion(this, false); } + if(!result) + parcelRegionCross(true); + + return result; + } public void Reset() @@ -5384,7 +5391,7 @@ namespace OpenSim.Region.Framework.Scenes } - private void parcelGodCheck(UUID currentParcelUUID, bool isGod) + private void parcelGodCheck(UUID currentParcelID, bool isGod) { List allpresences = null; @@ -5400,7 +5407,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; - if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID) + if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelID) { viewsToSendme.Add(p); // i see them } @@ -5410,6 +5417,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (ScenePresence p in viewsToSendme) { + m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); ControllingClient.SendAvatarDataImmediate(p); p.SendAppearanceToAgent(this); p.SendAttachmentsToClient(ControllingClient); @@ -5427,16 +5435,17 @@ namespace OpenSim.Region.Framework.Scenes if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; - if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID) + if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelID) { killsToSendme.Add(p); } } - if (killsToSendme.Count > 0 && PresenceType != PresenceType.Npc) + if (killsToSendme.Count > 0) { foreach (ScenePresence p in killsToSendme) { + m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); try { ControllingClient.SendKillObject(new List { p.LocalId }); } catch (NullReferenceException) { } } @@ -5445,7 +5454,7 @@ namespace OpenSim.Region.Framework.Scenes } - private void ParcelLoginCheck(UUID currentParcelUUID) + private void ParcelLoginCheck(UUID currentParcelID) { List killsToSendto = new List(); List killsToSendme = new List(); @@ -5460,7 +5469,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; - if (currentParcelUUID != p.currentParcelUUID) + if (currentParcelID != p.currentParcelUUID) { if (p.GodLevel < 200) killsToSendto.Add(p); @@ -5477,28 +5486,31 @@ namespace OpenSim.Region.Framework.Scenes // send the things // kill main avatar object - if (killsToSendto.Count > 0) + if (killsToSendto.Count > 0 && PresenceType != PresenceType.Npc) { foreach (ScenePresence p in killsToSendto) { + m_log.Debug("[AVATAR]: killTo: " + Lastname + " " + p.Lastname); try { p.ControllingClient.SendKillObject(new List { LocalId }); } catch (NullReferenceException) { } } } - if (killsToSendme.Count > 0 && PresenceType != PresenceType.Npc) + if (killsToSendme.Count > 0) { foreach (ScenePresence p in killsToSendme) { + m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); try { ControllingClient.SendKillObject(new List { p.LocalId }); } catch (NullReferenceException) { } } } - if (viewsToSendto.Count > 0) + if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) { foreach (ScenePresence p in viewsToSendto) { + m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname); p.ControllingClient.SendAvatarDataImmediate(this); SendAppearanceToAgent(p); SendAttachmentsToClient(p.ControllingClient); @@ -5507,10 +5519,11 @@ namespace OpenSim.Region.Framework.Scenes } } - if (viewsToSendme.Count > 0 && PresenceType != PresenceType.Npc) + if (viewsToSendme.Count > 0) { foreach (ScenePresence p in viewsToSendme) { + m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); ControllingClient.SendAvatarDataImmediate(p); p.SendAppearanceToAgent(this); p.SendAttachmentsToClient(ControllingClient); @@ -5520,7 +5533,74 @@ namespace OpenSim.Region.Framework.Scenes } } - private void ParcelCrossCheck(UUID currentParcelUUID,UUID previusParcelUUID, + private void parcelRegionCross(bool abort) + { + if (!ParcelHideThisAvatar) + return; + + List allpresences = null; + allpresences = m_scene.GetScenePresences(); + + if (abort) + { + + List viewsToSendme = new List(); + + foreach (ScenePresence p in allpresences) + { + if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) + continue; + + if (p.currentParcelUUID == m_currentParcelUUID) + { + viewsToSendme.Add(p); + } + } + + if (viewsToSendme.Count > 0) + { + foreach (ScenePresence p in viewsToSendme) + { + m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); + ControllingClient.SendAvatarDataImmediate(p); + p.SendAppearanceToAgent(this); + p.SendAttachmentsToClient(ControllingClient); + if (p.Animator != null) + p.Animator.SendAnimPackToClient(ControllingClient); + } + } + } + else + { + if (GodLevel >= 200) + return; + + 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) + { + killsToSendme.Add(p); + } + } + + if (killsToSendme.Count > 0) + { + foreach (ScenePresence p in killsToSendme) + { + m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); + try { ControllingClient.SendKillObject(new List { p.LocalId }); } + catch (NullReferenceException) { } + } + } + } + } + + + private void ParcelCrossCheck(UUID currentParcelID,UUID previusParcelID, bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check) { List killsToSendto = new List(); @@ -5548,8 +5628,9 @@ namespace OpenSim.Region.Framework.Scenes continue; // those on not on parcel see me - if (currentParcelUUID != p.currentParcelUUID) + if (currentParcelID != p.currentParcelUUID) { + m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname); viewsToSendto.Add(p); // they see me } } @@ -5563,7 +5644,7 @@ namespace OpenSim.Region.Framework.Scenes continue; // those not on parcel dont see me - if (currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) + if (currentParcelID != p.currentParcelUUID && p.GodLevel < 200) { killsToSendto.Add(p); // they dont see me } @@ -5579,7 +5660,7 @@ namespace OpenSim.Region.Framework.Scenes // now on a private parcel allpresences = m_scene.GetScenePresences(); - if (previusParcelHide && previusParcelUUID != UUID.Zero) + if (previusParcelHide && previusParcelID != UUID.Zero) { foreach (ScenePresence p in allpresences) { @@ -5587,7 +5668,7 @@ namespace OpenSim.Region.Framework.Scenes continue; // only those on previus parcel need receive kills - if (previusParcelUUID == p.currentParcelUUID) + if (previusParcelID == p.currentParcelUUID) { if(p.GodLevel < 200) killsToSendto.Add(p); // they dont see me @@ -5595,7 +5676,7 @@ namespace OpenSim.Region.Framework.Scenes killsToSendme.Add(p); // i dont see them } // only those on new parcel need see - if (currentParcelUUID == p.currentParcelUUID) + if (currentParcelID == p.currentParcelUUID) { viewsToSendto.Add(p); // they see me viewsToSendme.Add(p); // i see them @@ -5613,7 +5694,7 @@ namespace OpenSim.Region.Framework.Scenes continue; // those not on new parcel dont see me - if (currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) + if (currentParcelID != p.currentParcelUUID && p.GodLevel < 200) { killsToSendto.Add(p); // they dont see me } @@ -5629,7 +5710,7 @@ namespace OpenSim.Region.Framework.Scenes else { // now on public parcel - if (previusParcelHide && previusParcelUUID != UUID.Zero) + if (previusParcelHide && previusParcelID != UUID.Zero) { // was on private area allpresences = m_scene.GetScenePresences(); @@ -5639,7 +5720,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; // only those old parcel need receive kills - if (previusParcelUUID == p.currentParcelUUID && GodLevel < 200) + if (previusParcelID == p.currentParcelUUID && GodLevel < 200) { killsToSendme.Add(p); // i dont see them } @@ -5656,28 +5737,31 @@ namespace OpenSim.Region.Framework.Scenes // send the things // kill main avatar object - if (killsToSendto.Count > 0) + if (killsToSendto.Count > 0 && PresenceType != PresenceType.Npc) { foreach (ScenePresence p in killsToSendto) { + m_log.Debug("[AVATAR]: killTo: " + Lastname + " " + p.Lastname); try { p.ControllingClient.SendKillObject(new List { LocalId }); } catch (NullReferenceException) { } } } - if (killsToSendme.Count > 0 && PresenceType != PresenceType.Npc) + if (killsToSendme.Count > 0 ) { foreach (ScenePresence p in killsToSendme) { + m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); try {ControllingClient.SendKillObject(new List { p.LocalId }); } catch (NullReferenceException) { } } } - if (viewsToSendto.Count > 0) + if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) { foreach (ScenePresence p in viewsToSendto) { + m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname); p.ControllingClient.SendAvatarDataImmediate(this); SendAppearanceToAgent(p); SendAttachmentsToClient(p.ControllingClient); @@ -5686,10 +5770,11 @@ namespace OpenSim.Region.Framework.Scenes } } - if (viewsToSendme.Count > 0 && PresenceType != PresenceType.Npc) + if (viewsToSendme.Count > 0 ) { foreach (ScenePresence p in viewsToSendme) { + m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); ControllingClient.SendAvatarDataImmediate(p); p.SendAppearanceToAgent(this); p.SendAttachmentsToClient(ControllingClient); From ed4787419774d20110f10eff918f5a304819cb09 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 18:22:00 +0100 Subject: [PATCH 10/19] several debug msgs, need to be removed asap --- OpenSim/Region/Framework/Scenes/EventManager.cs | 5 +++++ OpenSim/Region/Framework/Scenes/Scene.cs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 7f06e82b34..182c3fd497 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -1366,7 +1366,9 @@ namespace OpenSim.Region.Framework.Scenes { try { + m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate: {0}",d.Target.ToString()); d(agentId); + m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate done "); } catch (Exception e) { @@ -2037,7 +2039,10 @@ namespace OpenSim.Region.Framework.Scenes { try { + m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed: {0}", d.Target.ToString()); d(ClientID, scene); + m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed done "); + } catch (Exception e) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0765b3f9f1..c53f7af084 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3640,13 +3640,17 @@ namespace OpenSim.Region.Framework.Scenes } m_eventManager.TriggerClientClosed(agentID, this); + m_log.Debug("[Scene]TriggerClientClosed done"); m_eventManager.TriggerOnRemovePresence(agentID); + m_log.Debug("[Scene]TriggerOnRemovePresence done"); if (!isChildAgent) { if (AttachmentsModule != null) { + m_log.Debug("[Scene]DeRezAttachments"); AttachmentsModule.DeRezAttachments(avatar); + m_log.Debug("[Scene]DeRezAttachments done"); } ForEachClient( @@ -3660,7 +3664,10 @@ namespace OpenSim.Region.Framework.Scenes // It's possible for child agents to have transactions if changes are being made cross-border. if (AgentTransactionsModule != null) + { + m_log.Debug("[Scene]RemoveAgentAssetTransactions"); AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); + } m_log.Debug("[Scene] The avatar has left the building"); } catch (Exception e) From ca8b0e6a1d373b55137febaafd2797e59016d5a8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 19:00:01 +0100 Subject: [PATCH 11/19] replace debug msgs by others --- .../Avatar/Attachments/AttachmentsModule.cs | 13 ++++++++++++- OpenSim/Region/Framework/Scenes/EventManager.cs | 8 ++++---- OpenSim/Region/Framework/Scenes/Scene.cs | 10 +++++----- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 0825a01638..c8a25dd2c9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -388,6 +388,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments Dictionary scriptStates = new Dictionary(); + m_log.DebugFormat("[ATTACHMENTS MODULE]: enter PrepareScriptInstanceForSave loop"); foreach (SceneObjectGroup so in attachments) { // Scripts MUST be snapshotted before the object is @@ -398,13 +399,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments scriptStates[so] = PrepareScriptInstanceForSave(so, false); } + m_log.DebugFormat("[ATTACHMENTS MODULE]: enter UpdateDetachedObject loop"); lock (sp.AttachmentsSyncLock) { foreach (SceneObjectGroup so in attachments) UpdateDetachedObject(sp, so, scriptStates[so]); - + m_log.DebugFormat("[ATTACHMENTS MODULE]: enter ClearAttachments"); sp.ClearAttachments(); } + m_log.DebugFormat("[ATTACHMENTS MODULE]: derez done"); + } public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) @@ -1014,6 +1018,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Remove the object from the scene so no more updates // are sent. Doing this before the below changes will ensure // updates can't cause "HUD artefacts" + + m_log.WarnFormat("[ATTACHMENTS MODULE]: DeleteSceneObject"); + m_scene.DeleteSceneObject(so, false, false); // Prepare sog for storage @@ -1023,6 +1030,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (saveChanged) { + m_log.WarnFormat("[ATTACHMENTS MODULE]: saveChanged true"); + // We cannot use AbsolutePosition here because that would // attempt to cross the prim as it is detached so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); @@ -1031,7 +1040,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } // Now, remove the scripts + m_log.WarnFormat("[ATTACHMENTS MODULE]: remove scripts"); so.RemoveScriptInstances(true); + m_log.WarnFormat("[ATTACHMENTS MODULE]: UpdateDetachedObject done"); } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 182c3fd497..692e0c9ced 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -1366,9 +1366,9 @@ namespace OpenSim.Region.Framework.Scenes { try { - m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate: {0}",d.Target.ToString()); +// m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate: {0}",d.Target.ToString()); d(agentId); - m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate done "); +// m_log.ErrorFormat("[EVENT MANAGER]: OnRemovePresenceDelegate done "); } catch (Exception e) { @@ -2039,9 +2039,9 @@ namespace OpenSim.Region.Framework.Scenes { try { - m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed: {0}", d.Target.ToString()); +// m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed: {0}", d.Target.ToString()); d(ClientID, scene); - m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed done "); +// m_log.ErrorFormat("[EVENT MANAGER]: TriggerClientClosed done "); } catch (Exception e) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c53f7af084..0266faf821 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3640,17 +3640,17 @@ namespace OpenSim.Region.Framework.Scenes } m_eventManager.TriggerClientClosed(agentID, this); - m_log.Debug("[Scene]TriggerClientClosed done"); +// m_log.Debug("[Scene]TriggerClientClosed done"); m_eventManager.TriggerOnRemovePresence(agentID); - m_log.Debug("[Scene]TriggerOnRemovePresence done"); +// m_log.Debug("[Scene]TriggerOnRemovePresence done"); if (!isChildAgent) { if (AttachmentsModule != null) { - m_log.Debug("[Scene]DeRezAttachments"); +// m_log.Debug("[Scene]DeRezAttachments"); AttachmentsModule.DeRezAttachments(avatar); - m_log.Debug("[Scene]DeRezAttachments done"); +// m_log.Debug("[Scene]DeRezAttachments done"); } ForEachClient( @@ -3665,7 +3665,7 @@ namespace OpenSim.Region.Framework.Scenes // It's possible for child agents to have transactions if changes are being made cross-border. if (AgentTransactionsModule != null) { - m_log.Debug("[Scene]RemoveAgentAssetTransactions"); +// m_log.Debug("[Scene]RemoveAgentAssetTransactions"); AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); } m_log.Debug("[Scene] The avatar has left the building"); From c2d9a6499ac2655e6d43f528b839d81e14fdb64f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 19:08:13 +0100 Subject: [PATCH 12/19] dont get script states for NPCs on deRez --- .../Avatar/Attachments/AttachmentsModule.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index c8a25dd2c9..9e6ed913c7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -388,15 +388,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments Dictionary scriptStates = new Dictionary(); - m_log.DebugFormat("[ATTACHMENTS MODULE]: enter PrepareScriptInstanceForSave loop"); - foreach (SceneObjectGroup so in attachments) + if (sp.PresenceType != PresenceType.Npc) { - // Scripts MUST be snapshotted before the object is - // removed from the scene because doing otherwise will - // clobber the run flag - // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from - // scripts performing attachment operations at the same time. Getting object states stops the scripts. - scriptStates[so] = PrepareScriptInstanceForSave(so, false); + m_log.DebugFormat("[ATTACHMENTS MODULE]: enter PrepareScriptInstanceForSave loop"); + foreach (SceneObjectGroup so in attachments) + { + // Scripts MUST be snapshotted before the object is + // removed from the scene because doing otherwise will + // clobber the run flag + // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from + // scripts performing attachment operations at the same time. Getting object states stops the scripts. + scriptStates[so] = PrepareScriptInstanceForSave(so, false); + } } m_log.DebugFormat("[ATTACHMENTS MODULE]: enter UpdateDetachedObject loop"); From 6b3f10790eb72a6c0fa3e5d088d681d28fc835dd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 19:35:16 +0100 Subject: [PATCH 13/19] bugg --- .../Avatar/Attachments/AttachmentsModule.cs | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 9e6ed913c7..5bc6631199 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -390,7 +390,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (sp.PresenceType != PresenceType.Npc) { - m_log.DebugFormat("[ATTACHMENTS MODULE]: enter PrepareScriptInstanceForSave loop"); foreach (SceneObjectGroup so in attachments) { // Scripts MUST be snapshotted before the object is @@ -400,18 +399,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // scripts performing attachment operations at the same time. Getting object states stops the scripts. scriptStates[so] = PrepareScriptInstanceForSave(so, false); } - } - m_log.DebugFormat("[ATTACHMENTS MODULE]: enter UpdateDetachedObject loop"); - lock (sp.AttachmentsSyncLock) + lock (sp.AttachmentsSyncLock) + { + foreach (SceneObjectGroup so in attachments) + UpdateDetachedObject(sp, so, scriptStates[so]); + sp.ClearAttachments(); + } + } + else { - foreach (SceneObjectGroup so in attachments) - UpdateDetachedObject(sp, so, scriptStates[so]); - m_log.DebugFormat("[ATTACHMENTS MODULE]: enter ClearAttachments"); - sp.ClearAttachments(); - } - m_log.DebugFormat("[ATTACHMENTS MODULE]: derez done"); - + lock (sp.AttachmentsSyncLock) + { + foreach (SceneObjectGroup so in attachments) + UpdateDetachedObject(sp, so, String.Empty); + sp.ClearAttachments(); + } + } } public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) From 21aa325883caac80749dec417411ab678e8f9646 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 19:41:48 +0100 Subject: [PATCH 14/19] remove debug msgs at attachments deRez --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 5bc6631199..2c7cd40c01 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -1025,9 +1025,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Remove the object from the scene so no more updates // are sent. Doing this before the below changes will ensure // updates can't cause "HUD artefacts" - - m_log.WarnFormat("[ATTACHMENTS MODULE]: DeleteSceneObject"); - + m_scene.DeleteSceneObject(so, false, false); // Prepare sog for storage @@ -1037,8 +1035,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (saveChanged) { - m_log.WarnFormat("[ATTACHMENTS MODULE]: saveChanged true"); - // We cannot use AbsolutePosition here because that would // attempt to cross the prim as it is detached so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); @@ -1047,9 +1043,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } // Now, remove the scripts - m_log.WarnFormat("[ATTACHMENTS MODULE]: remove scripts"); so.RemoveScriptInstances(true); - m_log.WarnFormat("[ATTACHMENTS MODULE]: UpdateDetachedObject done"); } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( From 0d71a2bb8fe90bfaaae4e62d921dbf94e69064b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 22:38:50 +0100 Subject: [PATCH 15/19] mess update ( hide avatars ) --- .../World/Land/LandManagementModule.cs | 20 ++++--- .../Region/Framework/Scenes/ScenePresence.cs | 60 +++++++++++-------- 2 files changed, 47 insertions(+), 33 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index d8e3082c44..c8555abcc3 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -368,7 +368,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void SendOutNearestBanLine(IClientAPI client) { ScenePresence sp = m_scene.GetScenePresence(client.AgentId); - if (sp == null || sp.IsChildAgent) + if (sp == null) return; List checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition); @@ -394,11 +394,12 @@ namespace OpenSim.Region.CoreModules.World.Land if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out avatar)) return; - if (avatar.IsChildAgent) - return; SendParcelOverlay(remoteClient); + if (avatar.IsChildAgent) + return; + ILandObject over = GetLandObject(avatar.AbsolutePosition.X,avatar.AbsolutePosition.Y); if (over == null) return; @@ -958,7 +959,7 @@ namespace OpenSim.Region.CoreModules.World.Land UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); m_scene.ForEachClient(SendParcelOverlay); result.SendLandUpdateToAvatarsOverMe(); - + startLandObject.SendLandUpdateToAvatarsOverMe(); } /// @@ -1047,7 +1048,6 @@ namespace OpenSim.Region.CoreModules.World.Land /// The object representing the client public void SendParcelOverlay(IClientAPI remote_client) { - if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) return; @@ -1198,20 +1198,24 @@ namespace OpenSim.Region.CoreModules.World.Land bool needOverlay = false; if (land.UpdateLandProperties(args, remote_client, out snap_selection, out needOverlay)) { - //the proprieties to who changed it + //the proprieties to who changed them land.SendLandProperties(0, true, LandChannel.LAND_RESULT_SINGLE, remote_client); if (needOverlay) { UUID parcelID = land.LandData.GlobalID; - m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar) + m_scene.ForEachScenePresence(delegate(ScenePresence avatar) { - if (avatar.IsDeleted || avatar.IsChildAgent) + if (avatar.IsDeleted || avatar.isNPC) return; IClientAPI client = avatar.ControllingClient; SendParcelOverlay(client); + + if (avatar.IsChildAgent) + return; + ILandObject aland = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); if (aland != null) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7b0b1033d2..03eac77182 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -178,7 +178,7 @@ namespace OpenSim.Region.Framework.Scenes if (land != null && !land.LandData.SeeAVs) m_currentParcelHide = true; - if (m_previusParcelUUID != UUID.Zero) + if (m_previusParcelUUID != UUID.Zero || checksame) ParcelCrossCheck(m_currentParcelUUID,m_previusParcelUUID,m_currentParcelHide, m_previusParcelHide, oldhide,checksame); } } @@ -1847,7 +1847,6 @@ namespace OpenSim.Region.Framework.Scenes } } - // send agentData to all clients including us (?) // get appearance // if in cache sent it to all clients @@ -1857,7 +1856,7 @@ namespace OpenSim.Region.Framework.Scenes // attachments if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) { -// if (Scene.AttachmentsModule != null) + if (Scene.AttachmentsModule != null) // Util.FireAndForget( // o => // { @@ -5418,11 +5417,14 @@ namespace OpenSim.Region.Framework.Scenes foreach (ScenePresence p in viewsToSendme) { m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); - ControllingClient.SendAvatarDataImmediate(p); - p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); + if (!p.IsChildAgent) + { + ControllingClient.SendAvatarDataImmediate(p); + p.SendAppearanceToAgent(this); + p.SendAttachmentsToClient(ControllingClient); + if (p.Animator != null) + p.Animator.SendAnimPackToClient(ControllingClient); + } } } } @@ -5524,11 +5526,14 @@ namespace OpenSim.Region.Framework.Scenes foreach (ScenePresence p in viewsToSendme) { m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); - ControllingClient.SendAvatarDataImmediate(p); - p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); + if (!p.IsChildAgent) + { + ControllingClient.SendAvatarDataImmediate(p); + p.SendAppearanceToAgent(this); + p.SendAttachmentsToClient(ControllingClient); + if (p.Animator != null) + p.Animator.SendAnimPackToClient(ControllingClient); + } } } } @@ -5562,11 +5567,14 @@ namespace OpenSim.Region.Framework.Scenes foreach (ScenePresence p in viewsToSendme) { m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); - ControllingClient.SendAvatarDataImmediate(p); - p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); + if (!p.IsChildAgent) + { + ControllingClient.SendAvatarDataImmediate(p); + p.SendAppearanceToAgent(this); + p.SendAttachmentsToClient(ControllingClient); + if (p.Animator != null) + p.Animator.SendAnimPackToClient(ControllingClient); + } } } } @@ -5629,8 +5637,7 @@ namespace OpenSim.Region.Framework.Scenes // those on not on parcel see me if (currentParcelID != p.currentParcelUUID) - { - m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname); + { viewsToSendto.Add(p); // they see me } } @@ -5775,11 +5782,14 @@ namespace OpenSim.Region.Framework.Scenes foreach (ScenePresence p in viewsToSendme) { m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); - ControllingClient.SendAvatarDataImmediate(p); - p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); + if (!p.IsChildAgent) + { + ControllingClient.SendAvatarDataImmediate(p); + p.SendAppearanceToAgent(this); + p.SendAttachmentsToClient(ControllingClient); + if (p.Animator != null) + p.Animator.SendAnimPackToClient(ControllingClient); + } } } } From bad01fbb418e8df5caa2735bf62ec41f8b378f10 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 22:57:08 +0100 Subject: [PATCH 16/19] some mess cleanup --- .../Region/Framework/Scenes/ScenePresence.cs | 75 +++++++++---------- 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 03eac77182..8d254f288d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1836,12 +1836,12 @@ namespace OpenSim.Region.Framework.Scenes m_currentParcelUUID = UUID.Zero; // send initial land overlay and parcel - if (!IsChildAgent) + ILandChannel landch = m_scene.LandChannel; + if (landch != null) { - ILandChannel landch = m_scene.LandChannel; - if (landch != null) + landch.sendClientInitialLandInfo(client); + if (!IsChildAgent) { - landch.sendClientInitialLandInfo(client); newhide = m_currentParcelHide; m_currentParcelHide = false; } @@ -5416,15 +5416,14 @@ namespace OpenSim.Region.Framework.Scenes { foreach (ScenePresence p in viewsToSendme) { + if (p.IsChildAgent) + continue; m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); - if (!p.IsChildAgent) - { - ControllingClient.SendAvatarDataImmediate(p); - p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); - } + ControllingClient.SendAvatarDataImmediate(p); + p.SendAppearanceToAgent(this); + p.SendAttachmentsToClient(ControllingClient); + if (p.Animator != null) + p.Animator.SendAnimPackToClient(ControllingClient); } } } @@ -5526,14 +5525,13 @@ namespace OpenSim.Region.Framework.Scenes foreach (ScenePresence p in viewsToSendme) { m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); - if (!p.IsChildAgent) - { - ControllingClient.SendAvatarDataImmediate(p); - p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); - } + if (p.IsChildAgent) + continue; + ControllingClient.SendAvatarDataImmediate(p); + p.SendAppearanceToAgent(this); + p.SendAttachmentsToClient(ControllingClient); + if (p.Animator != null) + p.Animator.SendAnimPackToClient(ControllingClient); } } } @@ -5548,7 +5546,6 @@ namespace OpenSim.Region.Framework.Scenes if (abort) { - List viewsToSendme = new List(); foreach (ScenePresence p in allpresences) @@ -5566,15 +5563,14 @@ namespace OpenSim.Region.Framework.Scenes { foreach (ScenePresence p in viewsToSendme) { - m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); - if (!p.IsChildAgent) - { - ControllingClient.SendAvatarDataImmediate(p); - p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); - } + if (p.IsChildAgent) + continue; +// m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); + ControllingClient.SendAvatarDataImmediate(p); + p.SendAppearanceToAgent(this); + p.SendAttachmentsToClient(ControllingClient); + if (p.Animator != null) + p.Animator.SendAnimPackToClient(ControllingClient); } } } @@ -5768,8 +5764,8 @@ namespace OpenSim.Region.Framework.Scenes { foreach (ScenePresence p in viewsToSendto) { - m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname); p.ControllingClient.SendAvatarDataImmediate(this); +// m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname); SendAppearanceToAgent(p); SendAttachmentsToClient(p.ControllingClient); if (Animator != null) @@ -5781,15 +5777,14 @@ namespace OpenSim.Region.Framework.Scenes { foreach (ScenePresence p in viewsToSendme) { - m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); - if (!p.IsChildAgent) - { - ControllingClient.SendAvatarDataImmediate(p); - p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); - } + if (p.IsChildAgent) + continue; +// m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); + ControllingClient.SendAvatarDataImmediate(p); + p.SendAppearanceToAgent(this); + p.SendAttachmentsToClient(ControllingClient); + if (p.Animator != null) + p.Animator.SendAnimPackToClient(ControllingClient); } } } From 14250c776adb62ced75b18fefa9e43bca3f045bb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Aug 2014 23:44:51 +0100 Subject: [PATCH 17/19] missing currentParcelUUID update --- OpenSim/Region/CoreModules/World/Land/LandObject.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 29c22348d8..e002febd31 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -617,6 +617,7 @@ namespace OpenSim.Region.CoreModules.World.Land avatar.Invulnerable = true; SendLandUpdateToClient(snap_selection, avatar.ControllingClient); + avatar.currentParcelUUID = LandData.GlobalID; } } }); From b07b0ff555ee0d930e350ba56bcb389543d22e06 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 4 Aug 2014 00:16:56 +0100 Subject: [PATCH 18/19] missing child login parcel overlay --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8d254f288d..24a92eb468 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3465,6 +3465,14 @@ namespace OpenSim.Region.Framework.Scenes // we created a new ScenePresence (a new child agent) in a fresh region. // Request info about all the (root) agents in this region // Note: This won't send data *to* other clients in that region (children don't send) + if (m_teleportFlags <= 0) + { + ILandChannel landch = m_scene.LandChannel; + if (landch != null) + { + landch.sendClientInitialLandInfo(ControllingClient); + } + } SendOtherAgentsAvatarDataToMe(); SendOtherAgentsAppearanceToMe(); From 8cf945544cd993b68329d00832f7c9b74570af28 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 4 Aug 2014 00:43:57 +0100 Subject: [PATCH 19/19] local chat gods bug fix --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 71ceb656a1..dcfc630c5d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -236,7 +236,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat fromName = avatar.Name; fromID = c.Sender.AgentId; if (avatar.GodLevel >= 200) - { + { // let gods speak to outside or things may get confusing fromNamePrefix = m_adminPrefix; checkParcelHide = false; } @@ -310,7 +310,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat // objects on a parcel with access restrictions if (checkParcelHide) { - if (sourceParcelID != Presencecheck.LandData.GlobalID) + if (sourceParcelID != Presencecheck.LandData.GlobalID && presence.GodLevel < 200) return; } if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true)