From addca0737c10ee813f89e0417f53b22468d39cd1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 2 Aug 2014 23:38:18 +0100 Subject: testing... --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 87 ++++++++++++++++++------ 1 file changed, 67 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2b7c702..f3b5a54 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 -- cgit v1.1