From 620443f85840aab0f2ddc4a88656a166cc148b69 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Aug 2014 00:37:05 +0100 Subject: [PATCH] on TPs to nearby regions, only send kills if needed by parcel privacy --- .../EntityTransfer/EntityTransferModule.cs | 12 ++++-- .../Region/Framework/Scenes/ScenePresence.cs | 40 ++++++++++++++----- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 37aae0893a..b3e556f7f2 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -986,7 +986,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Well, this is it. The agent is over there. // KillEntity(sp.Scene, sp.LocalId); - sp.HasMovedAway(); + bool nearRegion = sp.KnownRegions.ContainsKey(destinationHandle); + sp.HasMovedAway(nearRegion); // Now let's make it officially a child agent sp.MakeChildAgent(); @@ -1141,7 +1142,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); - sp.HasMovedAway(); + bool nearRegion = sp.KnownRegions.ContainsKey(destinationHandle); + sp.HasMovedAway(nearRegion); // Need to signal neighbours whether child agents may need closing irrespective of whether this // one needed closing. We also need to close child agents as quickly as possible to avoid complicated @@ -1784,9 +1786,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); // this may need the attachments - agent.parcelRegionCross(); - AgentHasMovedAway(agent, true); + agent.HasMovedAway(true); +// agent.parcelRegionCross(); + +// AgentHasMovedAway(agent, true); agent.MakeChildAgent(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2b1b342933..d7656e8bfa 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5962,18 +5962,38 @@ namespace OpenSim.Region.Framework.Scenes } } - public void HasMovedAway() + public void HasMovedAway(bool nearRegion) { - List allpresences = m_scene.GetScenePresences(); - foreach (ScenePresence p in allpresences) - { - if (p == this) - continue; - SendKillTo(p); - if (!p.IsChildAgent) - p.SendKillTo(this); - } + if (nearRegion) + { + if (!ParcelHideThisAvatar || GodLevel >= 200) + return; + + List allpresences = m_scene.GetScenePresences(); + foreach (ScenePresence p in allpresences) + { + if (p.IsDeleted || p == this || p.IsChildAgent || p.ControllingClient == null || !p.ControllingClient.IsActive) + continue; + + if (p.currentParcelUUID == m_currentParcelUUID) + { + p.SendKillTo(this); + } + } + } + else + { + List allpresences = m_scene.GetScenePresences(); + foreach (ScenePresence p in allpresences) + { + if (p == this) + continue; + SendKillTo(p); + if (!p.IsChildAgent) + p.SendKillTo(this); + } + } if (Scene.AttachmentsModule != null) Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); }