From 114144407bd72cb9ccbdf6981d8fec86cbba6a24 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Aug 2014 09:32:36 +0100 Subject: variations.. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 243 +++++------------------ 1 file changed, 48 insertions(+), 195 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9e9a83f..333eb9b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1920,7 +1920,6 @@ namespace OpenSim.Region.Framework.Scenes SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path }); } - sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); sog.ResumeScripts(); } @@ -3542,14 +3541,12 @@ namespace OpenSim.Region.Framework.Scenes } SendOtherAgentsAvatarFullToMe(); - EntityBase[] entities = Scene.Entities.GetEntities(); foreach (EntityBase e in entities) { if (e != null && e is SceneObjectGroup) ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); } - }); } @@ -4754,32 +4751,6 @@ namespace OpenSim.Region.Framework.Scenes } } - // send attachments to a client without filters except for huds - // for now they are checked in several places down the line... - // kills all parts before sending - public void SendAttachmentsToAgentNFPK(ScenePresence p) - { - lock (m_attachments) - { - List pk = new List(); - foreach (SceneObjectGroup sog in m_attachments) - { - foreach (SceneObjectPart part in sog.Parts) - pk.Add(part.LocalId); - } - - p.ControllingClient.SendKillObject(pk); - - foreach (SceneObjectGroup sog in m_attachments) - { - if (p == this || !sog.HasPrivateAttachmentPoint) - sog.SendFullUpdateToClient(p.ControllingClient); - } - SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path - } - } - - public void SendAttachmentScheduleUpdate(SceneObjectGroup sog) { if (IsChildAgent) @@ -4796,9 +4767,27 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart[] parts = sog.Parts; + SendFullUpdateToClient(p.ControllingClient); + + SceneObjectPart rootpart = sog.RootPart; + if (rootpart.UpdateFlag == UpdateRequired.TERSE) + { + p.ControllingClient.SendEntityUpdate(rootpart, + PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity + | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); + rootpart.UpdateFlag = 0; + } + else if (rootpart.UpdateFlag == UpdateRequired.FULL) + { + p.ControllingClient.SendEntityUpdate(rootpart, PrimUpdateFlags.FullUpdate); + rootpart.UpdateFlag = 0; + } + for (int i = 0; i < parts.Length; i++) { SceneObjectPart part = parts[i]; + if (part == rootpart) + continue; if (part.UpdateFlag == UpdateRequired.TERSE) { p.ControllingClient.SendEntityUpdate(part, @@ -5655,183 +5644,56 @@ namespace OpenSim.Region.Framework.Scenes private void parcelGodCheck(UUID currentParcelID, bool isGod) { - List allpresences = null; - + List allpresences = m_scene.GetScenePresences(); - 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 != currentParcelID) - { - viewsToSendme.Add(p); // i see them - } - } - - if (viewsToSendme.Count > 0) - { - foreach (ScenePresence p in viewsToSendme) - { - if (p.IsChildAgent) - continue; - - p.SendAvatarDataToAgentNF(this); - p.SendAppearanceToAgent(this); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); - p.SendAttachmentsToAgentNF(this); - } - } - } - else + foreach (ScenePresence p in allpresences) { - 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 != currentParcelID) - { - killsToSendme.Add(p); - } - } + if (p.IsDeleted || p.IsChildAgent || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) + continue; - if (killsToSendme.Count > 0) + if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelID) { - foreach (ScenePresence p in killsToSendme) - { - m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); - try { ControllingClient.SendKillObject(new List { p.LocalId }); } - catch (NullReferenceException) { } - } + if (isGod) + p.SendViewTo(this); + else + p.SendKillTo(this); } } - } private void ParcelLoginCheck(UUID currentParcelID) { - List killsToSendto = new List(); - List killsToSendme = new List(); - List viewsToSendto = new List(); - List viewsToSendme = new List(); - List allpresences = null; - - allpresences = m_scene.GetScenePresences(); + List allpresences = m_scene.GetScenePresences(); foreach (ScenePresence p in allpresences) { if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; - if (currentParcelID != p.currentParcelUUID) - { - if (p.GodLevel < 200) - killsToSendto.Add(p); -// if (GodLevel < 200 && p.ParcelHideThisAvatar) -// killsToSendme.Add(p.LocalId); - } - else + if (currentParcelID != p.currentParcelUUID && p.GodLevel < 200) { - viewsToSendto.Add(p); - viewsToSendme.Add(p); - } - } - allpresences.Clear(); - - // send the things - // kill main avatar object - if (killsToSendto.Count > 0 && PresenceType != PresenceType.Npc) - { - foreach (ScenePresence p in killsToSendto) - { - m_log.Debug("[AVATAR]: killTo: " + Lastname + " " + p.Lastname); SendKillTo(p); -// try { p.ControllingClient.SendKillObject(new List { LocalId }); } -// catch (NullReferenceException) { } - } - } - - if (killsToSendme.Count > 0) - { - m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + killsToSendme.Count.ToString()); - foreach (ScenePresence p in killsToSendme) - { - SendKillTo(this); - } - - } -/* - 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); - if (Animator != null) - Animator.SendAnimPackToClient(p.ControllingClient); - } - } - - if (viewsToSendme.Count > 0) - { - foreach (ScenePresence p in viewsToSendme) - { - m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); - if (p.IsChildAgent) - continue; - ControllingClient.SendAvatarDataImmediate(p); - p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); } } -*/ } - public void parcelRegionCross() { - if (!ParcelHideThisAvatar || GodLevel >= 200) + if (!ParcelHideThisAvatar || IsChildAgent || GodLevel >= 200) return; List allpresences = null; allpresences = m_scene.GetScenePresences(); - List killsToSendme = new List(); - foreach (ScenePresence p in allpresences) { - if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) + if (p.IsDeleted || p == this || p.IsChildAgent || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; if (p.currentParcelUUID == m_currentParcelUUID) { - killsToSendme.Add(p); - } - } - - if (killsToSendme.Count > 0) - { - foreach (ScenePresence p in killsToSendme) p.SendKillTo(this); -// try -// { -// ControllingClient.SendKillObject(killsToSendme); -// } -// catch (NullReferenceException) { } + } } } @@ -5844,10 +5706,7 @@ namespace OpenSim.Region.Framework.Scenes List viewsToSendme = new List(); List allpresences = null; - if (IsInTransit) - return; - - if (IsChildAgent) + if (IsInTransit || IsChildAgent) return; if (check) @@ -5973,17 +5832,13 @@ namespace OpenSim.Region.Framework.Scenes } // send the things - // kill main avatar object - if (killsToSendto.Count > 0 && PresenceType != PresenceType.Npc) + + if (killsToSendto.Count > 0) { foreach (ScenePresence p in killsToSendto) { - m_log.Debug("[AVATAR]: killTo: " + Lastname + " " + p.Lastname); - SendKillTo(p); -// try { p.ControllingClient.SendKillObject(new List { LocalId }); } -// catch (NullReferenceException) { } } } @@ -5992,23 +5847,17 @@ namespace OpenSim.Region.Framework.Scenes m_log.Debug("[AVATAR]: killtoMe: " + Lastname + " " + killsToSendme.Count.ToString()); foreach (ScenePresence p in killsToSendme) - try { + m_log.Debug("[AVATAR]: killToMe: " + Lastname + " " + p.Lastname); p.SendKillTo(this); } - catch (NullReferenceException) { } - } - if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) + if (viewsToSendto.Count > 0) { foreach (ScenePresence p in viewsToSendto) { - SendAvatarDataToAgentNF(p); - SendAppearanceToAgent(p); - if (Animator != null) - Animator.SendAnimPackToClient(p.ControllingClient); - SendAttachmentsToAgentNF(p); + SendViewTo(p); } } @@ -6019,12 +5868,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.IsChildAgent) continue; // m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); - - p.SendAvatarDataToAgentNF(this); - p.SendAppearanceToAgent(this); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); - p.SendAttachmentsToAgentNF(this); + p.SendViewTo(this); } } } @@ -6035,5 +5879,14 @@ namespace OpenSim.Region.Framework.Scenes p.ControllingClient.SendPartFullUpdate(sog.RootPart, LocalId + 1); p.ControllingClient.SendKillObject(new List { LocalId }); } + + public void SendViewTo(ScenePresence p) + { + SendAvatarDataToAgentNF(p); + SendAppearanceToAgent(p); + if (Animator != null) + Animator.SendAnimPackToClient(p.ControllingClient); + SendAttachmentsToAgentNF(p); + } } } -- cgit v1.1