aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs22
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs52
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs16
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs35
-rw-r--r--OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs24
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs252
-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
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs2
11 files changed, 678 insertions, 361 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 85049c9..e1e3d87 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -978,15 +978,25 @@ namespace OpenSim
978 cdt.AddColumn("Circuit code", 12); 978 cdt.AddColumn("Circuit code", 12);
979 cdt.AddColumn("Endpoint", 23); 979 cdt.AddColumn("Endpoint", 23);
980 cdt.AddColumn("Active?", 7); 980 cdt.AddColumn("Active?", 7);
981 cdt.AddColumn("ChildAgent?", 7);
982 cdt.AddColumn("ping(ms)", 8);
981 983
982 SceneManager.ForEachScene( 984 SceneManager.ForEachScene(
983 s => s.ForEachClient( 985 s => s.ForEachClient(
984 c => cdt.AddRow( 986 c =>
985 s.Name, 987 {
986 c.Name, 988 bool child = false;
987 c.CircuitCode.ToString(), 989 if(c.SceneAgent != null && c.SceneAgent.IsChildAgent)
988 c.RemoteEndPoint.ToString(), 990 child = true;
989 c.IsActive.ToString()))); 991 cdt.AddRow(
992 s.Name,
993 c.Name,
994 c.CircuitCode.ToString(),
995 c.RemoteEndPoint.ToString(),
996 c.IsActive.ToString(),
997 child.ToString(),
998 c.PingTimeMS);
999 }));
990 1000
991 MainConsole.Instance.Output(cdt.ToString()); 1001 MainConsole.Instance.Output(cdt.ToString());
992 } 1002 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 59d1c69..b0cb4ea 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -358,7 +358,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
358// protected HashSet<uint> m_attachmentsSent; 358// protected HashSet<uint> m_attachmentsSent;
359 359
360 private bool m_deliverPackets = true; 360 private bool m_deliverPackets = true;
361 private int m_animationSequenceNumber = 1; 361
362 private bool m_SendLogoutPacketWhenClosing = true; 362 private bool m_SendLogoutPacketWhenClosing = true;
363 363
364 /// <summary> 364 /// <summary>
@@ -419,6 +419,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
419 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } 419 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
420 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } 420 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
421 421
422 public int PingTimeMS
423 {
424 get
425 {
426 if (UDPClient != null)
427 return UDPClient.PingTimeMS;
428 return 0;
429 }
430 }
431
422 /// <summary> 432 /// <summary>
423 /// Entity update queues 433 /// Entity update queues
424 /// </summary> 434 /// </summary>
@@ -440,7 +450,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
440 public string Name { get { return FirstName + " " + LastName; } } 450 public string Name { get { return FirstName + " " + LastName; } }
441 451
442 public uint CircuitCode { get { return m_circuitCode; } } 452 public uint CircuitCode { get { return m_circuitCode; } }
443 public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } 453 public int NextAnimationSequenceNumber
454 {
455 get { return m_udpServer.NextAnimationSequenceNumber; }
456 }
444 457
445 /// <summary> 458 /// <summary>
446 /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to 459 /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to
@@ -461,6 +474,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
461 set { m_disableFacelights = value; } 474 set { m_disableFacelights = value; }
462 } 475 }
463 476
477
464 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } 478 public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } }
465 479
466 480
@@ -1638,6 +1652,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1638 pc.PingID.OldestUnacked = 0; 1652 pc.PingID.OldestUnacked = 0;
1639 1653
1640 OutPacket(pc, ThrottleOutPacketType.Unknown); 1654 OutPacket(pc, ThrottleOutPacketType.Unknown);
1655 UDPClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount();
1641 } 1656 }
1642 1657
1643 public void SendKillObject(List<uint> localIDs) 1658 public void SendKillObject(List<uint> localIDs)
@@ -3813,8 +3828,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3813 { 3828 {
3814 SceneObjectPart e = (SceneObjectPart)entity; 3829 SceneObjectPart e = (SceneObjectPart)entity;
3815 SceneObjectGroup g = e.ParentGroup; 3830 SceneObjectGroup g = e.ParentGroup;
3816 if (g.RootPart.Shape.State > 30 && g.RootPart.Shape.State < 39) // HUD 3831 if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId)
3817 if (g.OwnerID != AgentId)
3818 return; // Don't send updates for other people's HUDs 3832 return; // Don't send updates for other people's HUDs
3819 } 3833 }
3820 3834
@@ -3932,8 +3946,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3932 3946
3933 if (part.ParentGroup.IsAttachment) 3947 if (part.ParentGroup.IsAttachment)
3934 { // Someone else's HUD, why are we getting these? 3948 { // Someone else's HUD, why are we getting these?
3935 if (part.ParentGroup.OwnerID != AgentId && 3949 if (part.ParentGroup.OwnerID != AgentId && part.ParentGroup.HasPrivateAttachmentPoint)
3936 part.ParentGroup.RootPart.Shape.State > 30 && part.ParentGroup.RootPart.Shape.State < 39)
3937 continue; 3950 continue;
3938 ScenePresence sp; 3951 ScenePresence sp;
3939 // Owner is not in the sim, don't update it to 3952 // Owner is not in the sim, don't update it to
@@ -5278,16 +5291,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5278 5291
5279 byte[] objectData = new byte[76]; 5292 byte[] objectData = new byte[76];
5280 5293
5281 data.CollisionPlane.ToBytes(objectData, 0);
5282 offsetPosition.ToBytes(objectData, 16);
5283 Vector3 velocity = new Vector3(0, 0, 0); 5294 Vector3 velocity = new Vector3(0, 0, 0);
5284 Vector3 acceleration = new Vector3(0, 0, 0); 5295 Vector3 acceleration = new Vector3(0, 0, 0);
5296 rotation.Normalize();
5297 Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z);
5298
5299 data.CollisionPlane.ToBytes(objectData, 0);
5300 offsetPosition.ToBytes(objectData, 16);
5285 velocity.ToBytes(objectData, 28); 5301 velocity.ToBytes(objectData, 28);
5286 acceleration.ToBytes(objectData, 40); 5302 acceleration.ToBytes(objectData, 40);
5287// data.Velocity.ToBytes(objectData, 28); 5303 vrot.ToBytes(objectData, 52);
5288// data.Acceleration.ToBytes(objectData, 40); 5304 data.AngularVelocity.ToBytes(objectData, 64);
5289 rotation.ToBytes(objectData, 52);
5290 //data.AngularVelocity.ToBytes(objectData, 64);
5291 5305
5292 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); 5306 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
5293 5307
@@ -5343,15 +5357,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5343 data.RelativePosition.ToBytes(objectData, 0); 5357 data.RelativePosition.ToBytes(objectData, 0);
5344 data.Velocity.ToBytes(objectData, 12); 5358 data.Velocity.ToBytes(objectData, 12);
5345 data.Acceleration.ToBytes(objectData, 24); 5359 data.Acceleration.ToBytes(objectData, 24);
5346 try 5360
5347 { 5361 Quaternion rotation = data.RotationOffset;
5348 data.RotationOffset.ToBytes(objectData, 36); 5362 rotation.Normalize();
5349 } 5363 Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z);
5350 catch (Exception e) 5364 vrot.ToBytes(objectData, 36);
5351 {
5352 m_log.Warn("[LLClientView]: exception converting quaternion to bytes, using Quaternion.Identity. Exception: " + e.ToString());
5353 OpenMetaverse.Quaternion.Identity.ToBytes(objectData, 36);
5354 }
5355 data.AngularVelocity.ToBytes(objectData, 48); 5365 data.AngularVelocity.ToBytes(objectData, 48);
5356 5366
5357 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); 5367 ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index bd4e617..fe31bd9 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -163,6 +163,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
163 private int m_maxRTO = 60000; 163 private int m_maxRTO = 60000;
164 public bool m_deliverPackets = true; 164 public bool m_deliverPackets = true;
165 165
166 public int m_lastStartpingTimeMS;
167 public int m_pingMS;
168
169 public int PingTimeMS
170 {
171 get
172 {
173 if (m_pingMS < 10)
174 return 10;
175 if(m_pingMS > 2000)
176 return 2000;
177 return m_pingMS;
178 }
179 }
180
166 /// <summary> 181 /// <summary>
167 /// This is the percentage of the udp texture queue to add to the task queue since 182 /// This is the percentage of the udp texture queue to add to the task queue since
168 /// textures are now generally handled through http. 183 /// textures are now generally handled through http.
@@ -225,6 +240,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
225 240
226 // Initialize this to a sane value to prevent early disconnects 241 // Initialize this to a sane value to prevent early disconnects
227 TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; 242 TickLastPacketReceived = Environment.TickCount & Int32.MaxValue;
243 m_pingMS = (int)(3.0 * server.TickCountResolution); // so filter doesnt start at 0;
228 } 244 }
229 245
230 /// <summary> 246 /// <summary>
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index fe79f87..3b0312d 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -293,6 +293,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
293 /// <summary>Flag to signal when clients should send pings</summary> 293 /// <summary>Flag to signal when clients should send pings</summary>
294 protected bool m_sendPing; 294 protected bool m_sendPing;
295 295
296 private int m_animationSequenceNumber;
297
298 public int NextAnimationSequenceNumber
299 {
300 get
301 {
302 m_animationSequenceNumber++;
303 if (m_animationSequenceNumber > 2147482624)
304 m_animationSequenceNumber = 1;
305 return m_animationSequenceNumber;
306 }
307 }
308
309
310
296 private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>(); 311 private ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>> m_pendingCache = new ExpiringCache<IPEndPoint, Queue<UDPPacketBuffer>>();
297 312
298 /// <summary> 313 /// <summary>
@@ -369,16 +384,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
369 384
370 // Measure the resolution of Environment.TickCount 385 // Measure the resolution of Environment.TickCount
371 TickCountResolution = 0f; 386 TickCountResolution = 0f;
372 for (int i = 0; i < 5; i++) 387 for (int i = 0; i < 10; i++)
373 { 388 {
374 int start = Environment.TickCount; 389 int start = Environment.TickCount;
375 int now = start; 390 int now = start;
376 while (now == start) 391 while (now == start)
377 now = Environment.TickCount; 392 now = Environment.TickCount;
378 TickCountResolution += (float)(now - start) * 0.2f; 393 TickCountResolution += (float)(now - start) * 0.1f;
379 } 394 }
380 m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms");
381 TickCountResolution = (float)Math.Ceiling(TickCountResolution); 395 TickCountResolution = (float)Math.Ceiling(TickCountResolution);
396 m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms");
382 397
383 #endregion Environment.TickCount Measurement 398 #endregion Environment.TickCount Measurement
384 399
@@ -386,6 +401,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
386 int sceneThrottleBps = 0; 401 int sceneThrottleBps = 0;
387 bool usePools = false; 402 bool usePools = false;
388 403
404
405
389 IConfig config = configSource.Configs["ClientStack.LindenUDP"]; 406 IConfig config = configSource.Configs["ClientStack.LindenUDP"];
390 if (config != null) 407 if (config != null)
391 { 408 {
@@ -435,6 +452,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
435 m_throttle = new TokenBucket(null, sceneThrottleBps); 452 m_throttle = new TokenBucket(null, sceneThrottleBps);
436 ThrottleRates = new ThrottleRates(configSource); 453 ThrottleRates = new ThrottleRates(configSource);
437 454
455 Random rnd = new Random(Util.EnvironmentTickCount());
456 m_animationSequenceNumber = rnd.Next(11474826);
457
438 if (usePools) 458 if (usePools)
439 EnablePools(); 459 EnablePools();
440 } 460 }
@@ -1128,6 +1148,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1128 pc.PingID.OldestUnacked = 0; 1148 pc.PingID.OldestUnacked = 0;
1129 1149
1130 SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null); 1150 SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null);
1151 udpClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount();
1131 } 1152 }
1132 1153
1133 public void CompletePing(LLUDPClient udpClient, byte pingID) 1154 public void CompletePing(LLUDPClient udpClient, byte pingID)
@@ -1567,7 +1588,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1567 // We don't need to do anything else with ping checks 1588 // We don't need to do anything else with ping checks
1568 StartPingCheckPacket startPing = (StartPingCheckPacket)packet; 1589 StartPingCheckPacket startPing = (StartPingCheckPacket)packet;
1569 CompletePing(udpClient, startPing.PingID.PingID); 1590 CompletePing(udpClient, startPing.PingID.PingID);
1570 1591
1571 if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000) 1592 if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000)
1572 { 1593 {
1573 udpClient.SendPacketStats(); 1594 udpClient.SendPacketStats();
@@ -1577,7 +1598,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1577 } 1598 }
1578 else if (packet.Type == PacketType.CompletePingCheck) 1599 else if (packet.Type == PacketType.CompletePingCheck)
1579 { 1600 {
1580 // We don't currently track client ping times 1601 int t = Util.EnvironmentTickCountSubtract(udpClient.m_lastStartpingTimeMS);
1602 int c = udpClient.m_pingMS;
1603 c = 800 * c + 200 * t;
1604 c /= 1000;
1605 udpClient.m_pingMS = c;
1581 return; 1606 return;
1582 } 1607 }
1583 1608
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
index de8925d..498cc2f 100644
--- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
@@ -120,10 +120,16 @@ namespace OpenSim.Region.CoreModules.Framework
120 120
121 public void CreateCaps(UUID agentId, uint circuitCode) 121 public void CreateCaps(UUID agentId, uint circuitCode)
122 { 122 {
123// int ts = Util.EnvironmentTickCount();
124/* this as no business here...
125 * must be done elsewhere ( and is )
123 int flags = m_scene.GetUserFlags(agentId); 126 int flags = m_scene.GetUserFlags(agentId);
127
128 m_log.ErrorFormat("[CreateCaps]: banCheck {0} ", Util.EnvironmentTickCountSubtract(ts));
129
124 if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) 130 if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags))
125 return; 131 return;
126 132*/
127 Caps caps; 133 Caps caps;
128 String capsObjectPath = GetCapsPath(agentId); 134 String capsObjectPath = GetCapsPath(agentId);
129 135
@@ -132,19 +138,27 @@ namespace OpenSim.Region.CoreModules.Framework
132 if (m_capsObjects.ContainsKey(circuitCode)) 138 if (m_capsObjects.ContainsKey(circuitCode))
133 { 139 {
134 Caps oldCaps = m_capsObjects[circuitCode]; 140 Caps oldCaps = m_capsObjects[circuitCode];
135 141
136 //m_log.WarnFormat( 142// if (capsObjectPath == oldCaps.CapsObjectPath)
137 // "[CAPS]: Recreating caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ", 143// {
138 // agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath); 144// m_log.WarnFormat(
145// "[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ",
146// agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath);
147// return;
148// }
139 } 149 }
140 150
141 caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, 151 caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
142 (MainServer.Instance == null) ? 0: MainServer.Instance.Port, 152 (MainServer.Instance == null) ? 0: MainServer.Instance.Port,
143 capsObjectPath, agentId, m_scene.RegionInfo.RegionName); 153 capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
144 154
155// m_log.ErrorFormat("[CreateCaps]: new caps {0} ", Util.EnvironmentTickCountSubtract(ts));
156
145 m_capsObjects[circuitCode] = caps; 157 m_capsObjects[circuitCode] = caps;
146 } 158 }
147 m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); 159 m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
160// m_log.ErrorFormat("[CreateCaps]: end {0} ", Util.EnvironmentTickCountSubtract(ts));
161
148 } 162 }
149 163
150 public void RemoveCaps(UUID agentId, uint circuitCode) 164 public void RemoveCaps(UUID agentId, uint circuitCode)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 71148ea..d5eca03 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -430,7 +430,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
430 } 430 }
431 431
432 // TODO: Get proper AVG Height 432 // TODO: Get proper AVG Height
433 float localAVHeight = 1.56f; 433 float localHalfAVHeight = 0.8f;
434 if (sp.Appearance != null)
435 localHalfAVHeight = sp.Appearance.AvatarHeight / 2;
436
434 float posZLimit = 22; 437 float posZLimit = 22;
435 438
436 // TODO: Check other Scene HeightField 439 // TODO: Check other Scene HeightField
@@ -439,10 +442,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
439 posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; 442 posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y];
440 } 443 }
441 444
442 float newPosZ = posZLimit + localAVHeight; 445 posZLimit += localHalfAVHeight + 0.1f;
443 if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) 446
447 if ((position.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit)))
444 { 448 {
445 position.Z = newPosZ; 449 position.Z = posZLimit;
446 } 450 }
447 451
448 if (sp.Flying) 452 if (sp.Flying)
@@ -720,7 +724,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
720 AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); 724 AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo();
721 agentCircuit.startpos = position; 725 agentCircuit.startpos = position;
722 agentCircuit.child = true; 726 agentCircuit.child = true;
723 agentCircuit.Appearance = sp.Appearance; 727
728// agentCircuit.Appearance = sp.Appearance;
729// agentCircuit.Appearance = new AvatarAppearance(sp.Appearance, true, false);
730 agentCircuit.Appearance = new AvatarAppearance();
731 agentCircuit.Appearance.AvatarHeight = sp.Appearance.AvatarHeight;
732
724 if (currentAgentCircuit != null) 733 if (currentAgentCircuit != null)
725 { 734 {
726 agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; 735 agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs;
@@ -971,7 +980,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
971 } 980 }
972 981
973 // May need to logout or other cleanup 982 // May need to logout or other cleanup
974 AgentHasMovedAway(sp, logout); 983// AgentHasMovedAway(sp, logout);
984 AgentHasMovedAway(sp, true); // until logout use is checked
975 985
976 // Well, this is it. The agent is over there. 986 // Well, this is it. The agent is over there.
977 KillEntity(sp.Scene, sp.LocalId); 987 KillEntity(sp.Scene, sp.LocalId);
@@ -1138,7 +1148,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1138 sp.CloseChildAgents(newRegionX, newRegionY); 1148 sp.CloseChildAgents(newRegionX, newRegionY);
1139 1149
1140 // May need to logout or other cleanup 1150 // May need to logout or other cleanup
1141 AgentHasMovedAway(sp, logout); 1151// AgentHasMovedAway(sp, logout);
1152 AgentHasMovedAway(sp, true);
1142 1153
1143 // Well, this is it. The agent is over there. 1154 // Well, this is it. The agent is over there.
1144 KillEntity(sp.Scene, sp.LocalId); 1155 KillEntity(sp.Scene, sp.LocalId);
@@ -1253,7 +1264,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1253 protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) 1264 protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
1254 { 1265 {
1255 if (sp.Scene.AttachmentsModule != null) 1266 if (sp.Scene.AttachmentsModule != null)
1256 sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true); 1267 sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, logout);
1257 } 1268 }
1258 1269
1259 protected void KillEntity(Scene scene, uint localID) 1270 protected void KillEntity(Scene scene, uint localID)
@@ -1381,10 +1392,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1381 1392
1382 1393
1383 #region Agent Crossings 1394 #region Agent Crossings
1384
1385 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos) 1395 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos)
1386 { 1396 {
1397 string r = String.Empty;
1398 return GetDestination(scene, agentID, pos, out xDest, out yDest, out version, out newpos, out r);
1399 }
1400
1401 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos, out string reason)
1402 {
1387 version = String.Empty; 1403 version = String.Empty;
1404 reason = String.Empty;
1388 newpos = pos; 1405 newpos = pos;
1389 1406
1390// m_log.DebugFormat( 1407// m_log.DebugFormat(
@@ -1498,8 +1515,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1498 } 1515 }
1499 1516
1500 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 1517 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
1501 1518
1502 string reason;
1503 if (!scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out reason)) 1519 if (!scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out reason))
1504 { 1520 {
1505 if (r == null) 1521 if (r == null)
@@ -1525,11 +1541,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1525 uint y; 1541 uint y;
1526 Vector3 newpos; 1542 Vector3 newpos;
1527 string version; 1543 string version;
1544 string reason;
1528 1545
1529 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos); 1546 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos, out reason);
1530 if (neighbourRegion == null) 1547 if (neighbourRegion == null)
1531 { 1548 {
1532 agent.ControllingClient.SendAlertMessage("Cannot region cross into void"); 1549 if (reason == String.Empty)
1550 agent.ControllingClient.SendAlertMessage("Cannot cross to region");
1551 else
1552 agent.ControllingClient.SendAlertMessage("Cannot cross to region: " + reason);
1533 return false; 1553 return false;
1534 } 1554 }
1535 1555
@@ -1656,10 +1676,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1656 1676
1657 public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying) 1677 public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying)
1658 { 1678 {
1679 int ts = Util.EnvironmentTickCount();
1659 try 1680 try
1660 { 1681 {
1682
1661 AgentData cAgent = new AgentData(); 1683 AgentData cAgent = new AgentData();
1662 agent.CopyTo(cAgent); 1684 agent.CopyTo(cAgent);
1685
1686// agent.Appearance.WearableCacheItems = null;
1687
1663 cAgent.Position = pos + agent.Velocity; 1688 cAgent.Position = pos + agent.Velocity;
1664 if (isFlying) 1689 if (isFlying)
1665 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 1690 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
@@ -1686,6 +1711,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1686 return false; 1711 return false;
1687 } 1712 }
1688 1713
1714 m_log.DebugFormat("[CrossAgentIntoNewRegionMain] ok, time {0}ms",Util.EnvironmentTickCountSubtract(ts));
1715
1689 } 1716 }
1690 catch (Exception e) 1717 catch (Exception e)
1691 { 1718 {
@@ -1703,6 +1730,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1703 public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, 1730 public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
1704 bool isFlying, string version) 1731 bool isFlying, string version)
1705 { 1732 {
1733
1706 agent.ControllingClient.RequestClientInfo(); 1734 agent.ControllingClient.RequestClientInfo();
1707 1735
1708 string agentcaps; 1736 string agentcaps;
@@ -1714,6 +1742,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1714 } 1742 }
1715 1743
1716 // No turning back 1744 // No turning back
1745
1746
1747
1717 agent.IsChildAgent = true; 1748 agent.IsChildAgent = true;
1718 1749
1719 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); 1750 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
@@ -1737,12 +1768,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1737 capsPath); 1768 capsPath);
1738 } 1769 }
1739 1770
1771 // Backwards compatibility. Best effort
1772 if (version == "Unknown" || version == string.Empty)
1773 {
1774 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one...");
1775 Thread.Sleep(3000); // wait a little now that we're not waiting for the callback
1776 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1777 }
1778
1740 // SUCCESS! 1779 // SUCCESS!
1741 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); 1780 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination);
1742 1781
1743 // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. 1782 // Unlike a teleport, here we do not wait for the destination region to confirm the receipt.
1744 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); 1783 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
1745 1784
1785 // this may need the attachments
1786 agent.parcelRegionCross();
1787
1788 AgentHasMovedAway(agent, true);
1789
1746 agent.MakeChildAgent(); 1790 agent.MakeChildAgent();
1747 1791
1748 // FIXME: Possibly this should occur lower down after other commands to close other agents, 1792 // FIXME: Possibly this should occur lower down after other commands to close other agents,
@@ -1756,16 +1800,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1756// agent.SendOtherAgentsAvatarDataToMe(); 1800// agent.SendOtherAgentsAvatarDataToMe();
1757// agent.SendOtherAgentsAppearanceToMe(); 1801// agent.SendOtherAgentsAppearanceToMe();
1758 1802
1759 agent.parcelRegionCross(false);
1760
1761 // Backwards compatibility. Best effort
1762 if (version == "Unknown" || version == string.Empty)
1763 {
1764 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one...");
1765 Thread.Sleep(3000); // wait a little now that we're not waiting for the callback
1766 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1767 }
1768
1769 // Next, let's close the child agent connections that are too far away. 1803 // Next, let's close the child agent connections that are too far away.
1770 uint neighbourx; 1804 uint neighbourx;
1771 uint neighboury; 1805 uint neighboury;
@@ -1777,7 +1811,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1777 1811
1778 agent.CloseChildAgents(neighbourx, neighboury); 1812 agent.CloseChildAgents(neighbourx, neighboury);
1779 1813
1780 AgentHasMovedAway(agent, false); 1814
1781 1815
1782 // the user may change their profile information in other region, 1816 // the user may change their profile information in other region,
1783 // so the userinfo in UserProfileCache is not reliable any more, delete it 1817 // so the userinfo in UserProfileCache is not reliable any more, delete it
@@ -1817,7 +1851,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1817 #region Enable Child Agent 1851 #region Enable Child Agent
1818 1852
1819 /// <summary> 1853 /// <summary>
1820 /// This informs a single neighbouring region about agent "avatar". 1854 /// This informs a single neighbouring region about agent "avatar", and avatar about it
1821 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 1855 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
1822 /// </summary> 1856 /// </summary>
1823 /// <param name="sp"></param> 1857 /// <param name="sp"></param>
@@ -1833,8 +1867,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1833 agent.startpos = new Vector3(128, 128, 70); 1867 agent.startpos = new Vector3(128, 128, 70);
1834 agent.child = true; 1868 agent.child = true;
1835 1869
1836 //agent.Appearance = sp.Appearance; 1870 agent.Appearance = new AvatarAppearance();
1837 agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); // guess this should be a lot less 1871 agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight;
1838 1872
1839 agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); 1873 agent.CapsPath = CapsUtil.GetRandomCapsObjectPath();
1840 1874
@@ -1866,6 +1900,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1866 agent.Id0 = currentAgentCircuit.Id0; 1900 agent.Id0 = currentAgentCircuit.Id0;
1867 } 1901 }
1868 1902
1903 Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start
1904
1869 IPEndPoint external = region.ExternalEndPoint; 1905 IPEndPoint external = region.ExternalEndPoint;
1870 if (external != null) 1906 if (external != null)
1871 { 1907 {
@@ -1884,6 +1920,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1884 1920
1885 /// <summary> 1921 /// <summary>
1886 /// This informs all neighbouring regions about agent "avatar". 1922 /// This informs all neighbouring regions about agent "avatar".
1923 /// and as important informs the avatar about then
1887 /// </summary> 1924 /// </summary>
1888 /// <param name="sp"></param> 1925 /// <param name="sp"></param>
1889 public void EnableChildAgents(ScenePresence sp) 1926 public void EnableChildAgents(ScenePresence sp)
@@ -1900,81 +1937,77 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1900 m_log.Debug("[ENTITY TRANSFER MODULE]: m_regionInfo was null in EnableChildAgents, is this a NPC?"); 1937 m_log.Debug("[ENTITY TRANSFER MODULE]: m_regionInfo was null in EnableChildAgents, is this a NPC?");
1901 } 1938 }
1902 1939
1903 /// We need to find the difference between the new regions where there are no child agents 1940 LinkedList<ulong> previousRegionNeighbourHandles;
1904 /// and the regions where there are already child agents. We only send notification to the former. 1941
1905 List<ulong> neighbourHandles = NeighbourHandles(neighbours); // on this region 1942 Dictionary<ulong, string> seeds;
1906 neighbourHandles.Add(sp.Scene.RegionInfo.RegionHandle); // add this region too
1907 List<ulong> previousRegionNeighbourHandles;
1908 1943
1909 if (sp.Scene.CapsModule != null) 1944 if (sp.Scene.CapsModule != null)
1910 { 1945 {
1911 previousRegionNeighbourHandles = 1946 seeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID));
1912 new List<ulong>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID).Keys); 1947 previousRegionNeighbourHandles = new LinkedList<ulong>(seeds.Keys);
1913 } 1948 }
1914 else 1949 else
1915 { 1950 {
1916 previousRegionNeighbourHandles = new List<ulong>();
1917 }
1918
1919 List<ulong> newRegions = NewNeighbours(neighbourHandles, previousRegionNeighbourHandles);
1920 List<ulong> oldRegions = OldNeighbours(neighbourHandles, previousRegionNeighbourHandles);
1921
1922// Dump("Current Neighbors", neighbourHandles);
1923// Dump("Previous Neighbours", previousRegionNeighbourHandles);
1924// Dump("New Neighbours", newRegions);
1925// Dump("Old Neighbours", oldRegions);
1926
1927 /// Update the scene presence's known regions here on this region
1928 sp.DropOldNeighbours(oldRegions);
1929
1930 /// Collect as many seeds as possible
1931 Dictionary<ulong, string> seeds;
1932 if (sp.Scene.CapsModule != null)
1933 seeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID));
1934 else
1935 seeds = new Dictionary<ulong, string>(); 1951 seeds = new Dictionary<ulong, string>();
1952 previousRegionNeighbourHandles = new LinkedList<ulong>();
1953 }
1936 1954
1937 //m_log.Debug(" !!! No. of seeds: " + seeds.Count);
1938 if (!seeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) 1955 if (!seeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle))
1939 seeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); 1956 seeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath);
1940 1957
1941 /// Create the necessary child agents 1958 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
1959
1960 List<ulong> newneighbours = new List<ulong>();
1942 List<AgentCircuitData> cagents = new List<AgentCircuitData>(); 1961 List<AgentCircuitData> cagents = new List<AgentCircuitData>();
1962
1963 ulong currentRegionHandler = sp.Scene.RegionInfo.RegionHandle;
1964
1943 foreach (GridRegion neighbour in neighbours) 1965 foreach (GridRegion neighbour in neighbours)
1944 { 1966 {
1945 if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) 1967 ulong handler = neighbour.RegionHandle;
1946 {
1947 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
1948 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
1949 agent.BaseFolder = UUID.Zero;
1950 agent.InventoryFolder = UUID.Zero;
1951 agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour);
1952 agent.child = true;
1953 // agent.Appearance = sp.Appearance;
1954 agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); // guess this should be a lot less
1955 if (currentAgentCircuit != null)
1956 {
1957 agent.ServiceURLs = currentAgentCircuit.ServiceURLs;
1958 agent.IPAddress = currentAgentCircuit.IPAddress;
1959 agent.Viewer = currentAgentCircuit.Viewer;
1960 agent.Channel = currentAgentCircuit.Channel;
1961 agent.Mac = currentAgentCircuit.Mac;
1962 agent.Id0 = currentAgentCircuit.Id0;
1963 }
1964 1968
1965 if (newRegions.Contains(neighbour.RegionHandle)) 1969 if (handler == currentRegionHandler)
1966 { 1970 continue;
1967 agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); 1971
1968 sp.AddNeighbourRegion(neighbour.RegionHandle, agent.CapsPath); 1972 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
1969 seeds.Add(neighbour.RegionHandle, agent.CapsPath); 1973 agent.BaseFolder = UUID.Zero;
1970 } 1974 agent.InventoryFolder = UUID.Zero;
1971 else 1975 agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour);
1972 { 1976 agent.child = true;
1973 agent.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, neighbour.RegionHandle); 1977 agent.Appearance = new AvatarAppearance();
1974 } 1978 agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight;
1979
1980 if (currentAgentCircuit != null)
1981 {
1982 agent.ServiceURLs = currentAgentCircuit.ServiceURLs;
1983 agent.IPAddress = currentAgentCircuit.IPAddress;
1984 agent.Viewer = currentAgentCircuit.Viewer;
1985 agent.Channel = currentAgentCircuit.Channel;
1986 agent.Mac = currentAgentCircuit.Mac;
1987 agent.Id0 = currentAgentCircuit.Id0;
1988 }
1975 1989
1976 cagents.Add(agent); 1990 if (previousRegionNeighbourHandles.Contains(handler))
1991 {
1992 previousRegionNeighbourHandles.Remove(handler);
1993 agent.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, handler);
1977 } 1994 }
1995 else
1996 {
1997 newneighbours.Add(handler);
1998 agent.CapsPath = CapsUtil.GetRandomCapsObjectPath();
1999 sp.AddNeighbourRegion(handler, agent.CapsPath);
2000 seeds.Add(handler, agent.CapsPath);
2001 }
2002
2003 cagents.Add(agent);
2004 }
2005
2006 //sp.DropOldNeighbours(previousRegionNeighbourHandles);
2007 foreach (ulong handle in previousRegionNeighbourHandles)
2008 {
2009 sp.RemoveNeighbourRegion(handle);
2010 Scene.CapsModule.DropChildSeed(sp.UUID, handle);
1978 } 2011 }
1979 2012
1980 /// Update all child agent with everyone's seeds 2013 /// Update all child agent with everyone's seeds
@@ -1987,34 +2020,23 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1987 { 2020 {
1988 sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds); 2021 sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds);
1989 } 2022 }
2023
1990 sp.KnownRegions = seeds; 2024 sp.KnownRegions = seeds;
1991 //avatar.Scene.DumpChildrenSeeds(avatar.UUID); 2025 //avatar.Scene.DumpChildrenSeeds(avatar.UUID);
1992 //avatar.DumpKnownRegions(); 2026 //avatar.DumpKnownRegions();
1993 2027
1994 bool newAgent = false; 2028 Util.FireAndForget(delegate
1995 int count = 0;
1996 foreach (GridRegion neighbour in neighbours)
1997 { 2029 {
1998 //m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName); 2030 Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start
1999 // Don't do it if there's already an agent in that region 2031 int count = 0;
2000 if (newRegions.Contains(neighbour.RegionHandle)) 2032 bool newagent;
2001 newAgent = true;
2002 else
2003 newAgent = false;
2004// continue;
2005 2033
2006 if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) 2034 foreach (GridRegion neighbour in neighbours)
2007 { 2035 {
2008 try 2036 try
2009 { 2037 {
2010 // Let's put this back at sync, so that it doesn't clog 2038 newagent = newneighbours.Contains(neighbour.RegionHandle);
2011 // the network, especially for regions in the same physical server. 2039 InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newagent);
2012 // We're really not in a hurry here.
2013 InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent);
2014 //InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
2015 //d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent,
2016 // InformClientOfNeighbourCompleted,
2017 // d);
2018 } 2040 }
2019 2041
2020 catch (ArgumentOutOfRangeException) 2042 catch (ArgumentOutOfRangeException)
@@ -2022,9 +2044,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2022 m_log.ErrorFormat( 2044 m_log.ErrorFormat(
2023 "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", 2045 "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).",
2024 neighbour.ExternalHostName, 2046 neighbour.ExternalHostName,
2025 neighbour.RegionHandle, 2047 neighbour.RegionHandle,
2026 neighbour.RegionLocX, 2048 neighbour.RegionLocX,
2027 neighbour.RegionLocY); 2049 neighbour.RegionLocY);
2028 } 2050 }
2029 catch (Exception e) 2051 catch (Exception e)
2030 { 2052 {
@@ -2041,11 +2063,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2041 2063
2042 // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. 2064 // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes.
2043 // throw e; 2065 // throw e;
2044
2045 } 2066 }
2067 count++;
2046 } 2068 }
2047 count++; 2069 });
2048 }
2049 } 2070 }
2050 2071
2051 Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) 2072 Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour)
@@ -2079,11 +2100,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2079 private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, 2100 private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg,
2080 IPEndPoint endPoint, bool newAgent) 2101 IPEndPoint endPoint, bool newAgent)
2081 { 2102 {
2082 // Let's wait just a little to give time to originating regions to catch up with closing child agents 2103 Scene scene = sp.Scene;
2083 // after a cross here 2104 if (!newAgent)
2084 Thread.Sleep(500); 2105 return;
2085
2086 Scene scene = sp.Scene;
2087 2106
2088 m_log.DebugFormat( 2107 m_log.DebugFormat(
2089 "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", 2108 "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})",
@@ -2097,6 +2116,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2097 2116
2098 if (regionAccepted && newAgent) 2117 if (regionAccepted && newAgent)
2099 { 2118 {
2119 // give time for createAgent to finish, since it is async and does grid services access
2120 Thread.Sleep(500);
2121
2100 if (m_eqModule != null) 2122 if (m_eqModule != null)
2101 { 2123 {
2102 #region IP Translation for NAT 2124 #region IP Translation for NAT
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 }
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 373ed41..f35ea92 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -58,6 +58,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
58 58
59 public ISceneAgent SceneAgent { get; set; } 59 public ISceneAgent SceneAgent { get; set; }
60 60
61 public int PingTimeMS { get { return 0; } }
62
61 private string m_username; 63 private string m_username;
62 private string m_nick; 64 private string m_nick;
63 65
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index c88ccc5..7002d75 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -81,6 +81,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
81 get { return m_scene; } 81 get { return m_scene; }
82 } 82 }
83 83
84 public int PingTimeMS { get { return 0; } }
85
84 public UUID OwnerID 86 public UUID OwnerID
85 { 87 {
86 get { return m_ownerID; } 88 get { return m_ownerID; }