aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs36
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs592
3 files changed, 425 insertions, 209 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index ecd6a09..668087f 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -557,6 +557,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
557 /// <param name="objectIDs"></param> 557 /// <param name="objectIDs"></param>
558 public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs) 558 public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs)
559 { 559 {
560/*
560 if (m_scenePresence.IsChildAgent) 561 if (m_scenePresence.IsChildAgent)
561 return; 562 return;
562 563
@@ -571,6 +572,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
571 { 572 {
572 client.SendAnimations(animations, seqs, m_scenePresence.ControllingClient.AgentId, objectIDs); 573 client.SendAnimations(animations, seqs, m_scenePresence.ControllingClient.AgentId, objectIDs);
573 }); 574 });
575 */
576 m_scenePresence.SendAnimPack(animations, seqs, objectIDs);
574 } 577 }
575 578
576 public void SendAnimPackToClient(IClientAPI client) 579 public void SendAnimPackToClient(IClientAPI client)
@@ -602,7 +605,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
602 605
603 m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); 606 m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs);
604 607
605 SendAnimPack(animIDs, sequenceNums, objectIDs); 608// SendAnimPack(animIDs, sequenceNums, objectIDs);
609 m_scenePresence.SendAnimPack(animIDs, sequenceNums, objectIDs);
606 } 610 }
607 611
608 public string GetAnimName(UUID animId) 612 public string GetAnimName(UUID animId)
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index ddae073..19d2689 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -91,6 +91,11 @@ namespace OpenSim.Region.Framework.Scenes
91 return 0; 91 return 0;
92 92
93 uint priority; 93 uint priority;
94
95
96 // HACK
97 return GetPriorityByBestAvatarResponsiveness(client, entity);
98
94 99
95 switch (m_scene.UpdatePrioritizationScheme) 100 switch (m_scene.UpdatePrioritizationScheme)
96 { 101 {
@@ -157,30 +162,31 @@ namespace OpenSim.Region.Framework.Scenes
157 162
158 private uint GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) 163 private uint GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity)
159 { 164 {
160 uint pqueue = ComputeDistancePriority(client,entity,false); 165 uint pqueue = 2; // keep compiler happy
161 166
162 ScenePresence presence = m_scene.GetScenePresence(client.AgentId); 167 ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
163 if (presence != null) 168 if (presence != null)
164 { 169 {
165 if (!presence.IsChildAgent) 170 // All avatars other than our own go into pqueue 1
171 if (entity is ScenePresence)
172 return 1;
173
174 if (entity is SceneObjectPart)
166 { 175 {
167 // All avatars other than our own go into pqueue 1 176 // Attachments are high priority,
168 if (entity is ScenePresence) 177 if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
169 return 1; 178 return 1;
170
171 if (entity is SceneObjectPart)
172 {
173 // Attachments are high priority,
174 if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
175 return 1;
176 179
177 // Non physical prims are lower priority than physical prims 180 pqueue = ComputeDistancePriority(client, entity, false);
178 PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; 181
179 if (physActor == null || !physActor.IsPhysical) 182 // Non physical prims are lower priority than physical prims
180 pqueue++; 183 PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
181 } 184 if (physActor == null || !physActor.IsPhysical)
185 pqueue++;
182 } 186 }
183 } 187 }
188 else
189 pqueue = ComputeDistancePriority(client, entity, false);
184 190
185 return pqueue; 191 return pqueue;
186 } 192 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0f67d07..a0c3ba9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1400,7 +1400,7 @@ namespace OpenSim.Region.Framework.Scenes
1400 else 1400 else
1401 Animator.ResetAnimations(); 1401 Animator.ResetAnimations();
1402 1402
1403 1403
1404// m_log.DebugFormat( 1404// m_log.DebugFormat(
1405// "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", 1405// "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}",
1406// Name, UUID, m_scene.RegionInfo.RegionName); 1406// Name, UUID, m_scene.RegionInfo.RegionName);
@@ -1754,7 +1754,7 @@ namespace OpenSim.Region.Framework.Scenes
1754 /// </param> 1754 /// </param>
1755 public void CompleteMovement(IClientAPI client, bool openChildAgents) 1755 public void CompleteMovement(IClientAPI client, bool openChildAgents)
1756 { 1756 {
1757// DateTime startTime = DateTime.Now; 1757 int ts = Util.EnvironmentTickCount();
1758 1758
1759 m_log.InfoFormat( 1759 m_log.InfoFormat(
1760 "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}", 1760 "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
@@ -1767,6 +1767,7 @@ namespace OpenSim.Region.Framework.Scenes
1767 // Make sure it's not a login agent. We don't want to wait for updates during login 1767 // Make sure it's not a login agent. We don't want to wait for updates during login
1768 if (!isNPC && (m_teleportFlags & TeleportFlags.ViaLogin) == 0) 1768 if (!isNPC && (m_teleportFlags & TeleportFlags.ViaLogin) == 0)
1769 { 1769 {
1770
1770 // Let's wait until UpdateAgent (called by departing region) is done 1771 // Let's wait until UpdateAgent (called by departing region) is done
1771 if (!WaitForUpdateAgent(client)) 1772 if (!WaitForUpdateAgent(client))
1772 // The sending region never sent the UpdateAgent data, we have to refuse 1773 // The sending region never sent the UpdateAgent data, we have to refuse
@@ -1786,6 +1787,9 @@ namespace OpenSim.Region.Framework.Scenes
1786 AbsolutePosition = pos; 1787 AbsolutePosition = pos;
1787 } 1788 }
1788*/ 1789*/
1790
1791 m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1792
1789 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1793 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1790 if (!MakeRootAgent(AbsolutePosition, flying)) 1794 if (!MakeRootAgent(AbsolutePosition, flying))
1791 { 1795 {
@@ -1796,6 +1800,8 @@ namespace OpenSim.Region.Framework.Scenes
1796 return; 1800 return;
1797 } 1801 }
1798 1802
1803 m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1804
1799 Vector3 look = Lookat; 1805 Vector3 look = Lookat;
1800 if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01)) 1806 if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01))
1801 { 1807 {
@@ -1806,6 +1812,17 @@ namespace OpenSim.Region.Framework.Scenes
1806 look = new Vector3(0.99f, 0.042f, 0); 1812 look = new Vector3(0.99f, 0.042f, 0);
1807 } 1813 }
1808 1814
1815 if (!IsChildAgent)
1816 {
1817 InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (AssetType)46);
1818 if (cof == null)
1819 COF = UUID.Zero;
1820 else
1821 COF = cof.ID;
1822
1823 m_log.DebugFormat("[ScenePresence]: CompleteMovement COF for {0} is {1}", client.AgentId, COF);
1824 }
1825
1809 // Tell the client that we're totally ready 1826 // Tell the client that we're totally ready
1810 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1827 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1811 1828
@@ -1816,6 +1833,8 @@ namespace OpenSim.Region.Framework.Scenes
1816 1833
1817 // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); 1834 // m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1818 1835
1836 m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1837
1819 if (!string.IsNullOrEmpty(m_callbackURI)) 1838 if (!string.IsNullOrEmpty(m_callbackURI))
1820 { 1839 {
1821 // We cannot sleep here since this would hold up the inbound packet processing thread, as 1840 // We cannot sleep here since this would hold up the inbound packet processing thread, as
@@ -1844,6 +1863,8 @@ namespace OpenSim.Region.Framework.Scenes
1844// client.Name, client.AgentId, m_scene.RegionInfo.RegionName); 1863// client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
1845// } 1864// }
1846 1865
1866 m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1867
1847 m_previusParcelHide = false; 1868 m_previusParcelHide = false;
1848 m_previusParcelUUID = UUID.Zero; 1869 m_previusParcelUUID = UUID.Zero;
1849 m_currentParcelHide = false; 1870 m_currentParcelHide = false;
@@ -1856,15 +1877,12 @@ namespace OpenSim.Region.Framework.Scenes
1856 1877
1857 if (!IsChildAgent) 1878 if (!IsChildAgent)
1858 { 1879 {
1859 newhide = m_currentParcelHide;
1860 m_currentParcelHide = false;
1861 1880
1862 // take this region out of children Neighbours list
1863 // possible should be done elsewhere
1864 DropThisRootRegionFromNeighbours();
1865 1881
1866 ValidateAndSendAppearanceAndAgentData(); 1882 ValidateAndSendAppearanceAndAgentData();
1867 1883
1884 m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1885
1868 // attachments 1886 // attachments
1869 if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) 1887 if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0)
1870 { 1888 {
@@ -1877,23 +1895,46 @@ namespace OpenSim.Region.Framework.Scenes
1877 } 1895 }
1878 else 1896 else
1879 { 1897 {
1880 List<SceneObjectGroup> attachments = GetAttachments(); 1898 if (m_attachments.Count > 0)
1881
1882 if (attachments.Count > 0)
1883 { 1899 {
1884 m_log.DebugFormat( 1900 m_log.DebugFormat(
1885 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); 1901 "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
1886 1902
1903 List<uint> kk = new List<uint>();
1904
1887 // Resume scripts this possible should also be moved down after sending the avatar to viewer ? 1905 // Resume scripts this possible should also be moved down after sending the avatar to viewer ?
1888 foreach (SceneObjectGroup sog in attachments) 1906 foreach (SceneObjectGroup sog in m_attachments)
1889 { 1907 {
1890 sog.ScheduleGroupForFullUpdate(); 1908 foreach (SceneObjectPart part in sog.Parts)
1909 kk.Add(part.LocalId);
1910
1911 sog.SendFullUpdateToClient(ControllingClient);
1912 SendFullUpdateToClient(ControllingClient);
1913
1914 // sog.ScheduleGroupForFullUpdate();
1915 m_scene.ForEachScenePresence(delegate(ScenePresence p)
1916 {
1917 if (p == this)
1918 return;
1919 if (sog.HasPrivateAttachmentPoint)
1920 return;
1921 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
1922 return;
1923
1924 p.ControllingClient.SendKillObject(kk);
1925 sog.SendFullUpdateToClient(p.ControllingClient);
1926 SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path
1927 });
1928
1891 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 1929 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
1892 sog.ResumeScripts(); 1930 sog.ResumeScripts();
1931 kk.Clear();
1893 } 1932 }
1894 } 1933 }
1895 } 1934 }
1896 1935
1936 m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1937
1897 // Create child agents in neighbouring regions 1938 // Create child agents in neighbouring regions
1898 if (openChildAgents) 1939 if (openChildAgents)
1899 { 1940 {
@@ -1903,10 +1944,14 @@ namespace OpenSim.Region.Framework.Scenes
1903 } 1944 }
1904 } 1945 }
1905 1946
1947 m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1948
1906 // send the rest of the world 1949 // send the rest of the world
1907 if (m_teleportFlags > 0 && !isNPC) 1950 if (m_teleportFlags > 0 && !isNPC || m_currentParcelHide)
1908 SendInitialDataToMe(); 1951 SendInitialDataToMe();
1909 1952
1953 m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1954
1910 if (!IsChildAgent) 1955 if (!IsChildAgent)
1911 { 1956 {
1912// moved from makeroot missing in sendInitialDataToMe 1957// moved from makeroot missing in sendInitialDataToMe
@@ -1923,6 +1968,8 @@ namespace OpenSim.Region.Framework.Scenes
1923 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); 1968 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
1924 if (friendsModule != null) 1969 if (friendsModule != null)
1925 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1970 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1971
1972 m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1926 } 1973 }
1927 } 1974 }
1928 } 1975 }
@@ -1931,11 +1978,13 @@ namespace OpenSim.Region.Framework.Scenes
1931 m_inTransit = false; 1978 m_inTransit = false;
1932 } 1979 }
1933 // if hide force a check 1980 // if hide force a check
1934 if (!IsChildAgent && newhide) 1981 // if (!IsChildAgent && newhide)
1935 { 1982 // {
1936 ParcelLoginCheck(m_currentParcelUUID); 1983 // ParcelLoginCheck(m_currentParcelUUID);
1937 m_currentParcelHide = newhide; 1984 // m_currentParcelHide = newhide;
1938 } 1985 // }
1986
1987 m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1939 } 1988 }
1940 1989
1941 /// <summary> 1990 /// <summary>
@@ -2776,34 +2825,15 @@ namespace OpenSim.Region.Framework.Scenes
2776 2825
2777 if (satOnObject) 2826 if (satOnObject)
2778 { 2827 {
2779// SendAvatarDataToAllAgents();
2780 m_requestedSitTargetID = 0; 2828 m_requestedSitTargetID = 0;
2781
2782 part.RemoveSittingAvatar(UUID); 2829 part.RemoveSittingAvatar(UUID);
2783
2784 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 2830 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
2785 }
2786 2831
2787 else if (PhysicsActor == null) 2832 SendAvatarDataToAllAgents();
2788 AddToPhysicalScene(false); 2833 }
2789 2834
2790 Animator.TrySetMovementAnimation("STAND"); 2835 Animator.TrySetMovementAnimation("STAND");
2791 2836
2792 if (satOnObject)
2793 {
2794 ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X,AbsolutePosition.Y);
2795 if (land != null)
2796 {
2797 UUID parcelID = land.LandData.GlobalID;
2798 if (m_currentParcelUUID != parcelID)
2799 currentParcelUUID = parcelID;
2800 else
2801 SendAvatarDataToAllAgents();
2802 }
2803 else
2804 SendAvatarDataToAllAgents();
2805 }
2806
2807 TriggerScenePresenceUpdated(); 2837 TriggerScenePresenceUpdated();
2808 } 2838 }
2809 2839
@@ -3078,11 +3108,14 @@ namespace OpenSim.Region.Framework.Scenes
3078 3108
3079 ParentPart = part; 3109 ParentPart = part;
3080 ParentID = part.LocalId; 3110 ParentID = part.LocalId;
3111
3112 SendAvatarDataToAllAgents();
3113
3081 if(status == 3) 3114 if(status == 3)
3082 Animator.TrySetMovementAnimation("SIT_GROUND"); 3115 Animator.TrySetMovementAnimation("SIT_GROUND");
3083 else 3116 else
3084 Animator.TrySetMovementAnimation("SIT"); 3117 Animator.TrySetMovementAnimation("SIT");
3085 SendAvatarDataToAllAgents(); 3118
3086 3119
3087 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 3120 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
3088 } 3121 }
@@ -3182,13 +3215,14 @@ namespace OpenSim.Region.Framework.Scenes
3182 Velocity = Vector3.Zero; 3215 Velocity = Vector3.Zero;
3183 RemoveFromPhysicalScene(); 3216 RemoveFromPhysicalScene();
3184 3217
3218 SendAvatarDataToAllAgents();
3219
3185 String sitAnimation = "SIT"; 3220 String sitAnimation = "SIT";
3186 if (!String.IsNullOrEmpty(part.SitAnimation)) 3221 if (!String.IsNullOrEmpty(part.SitAnimation))
3187 { 3222 {
3188 sitAnimation = part.SitAnimation; 3223 sitAnimation = part.SitAnimation;
3189 } 3224 }
3190 Animator.TrySetMovementAnimation(sitAnimation); 3225 Animator.TrySetMovementAnimation(sitAnimation);
3191 SendAvatarDataToAllAgents();
3192 TriggerScenePresenceUpdated(); 3226 TriggerScenePresenceUpdated();
3193 } 3227 }
3194 } 3228 }
@@ -3349,8 +3383,30 @@ namespace OpenSim.Region.Framework.Scenes
3349 3383
3350 #region Update Client(s) 3384 #region Update Client(s)
3351 3385
3386 public void SendUpdateToAgent(ScenePresence p)
3387 {
3388 IClientAPI remoteClient = p.ControllingClient;
3389
3390 if (remoteClient.IsActive)
3391 {
3392 //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
3393 remoteClient.SendEntityUpdate(this, PrimUpdateFlags.FullUpdate);
3394 m_scene.StatsReporter.AddAgentUpdates(1);
3395 }
3396 }
3397
3398 public void SendFullUpdateToClient(IClientAPI remoteClient)
3399 {
3400 if (remoteClient.IsActive)
3401 {
3402 //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
3403 remoteClient.SendEntityUpdate(this, PrimUpdateFlags.FullUpdate);
3404 m_scene.StatsReporter.AddAgentUpdates(1);
3405 }
3406 }
3407
3352 // this is diferente from SendTerseUpdateToClient 3408 // this is diferente from SendTerseUpdateToClient
3353 // this sends bypassing ententies updates 3409 // this sends bypassing entities updates
3354 public void SendAgentTerseUpdate(ISceneEntity p) 3410 public void SendAgentTerseUpdate(ISceneEntity p)
3355 { 3411 {
3356 ControllingClient.SendAgentTerseUpdate(p); 3412 ControllingClient.SendAgentTerseUpdate(p);
@@ -3377,7 +3433,7 @@ namespace OpenSim.Region.Framework.Scenes
3377 } 3433 }
3378 } 3434 }
3379 3435
3380 public void SendTerseUpdateToAgentClient(ScenePresence p) 3436 public void SendTerseUpdateToAgent(ScenePresence p)
3381 { 3437 {
3382 IClientAPI remoteClient = p.ControllingClient; 3438 IClientAPI remoteClient = p.ControllingClient;
3383 3439
@@ -3396,6 +3452,18 @@ namespace OpenSim.Region.Framework.Scenes
3396 m_scene.StatsReporter.AddAgentUpdates(1); 3452 m_scene.StatsReporter.AddAgentUpdates(1);
3397 } 3453 }
3398 3454
3455 public void SendTerseUpdateToAgentNF(ScenePresence p)
3456 {
3457 IClientAPI remoteClient = p.ControllingClient;
3458 if (remoteClient.IsActive)
3459 {
3460 //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
3461 remoteClient.SendEntityUpdate(this, PrimUpdateFlags.FullUpdate);
3462 m_scene.StatsReporter.AddAgentUpdates(1);
3463 }
3464 }
3465
3466
3399 // vars to support reduced update frequency when velocity is unchanged 3467 // vars to support reduced update frequency when velocity is unchanged
3400 private Vector3 lastVelocitySentToAllClients = Vector3.Zero; 3468 private Vector3 lastVelocitySentToAllClients = Vector3.Zero;
3401 private Vector3 lastPositionSentToAllClients = Vector3.Zero; 3469 private Vector3 lastPositionSentToAllClients = Vector3.Zero;
@@ -3437,7 +3505,7 @@ namespace OpenSim.Region.Framework.Scenes
3437 3505
3438// Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); 3506// Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name);
3439// m_scene.ForEachClient(SendTerseUpdateToClient); 3507// m_scene.ForEachClient(SendTerseUpdateToClient);
3440 m_scene.ForEachScenePresence(SendTerseUpdateToAgentClient); 3508 m_scene.ForEachScenePresence(SendTerseUpdateToAgent);
3441 } 3509 }
3442 TriggerScenePresenceUpdated(); 3510 TriggerScenePresenceUpdated();
3443 } 3511 }
@@ -3478,8 +3546,8 @@ namespace OpenSim.Region.Framework.Scenes
3478 landch.sendClientInitialLandInfo(ControllingClient); 3546 landch.sendClientInitialLandInfo(ControllingClient);
3479 } 3547 }
3480 } 3548 }
3481 SendOtherAgentsAvatarDataToMe(); 3549
3482 SendOtherAgentsAppearanceToMe(); 3550 SendOtherAgentsAvatarFullToMe();
3483 3551
3484 EntityBase[] entities = Scene.Entities.GetEntities(); 3552 EntityBase[] entities = Scene.Entities.GetEntities();
3485 foreach (EntityBase e in entities) 3553 foreach (EntityBase e in entities)
@@ -3508,40 +3576,56 @@ namespace OpenSim.Region.Framework.Scenes
3508 // to see if all the baked textures are already here. 3576 // to see if all the baked textures are already here.
3509 if (m_scene.AvatarFactory != null) 3577 if (m_scene.AvatarFactory != null)
3510 cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(this); 3578 cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(this);
3511 3579
3512 // If we aren't using a cached appearance, then clear out the baked textures 3580 // If we aren't using a cached appearance, then clear out the baked textures
3513 if (!cachedappearance) 3581 if (!cachedappearance)
3514 { 3582 {
3515// Appearance.ResetAppearance();
3516// save what ????
3517// maybe needed so the tryretry repair works?
3518 if (m_scene.AvatarFactory != null) 3583 if (m_scene.AvatarFactory != null)
3519 m_scene.AvatarFactory.QueueAppearanceSave(UUID); 3584 m_scene.AvatarFactory.QueueAppearanceSave(UUID);
3520 } 3585 }
3521 3586
3587 bool newhide = m_currentParcelHide;
3588 m_currentParcelHide = false;
3522 3589
3523 // This agent just became root. We are going to tell everyone about it. The process of
3524 // getting other avatars information was initiated elsewhere immediately after the child circuit connected... don't do it
3525 // again here... this comes after the cached appearance check because the avatars
3526 // appearance goes into the avatar update packet
3527 SendAvatarDataToAllAgents(); 3590 SendAvatarDataToAllAgents();
3528 3591
3529 // This invocation always shows up in the viewer logs as an error. Is it needed? 3592 if (newhide)
3530 // send all information we have 3593 {
3531 // possible not needed since viewer should ask about it 3594 ParcelLoginCheck(m_currentParcelUUID);
3532 // least it all ask for baked 3595 m_currentParcelHide = true;
3596 }
3597
3533 SendAppearanceToAgent(this); 3598 SendAppearanceToAgent(this);
3534 3599
3535 // If we are using the the cached appearance then send it out to everyone 3600// if (cachedappearance)
3536 // send even grays 3601// {
3537 if (cachedappearance) 3602 SendAppearanceToAllOtherAgents();
3603// }
3604 if(Animator!= null)
3605 Animator.SendAnimPack();
3606 }
3607
3608 /// <summary>
3609 /// Send avatar full data appearance and animations for all other root agents to this agent, this agent
3610 /// can be either a child or root
3611 /// </summary>
3612 public void SendOtherAgentsAvatarFullToMe()
3613 {
3614 int count = 0;
3615 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
3538 { 3616 {
3539// m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name); 3617 // only send information about other root agents
3540 // If the avatars baked textures are all in the cache, then we have a 3618 if (scenePresence.UUID == UUID)
3541 // complete appearance... send it out, if not, then we'll send it when 3619 return;
3542 // the avatar finishes updating its appearance 3620
3543 SendAppearanceToAllOtherAgents(); 3621 scenePresence.SendAvatarDataToAgent(this);
3544 } 3622 scenePresence.SendAppearanceToAgent(this);
3623 scenePresence.SendAnimPackToAgent(this);
3624 // for now attachments are sent with all SOG
3625 count++;
3626 });
3627
3628 m_scene.StatsReporter.AddAgentUpdates(count);
3545 } 3629 }
3546 3630
3547 /// <summary> 3631 /// <summary>
@@ -3566,33 +3650,12 @@ namespace OpenSim.Region.Framework.Scenes
3566 3650
3567 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 3651 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
3568 { 3652 {
3569 SendAvatarDataToAgent(scenePresence); 3653 SendAvatarDataToAgent(scenePresence);
3570 count++; 3654 count++;
3571 }); 3655 });
3572 3656
3573 m_scene.StatsReporter.AddAgentUpdates(count); 3657 m_scene.StatsReporter.AddAgentUpdates(count);
3574 } 3658 }
3575
3576 /// <summary>
3577 /// Send avatar data for all other root agents to this agent, this agent
3578 /// can be either a child or root
3579 /// </summary>
3580 public void SendOtherAgentsAvatarDataToMe()
3581 {
3582 int count = 0;
3583
3584 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
3585 {
3586 // only send information about other root agents
3587 if (scenePresence.UUID == UUID)
3588 return;
3589
3590 scenePresence.SendAvatarDataToAgent(this);
3591 count++;
3592 });
3593
3594 m_scene.StatsReporter.AddAgentUpdates(count);
3595 }
3596 3659
3597 /// <summary> 3660 /// <summary>
3598 /// Send avatar data to an agent. 3661 /// Send avatar data to an agent.
@@ -3604,7 +3667,11 @@ namespace OpenSim.Region.Framework.Scenes
3604 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) 3667 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200)
3605 return; 3668 return;
3606 avatar.ControllingClient.SendAvatarDataImmediate(this); 3669 avatar.ControllingClient.SendAvatarDataImmediate(this);
3607 Animator.SendAnimPackToClient(avatar.ControllingClient); 3670 }
3671
3672 public void SendAvatarDataToAgentNF(ScenePresence avatar)
3673 {
3674 avatar.ControllingClient.SendAvatarDataImmediate(this);
3608 } 3675 }
3609 3676
3610 /// <summary> 3677 /// <summary>
@@ -3639,28 +3706,6 @@ namespace OpenSim.Region.Framework.Scenes
3639 } 3706 }
3640 3707
3641 /// <summary> 3708 /// <summary>
3642 /// Send appearance from all other root agents to this agent. this agent
3643 /// can be either root or child
3644 /// </summary>
3645 public void SendOtherAgentsAppearanceToMe()
3646 {
3647// m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} {1}", Name, UUID);
3648
3649 int count = 0;
3650 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
3651 {
3652 // only send information about other root agents
3653 if (scenePresence.UUID == UUID)
3654 return;
3655
3656 scenePresence.SendAppearanceToAgent(this);
3657 count++;
3658 });
3659
3660 m_scene.StatsReporter.AddAgentUpdates(count);
3661 }
3662
3663 /// <summary>
3664 /// Send appearance data to an agent. 3709 /// Send appearance data to an agent.
3665 /// </summary> 3710 /// </summary>
3666 /// <param name="avatar"></param> 3711 /// <param name="avatar"></param>
@@ -3674,6 +3719,30 @@ namespace OpenSim.Region.Framework.Scenes
3674 UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); 3719 UUID, Appearance.VisualParams, Appearance.Texture.GetBytes());
3675 } 3720 }
3676 3721
3722 public void SendAnimPackToAgent(ScenePresence p)
3723 {
3724 if (IsChildAgent || Animator == null)
3725 return;
3726
3727 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
3728 return;
3729
3730 Animator.SendAnimPackToClient(p.ControllingClient);
3731 }
3732
3733 public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs)
3734 {
3735 if (IsChildAgent)
3736 return;
3737
3738 m_scene.ForEachScenePresence(delegate(ScenePresence p)
3739 {
3740 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
3741 return;
3742 p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
3743 });
3744 }
3745
3677 #endregion 3746 #endregion
3678 3747
3679 #region Significant Movement Method 3748 #region Significant Movement Method
@@ -4193,13 +4262,15 @@ namespace OpenSim.Region.Framework.Scenes
4193 } 4262 }
4194 catch { } 4263 catch { }
4195 4264
4265 Animator.ResetAnimations();
4266
4196 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? 4267 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object?
4197 if (cAgent.Anims != null)
4198 Animator.Animations.FromArray(cAgent.Anims);
4199 if (cAgent.DefaultAnim != null) 4268 if (cAgent.DefaultAnim != null)
4200 Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero); 4269 Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero);
4201 if (cAgent.AnimState != null) 4270 if (cAgent.AnimState != null)
4202 Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero); 4271 Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero);
4272 if (cAgent.Anims != null)
4273 Animator.Animations.FromArray(cAgent.Anims);
4203 4274
4204 if (Scene.AttachmentsModule != null) 4275 if (Scene.AttachmentsModule != null)
4205 Scene.AttachmentsModule.CopyAttachments(cAgent, this); 4276 Scene.AttachmentsModule.CopyAttachments(cAgent, this);
@@ -4653,18 +4724,186 @@ namespace OpenSim.Region.Framework.Scenes
4653 return validated; 4724 return validated;
4654 } 4725 }
4655 4726
4727 public void SendAttachmentsToAllAgents()
4728 {
4729 lock (m_attachments)
4730 {
4731 foreach (SceneObjectGroup sog in m_attachments)
4732 {
4733 m_scene.ForEachScenePresence(delegate(ScenePresence p)
4734 {
4735 if (p != this && sog.HasPrivateAttachmentPoint)
4736 return;
4737 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
4738 return;
4739 sog.SendFullUpdateToClient(p.ControllingClient);
4740 SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path
4741 });
4742 }
4743 }
4744 }
4656 4745
4657 public void SendAttachmentsToClient(IClientAPI client) 4746 // send attachments to a client without filters except for huds
4747 // for now they are checked in several places down the line...
4748 public void SendAttachmentsToAgentNF(ScenePresence p)
4658 { 4749 {
4659 lock (m_attachments) 4750 lock (m_attachments)
4660 { 4751 {
4661 foreach (SceneObjectGroup gobj in m_attachments) 4752 foreach (SceneObjectGroup sog in m_attachments)
4753 {
4754 if (p == this || !sog.HasPrivateAttachmentPoint)
4755 sog.SendFullUpdateToClient(p.ControllingClient);
4756 }
4757 SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path
4758 }
4759 }
4760
4761 public void SendAttachmentsToAgentNFPK(ScenePresence p)
4762 {
4763 lock (m_attachments)
4764 {
4765 List<uint> pk = new List<uint>();
4766 foreach (SceneObjectGroup sog in m_attachments)
4767 {
4768 foreach (SceneObjectPart part in sog.Parts)
4769 pk.Add(part.LocalId);
4770 }
4771
4772 p.ControllingClient.SendKillObject(pk);
4773
4774 foreach (SceneObjectGroup sog in m_attachments)
4662 { 4775 {
4663 gobj.SendFullUpdateToClient(client); 4776 if (p == this || !sog.HasPrivateAttachmentPoint)
4777 sog.SendFullUpdateToClient(p.ControllingClient);
4664 } 4778 }
4779 SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path
4665 } 4780 }
4666 } 4781 }
4667 4782
4783
4784 public void SendAttachmentScheduleUpdate(SceneObjectGroup sog)
4785 {
4786 if (IsChildAgent)
4787 return;
4788
4789 m_scene.ForEachScenePresence(delegate(ScenePresence p)
4790 {
4791 if (p != this && sog.HasPrivateAttachmentPoint)
4792 return;
4793 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
4794 return;
4795
4796 SceneObjectPart[] parts = sog.Parts;
4797
4798 for (int i = 0; i < parts.Length; i++)
4799 {
4800 SceneObjectPart part = parts[i];
4801 if (part.UpdateFlag == UpdateRequired.TERSE)
4802 {
4803 p.ControllingClient.SendEntityUpdate(part,
4804 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
4805 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
4806 part.UpdateFlag = 0;
4807 }
4808 else if (part.UpdateFlag == UpdateRequired.FULL)
4809 {
4810 p.ControllingClient.SendEntityUpdate(part, PrimUpdateFlags.FullUpdate);
4811 part.UpdateFlag = 0;
4812 }
4813 }
4814 });
4815 }
4816
4817 public void SendAttachmentScheduleUpdate(SceneObjectPart part)
4818 {
4819 if (IsChildAgent)
4820 return;
4821
4822 m_scene.ForEachScenePresence(delegate(ScenePresence p)
4823 {
4824 if (p != this && part.ParentGroup.HasPrivateAttachmentPoint)
4825 return;
4826
4827 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
4828 return;
4829
4830 if (part.UpdateFlag == UpdateRequired.TERSE)
4831 {
4832 p.ControllingClient.SendEntityUpdate(part,
4833 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
4834 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
4835 part.UpdateFlag = 0;
4836 }
4837 else if (part.UpdateFlag == UpdateRequired.FULL)
4838 {
4839 p.ControllingClient.SendEntityUpdate(part, PrimUpdateFlags.FullUpdate);
4840 part.UpdateFlag = 0;
4841 }
4842 });
4843 }
4844
4845 public void SendAttachmentUpdate(SceneObjectGroup sog, UpdateRequired UpdateFlag)
4846 {
4847 if (IsChildAgent)
4848 return;
4849
4850 m_scene.ForEachScenePresence(delegate(ScenePresence p)
4851 {
4852 if (p != this && sog.HasPrivateAttachmentPoint)
4853 return;
4854
4855 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
4856 return;
4857
4858 SceneObjectPart[] parts = sog.Parts;
4859
4860 for (int i = 0; i < parts.Length; i++)
4861 {
4862 SceneObjectPart part = parts[i];
4863 if (UpdateFlag == UpdateRequired.TERSE)
4864 {
4865 p.ControllingClient.SendEntityUpdate(part,
4866 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
4867 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
4868 part.UpdateFlag = 0;
4869 }
4870 else if (UpdateFlag == UpdateRequired.FULL)
4871 {
4872 p.ControllingClient.SendEntityUpdate(part, PrimUpdateFlags.FullUpdate);
4873 part.UpdateFlag = 0;
4874 }
4875 }
4876 });
4877 }
4878
4879 public void SendAttachmentUpdate(SceneObjectPart part, UpdateRequired UpdateFlag)
4880 {
4881 if (IsChildAgent)
4882 return;
4883
4884 m_scene.ForEachScenePresence(delegate(ScenePresence p)
4885 {
4886 if (p != this && part.ParentGroup.HasPrivateAttachmentPoint)
4887 return;
4888
4889 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
4890 return;
4891
4892 if (UpdateFlag == UpdateRequired.TERSE)
4893 {
4894 p.ControllingClient.SendEntityUpdate(part,
4895 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
4896 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
4897 part.UpdateFlag = 0;
4898 }
4899 else if (UpdateFlag == UpdateRequired.FULL)
4900 {
4901 p.ControllingClient.SendEntityUpdate(part, PrimUpdateFlags.FullUpdate);
4902 part.UpdateFlag = 0;
4903 }
4904 });
4905 }
4906
4668 /// <summary> 4907 /// <summary>
4669 /// Send a script event to this scene presence's attachments 4908 /// Send a script event to this scene presence's attachments
4670 /// </summary> 4909 /// </summary>
@@ -5436,12 +5675,12 @@ namespace OpenSim.Region.Framework.Scenes
5436 { 5675 {
5437 if (p.IsChildAgent) 5676 if (p.IsChildAgent)
5438 continue; 5677 continue;
5439 m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); 5678
5440 ControllingClient.SendAvatarDataImmediate(p); 5679 p.SendAvatarDataToAgentNF(this);
5441 p.SendAppearanceToAgent(this); 5680 p.SendAppearanceToAgent(this);
5442 p.SendAttachmentsToClient(ControllingClient);
5443 if (p.Animator != null) 5681 if (p.Animator != null)
5444 p.Animator.SendAnimPackToClient(ControllingClient); 5682 p.Animator.SendAnimPackToClient(ControllingClient);
5683 p.SendAttachmentsToAgentNFPK(this);
5445 } 5684 }
5446 } 5685 }
5447 } 5686 }
@@ -5476,7 +5715,7 @@ namespace OpenSim.Region.Framework.Scenes
5476 private void ParcelLoginCheck(UUID currentParcelID) 5715 private void ParcelLoginCheck(UUID currentParcelID)
5477 { 5716 {
5478 List<ScenePresence> killsToSendto = new List<ScenePresence>(); 5717 List<ScenePresence> killsToSendto = new List<ScenePresence>();
5479 List<ScenePresence> killsToSendme = new List<ScenePresence>(); 5718 List<uint> killsToSendme = new List<uint>();
5480 List<ScenePresence> viewsToSendto = new List<ScenePresence>(); 5719 List<ScenePresence> viewsToSendto = new List<ScenePresence>();
5481 List<ScenePresence> viewsToSendme = new List<ScenePresence>(); 5720 List<ScenePresence> viewsToSendme = new List<ScenePresence>();
5482 List<ScenePresence> allpresences = null; 5721 List<ScenePresence> allpresences = null;
@@ -5492,8 +5731,8 @@ namespace OpenSim.Region.Framework.Scenes
5492 { 5731 {
5493 if (p.GodLevel < 200) 5732 if (p.GodLevel < 200)
5494 killsToSendto.Add(p); 5733 killsToSendto.Add(p);
5495 if (GodLevel < 200 && p.ParcelHideThisAvatar) 5734// if (GodLevel < 200 && p.ParcelHideThisAvatar)
5496 killsToSendme.Add(p); 5735// killsToSendme.Add(p.LocalId);
5497 } 5736 }
5498 else 5737 else
5499 { 5738 {
@@ -5517,14 +5756,15 @@ namespace OpenSim.Region.Framework.Scenes
5517 5756
5518 if (killsToSendme.Count > 0) 5757 if (killsToSendme.Count > 0)
5519 { 5758 {
5520 foreach (ScenePresence p in killsToSendme) 5759 m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + killsToSendme.Count.ToString());
5760 try
5521 { 5761 {
5522 m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); 5762 ControllingClient.SendKillObject(killsToSendme);
5523 try { ControllingClient.SendKillObject(new List<uint> { p.LocalId }); }
5524 catch (NullReferenceException) { }
5525 } 5763 }
5526 } 5764 catch (NullReferenceException) { }
5527 5765
5766 }
5767/*
5528 if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) 5768 if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc)
5529 { 5769 {
5530 foreach (ScenePresence p in viewsToSendto) 5770 foreach (ScenePresence p in viewsToSendto)
@@ -5552,81 +5792,46 @@ namespace OpenSim.Region.Framework.Scenes
5552 p.Animator.SendAnimPackToClient(ControllingClient); 5792 p.Animator.SendAnimPackToClient(ControllingClient);
5553 } 5793 }
5554 } 5794 }
5795*/
5555 } 5796 }
5556 5797
5557 public void parcelRegionCross(bool abort) 5798
5799 public void parcelRegionCross()
5558 { 5800 {
5559 if (!ParcelHideThisAvatar) 5801 if (!ParcelHideThisAvatar || GodLevel >= 200)
5560 return; 5802 return;
5561 5803
5562 List<ScenePresence> allpresences = null; 5804 List<ScenePresence> allpresences = null;
5563 allpresences = m_scene.GetScenePresences(); 5805 allpresences = m_scene.GetScenePresences();
5564 5806
5565 if (abort) 5807 List<uint> killsToSendme = new List<uint>();
5566 {
5567 List<ScenePresence> viewsToSendme = new List<ScenePresence>();
5568
5569 foreach (ScenePresence p in allpresences)
5570 {
5571 if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
5572 continue;
5573
5574 if (p.currentParcelUUID == m_currentParcelUUID)
5575 {
5576 viewsToSendme.Add(p);
5577 }
5578 }
5579 5808
5580 if (viewsToSendme.Count > 0) 5809 foreach (ScenePresence p in allpresences)
5581 {
5582 foreach (ScenePresence p in viewsToSendme)
5583 {
5584 if (p.IsChildAgent)
5585 continue;
5586// m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname);
5587 ControllingClient.SendAvatarDataImmediate(p);
5588 p.SendAppearanceToAgent(this);
5589 p.SendAttachmentsToClient(ControllingClient);
5590 if (p.Animator != null)
5591 p.Animator.SendAnimPackToClient(ControllingClient);
5592 }
5593 }
5594 }
5595 else
5596 { 5810 {
5597 if (GodLevel >= 200) 5811 if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
5598 return; 5812 continue;
5599 5813
5600 List<ScenePresence> killsToSendme = new List<ScenePresence>(); 5814 if (p.currentParcelUUID == m_currentParcelUUID)
5601 foreach (ScenePresence p in allpresences)
5602 { 5815 {
5603 if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) 5816 killsToSendme.Add(p.LocalId);
5604 continue;
5605
5606 if (p.currentParcelUUID == m_currentParcelUUID)
5607 {
5608 killsToSendme.Add(p);
5609 }
5610 } 5817 }
5818 }
5611 5819
5612 if (killsToSendme.Count > 0) 5820 if (killsToSendme.Count > 0)
5821 {
5822 try
5613 { 5823 {
5614 foreach (ScenePresence p in killsToSendme) 5824 ControllingClient.SendKillObject(killsToSendme);
5615 {
5616 m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname);
5617 try { ControllingClient.SendKillObject(new List<uint> { p.LocalId }); }
5618 catch (NullReferenceException) { }
5619 }
5620 } 5825 }
5826 catch (NullReferenceException) { }
5621 } 5827 }
5622 } 5828 }
5623
5624 5829
5625 private void ParcelCrossCheck(UUID currentParcelID,UUID previusParcelID, 5830 private void ParcelCrossCheck(UUID currentParcelID,UUID previusParcelID,
5626 bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check) 5831 bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check)
5627 { 5832 {
5628 List<ScenePresence> killsToSendto = new List<ScenePresence>(); 5833 List<ScenePresence> killsToSendto = new List<ScenePresence>();
5629 List<ScenePresence> killsToSendme = new List<ScenePresence>(); 5834 List<uint> killsToSendme = new List<uint>();
5630 List<ScenePresence> viewsToSendto = new List<ScenePresence>(); 5835 List<ScenePresence> viewsToSendto = new List<ScenePresence>();
5631 List<ScenePresence> viewsToSendme = new List<ScenePresence>(); 5836 List<ScenePresence> viewsToSendme = new List<ScenePresence>();
5632 List<ScenePresence> allpresences = null; 5837 List<ScenePresence> allpresences = null;
@@ -5697,7 +5902,7 @@ namespace OpenSim.Region.Framework.Scenes
5697 if(p.GodLevel < 200) 5902 if(p.GodLevel < 200)
5698 killsToSendto.Add(p); // they dont see me 5903 killsToSendto.Add(p); // they dont see me
5699 if(GodLevel < 200) 5904 if(GodLevel < 200)
5700 killsToSendme.Add(p); // i dont see them 5905 killsToSendme.Add(p.LocalId); // i dont see them
5701 } 5906 }
5702 // only those on new parcel need see 5907 // only those on new parcel need see
5703 if (currentParcelID == p.currentParcelUUID) 5908 if (currentParcelID == p.currentParcelUUID)
@@ -5746,7 +5951,7 @@ namespace OpenSim.Region.Framework.Scenes
5746 // only those old parcel need receive kills 5951 // only those old parcel need receive kills
5747 if (previusParcelID == p.currentParcelUUID && GodLevel < 200) 5952 if (previusParcelID == p.currentParcelUUID && GodLevel < 200)
5748 { 5953 {
5749 killsToSendme.Add(p); // i dont see them 5954 killsToSendme.Add(p.LocalId); // i dont see them
5750 } 5955 }
5751 else 5956 else
5752 { 5957 {
@@ -5771,26 +5976,26 @@ namespace OpenSim.Region.Framework.Scenes
5771 } 5976 }
5772 } 5977 }
5773 5978
5774 if (killsToSendme.Count > 0 ) 5979 if (killsToSendme.Count > 0)
5775 { 5980 {
5776 foreach (ScenePresence p in killsToSendme) 5981 m_log.Debug("[AVATAR]: killtoMe: " + Lastname + " " + killsToSendme.Count.ToString());
5982 try
5777 { 5983 {
5778 m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); 5984 ControllingClient.SendKillObject(killsToSendme);
5779 try {ControllingClient.SendKillObject(new List<uint> { p.LocalId }); }
5780 catch (NullReferenceException) { }
5781 } 5985 }
5986 catch (NullReferenceException) { }
5987
5782 } 5988 }
5783 5989
5784 if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) 5990 if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc)
5785 { 5991 {
5786 foreach (ScenePresence p in viewsToSendto) 5992 foreach (ScenePresence p in viewsToSendto)
5787 { 5993 {
5788 p.ControllingClient.SendAvatarDataImmediate(this); 5994 SendAvatarDataToAgentNF(p);
5789// m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname);
5790 SendAppearanceToAgent(p); 5995 SendAppearanceToAgent(p);
5791 SendAttachmentsToClient(p.ControllingClient);
5792 if (Animator != null) 5996 if (Animator != null)
5793 Animator.SendAnimPackToClient(p.ControllingClient); 5997 Animator.SendAnimPackToClient(p.ControllingClient);
5998 SendAttachmentsToAgentNFPK(p);
5794 } 5999 }
5795 } 6000 }
5796 6001
@@ -5801,11 +6006,12 @@ namespace OpenSim.Region.Framework.Scenes
5801 if (p.IsChildAgent) 6006 if (p.IsChildAgent)
5802 continue; 6007 continue;
5803// m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); 6008// m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname);
5804 ControllingClient.SendAvatarDataImmediate(p); 6009
6010 p.SendAvatarDataToAgentNF(this);
5805 p.SendAppearanceToAgent(this); 6011 p.SendAppearanceToAgent(this);
5806 p.SendAttachmentsToClient(ControllingClient);
5807 if (p.Animator != null) 6012 if (p.Animator != null)
5808 p.Animator.SendAnimPackToClient(ControllingClient); 6013 p.Animator.SendAnimPackToClient(ControllingClient);
6014 p.SendAttachmentsToAgentNFPK(this);
5809 } 6015 }
5810 } 6016 }
5811 } 6017 }