diff options
Diffstat (limited to '')
13 files changed, 916 insertions, 622 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..06f1301 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 | ||
@@ -3824,47 +3838,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3824 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); | 3838 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); |
3825 | } | 3839 | } |
3826 | 3840 | ||
3827 | /// <summary> | 3841 | /* dont use this |
3828 | /// Requeue an EntityUpdate when it was not acknowledged by the client. | 3842 | udp packet resent must be done at udp level only |
3829 | /// We will update the priority and put it in the correct queue, merging update flags | 3843 | re map from a packet to original updates just doesnt work |
3830 | /// with any other updates that may be queued for the same entity. | ||
3831 | /// The original update time is used for the merged update. | ||
3832 | /// </summary> | ||
3833 | private void ResendPrimUpdate(EntityUpdate update) | ||
3834 | { | ||
3835 | // If the update exists in priority queue, it will be updated. | ||
3836 | // If it does not exist then it will be added with the current (rather than its original) priority | ||
3837 | uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); | ||
3838 | 3844 | ||
3839 | lock (m_entityUpdates.SyncRoot) | 3845 | /// <summary> |
3840 | m_entityUpdates.Enqueue(priority, update); | 3846 | /// Requeue an EntityUpdate when it was not acknowledged by the client. |
3841 | } | 3847 | /// We will update the priority and put it in the correct queue, merging update flags |
3848 | /// with any other updates that may be queued for the same entity. | ||
3849 | /// The original update time is used for the merged update. | ||
3850 | /// </summary> | ||
3851 | private void ResendPrimUpdate(EntityUpdate update) | ||
3852 | { | ||
3853 | // If the update exists in priority queue, it will be updated. | ||
3854 | // If it does not exist then it will be added with the current (rather than its original) priority | ||
3855 | uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); | ||
3842 | 3856 | ||
3843 | /// <summary> | 3857 | lock (m_entityUpdates.SyncRoot) |
3844 | /// Requeue a list of EntityUpdates when they were not acknowledged by the client. | 3858 | m_entityUpdates.Enqueue(priority, update); |
3845 | /// We will update the priority and put it in the correct queue, merging update flags | 3859 | } |
3846 | /// with any other updates that may be queued for the same entity. | ||
3847 | /// The original update time is used for the merged update. | ||
3848 | /// </summary> | ||
3849 | private void ResendPrimUpdates(List<EntityUpdate> updates, OutgoingPacket oPacket) | ||
3850 | { | ||
3851 | // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); | ||
3852 | 3860 | ||
3853 | // Remove the update packet from the list of packets waiting for acknowledgement | ||
3854 | // because we are requeuing the list of updates. They will be resent in new packets | ||
3855 | // with the most recent state and priority. | ||
3856 | m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); | ||
3857 | 3861 | ||
3858 | // Count this as a resent packet since we are going to requeue all of the updates contained in it | 3862 | /// <summary> |
3859 | Interlocked.Increment(ref m_udpClient.PacketsResent); | 3863 | /// Requeue a list of EntityUpdates when they were not acknowledged by the client. |
3864 | /// We will update the priority and put it in the correct queue, merging update flags | ||
3865 | /// with any other updates that may be queued for the same entity. | ||
3866 | /// The original update time is used for the merged update. | ||
3867 | /// </summary> | ||
3868 | private void ResendPrimUpdates(List<EntityUpdate> updates, OutgoingPacket oPacket) | ||
3869 | { | ||
3870 | // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); | ||
3860 | 3871 | ||
3861 | // We're not going to worry about interlock yet since its not currently critical that this total count | 3872 | // Remove the update packet from the list of packets waiting for acknowledgement |
3862 | // is 100% correct | 3873 | // because we are requeuing the list of updates. They will be resent in new packets |
3863 | m_udpServer.PacketsResentCount++; | 3874 | // with the most recent state and priority. |
3875 | m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); | ||
3864 | 3876 | ||
3865 | foreach (EntityUpdate update in updates) | 3877 | // Count this as a resent packet since we are going to requeue all of the updates contained in it |
3866 | ResendPrimUpdate(update); | 3878 | Interlocked.Increment(ref m_udpClient.PacketsResent); |
3867 | } | 3879 | |
3880 | // We're not going to worry about interlock yet since its not currently critical that this total count | ||
3881 | // is 100% correct | ||
3882 | m_udpServer.PacketsResentCount++; | ||
3883 | |||
3884 | foreach (EntityUpdate update in updates) | ||
3885 | ResendPrimUpdate(update); | ||
3886 | } | ||
3887 | */ | ||
3868 | 3888 | ||
3869 | // OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); | 3889 | // OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); |
3870 | // OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); | 3890 | // OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); |
@@ -3932,8 +3952,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3932 | 3952 | ||
3933 | if (part.ParentGroup.IsAttachment) | 3953 | if (part.ParentGroup.IsAttachment) |
3934 | { // Someone else's HUD, why are we getting these? | 3954 | { // Someone else's HUD, why are we getting these? |
3935 | if (part.ParentGroup.OwnerID != AgentId && | 3955 | if (part.ParentGroup.OwnerID != AgentId && part.ParentGroup.HasPrivateAttachmentPoint) |
3936 | part.ParentGroup.RootPart.Shape.State > 30 && part.ParentGroup.RootPart.Shape.State < 39) | ||
3937 | continue; | 3956 | continue; |
3938 | ScenePresence sp; | 3957 | ScenePresence sp; |
3939 | // Owner is not in the sim, don't update it to | 3958 | // Owner is not in the sim, don't update it to |
@@ -4184,12 +4203,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4184 | for (int i = 0; i < blocks.Count; i++) | 4203 | for (int i = 0; i < blocks.Count; i++) |
4185 | packet.ObjectData[i] = blocks[i]; | 4204 | packet.ObjectData[i] = blocks[i]; |
4186 | 4205 | ||
4187 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | 4206 | // OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); |
4207 | // use default udp retry | ||
4208 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4188 | } | 4209 | } |
4189 | 4210 | ||
4211 | |||
4212 | |||
4190 | #endregion Packet Sending | 4213 | #endregion Packet Sending |
4214 | |||
4191 | } | 4215 | } |
4192 | 4216 | ||
4217 | // hack.. dont use | ||
4218 | public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) | ||
4219 | { | ||
4220 | if (ent is SceneObjectPart) | ||
4221 | { | ||
4222 | SceneObjectPart part = (SceneObjectPart)ent; | ||
4223 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
4224 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
4225 | packet.RegionData.TimeDilation = 1; | ||
4226 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | ||
4227 | |||
4228 | ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId); | ||
4229 | if (parentID.HasValue) | ||
4230 | { | ||
4231 | blk.ParentID = parentID.Value; | ||
4232 | } | ||
4233 | |||
4234 | packet.ObjectData[0] = blk; | ||
4235 | |||
4236 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4237 | } | ||
4238 | } | ||
4239 | |||
4193 | public void ReprioritizeUpdates() | 4240 | public void ReprioritizeUpdates() |
4194 | { | 4241 | { |
4195 | lock (m_entityUpdates.SyncRoot) | 4242 | lock (m_entityUpdates.SyncRoot) |
@@ -5278,16 +5325,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5278 | 5325 | ||
5279 | byte[] objectData = new byte[76]; | 5326 | byte[] objectData = new byte[76]; |
5280 | 5327 | ||
5281 | data.CollisionPlane.ToBytes(objectData, 0); | ||
5282 | offsetPosition.ToBytes(objectData, 16); | ||
5283 | Vector3 velocity = new Vector3(0, 0, 0); | 5328 | Vector3 velocity = new Vector3(0, 0, 0); |
5284 | Vector3 acceleration = new Vector3(0, 0, 0); | 5329 | Vector3 acceleration = new Vector3(0, 0, 0); |
5330 | rotation.Normalize(); | ||
5331 | Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); | ||
5332 | |||
5333 | data.CollisionPlane.ToBytes(objectData, 0); | ||
5334 | offsetPosition.ToBytes(objectData, 16); | ||
5285 | velocity.ToBytes(objectData, 28); | 5335 | velocity.ToBytes(objectData, 28); |
5286 | acceleration.ToBytes(objectData, 40); | 5336 | acceleration.ToBytes(objectData, 40); |
5287 | // data.Velocity.ToBytes(objectData, 28); | 5337 | vrot.ToBytes(objectData, 52); |
5288 | // data.Acceleration.ToBytes(objectData, 40); | 5338 | data.AngularVelocity.ToBytes(objectData, 64); |
5289 | rotation.ToBytes(objectData, 52); | ||
5290 | //data.AngularVelocity.ToBytes(objectData, 64); | ||
5291 | 5339 | ||
5292 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | 5340 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); |
5293 | 5341 | ||
@@ -5343,15 +5391,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5343 | data.RelativePosition.ToBytes(objectData, 0); | 5391 | data.RelativePosition.ToBytes(objectData, 0); |
5344 | data.Velocity.ToBytes(objectData, 12); | 5392 | data.Velocity.ToBytes(objectData, 12); |
5345 | data.Acceleration.ToBytes(objectData, 24); | 5393 | data.Acceleration.ToBytes(objectData, 24); |
5346 | try | 5394 | |
5347 | { | 5395 | Quaternion rotation = data.RotationOffset; |
5348 | data.RotationOffset.ToBytes(objectData, 36); | 5396 | rotation.Normalize(); |
5349 | } | 5397 | Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); |
5350 | catch (Exception e) | 5398 | 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); | 5399 | data.AngularVelocity.ToBytes(objectData, 48); |
5356 | 5400 | ||
5357 | ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); | 5401 | 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..781fc40 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,10 +980,13 @@ 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); |
988 | |||
989 | sp.HasMovedAway(); | ||
978 | 990 | ||
979 | // Now let's make it officially a child agent | 991 | // Now let's make it officially a child agent |
980 | sp.MakeChildAgent(); | 992 | sp.MakeChildAgent(); |
@@ -1137,11 +1149,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1137 | // abandoned without proper close by viewer but then re-used by an incoming connection. | 1149 | // abandoned without proper close by viewer but then re-used by an incoming connection. |
1138 | sp.CloseChildAgents(newRegionX, newRegionY); | 1150 | sp.CloseChildAgents(newRegionX, newRegionY); |
1139 | 1151 | ||
1152 | sp.HasMovedAway(); | ||
1140 | // May need to logout or other cleanup | 1153 | // May need to logout or other cleanup |
1141 | AgentHasMovedAway(sp, logout); | 1154 | // AgentHasMovedAway(sp, logout); |
1155 | // AgentHasMovedAway(sp, true); | ||
1142 | 1156 | ||
1143 | // Well, this is it. The agent is over there. | 1157 | // Well, this is it. The agent is over there. |
1144 | KillEntity(sp.Scene, sp.LocalId); | 1158 | // KillEntity(sp.Scene, sp.LocalId); |
1145 | 1159 | ||
1146 | // Now let's make it officially a child agent | 1160 | // Now let's make it officially a child agent |
1147 | sp.MakeChildAgent(); | 1161 | sp.MakeChildAgent(); |
@@ -1253,7 +1267,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1253 | protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) | 1267 | protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) |
1254 | { | 1268 | { |
1255 | if (sp.Scene.AttachmentsModule != null) | 1269 | if (sp.Scene.AttachmentsModule != null) |
1256 | sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true); | 1270 | sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, logout); |
1257 | } | 1271 | } |
1258 | 1272 | ||
1259 | protected void KillEntity(Scene scene, uint localID) | 1273 | protected void KillEntity(Scene scene, uint localID) |
@@ -1381,10 +1395,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1381 | 1395 | ||
1382 | 1396 | ||
1383 | #region Agent Crossings | 1397 | #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) | 1398 | public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos) |
1386 | { | 1399 | { |
1400 | string r = String.Empty; | ||
1401 | return GetDestination(scene, agentID, pos, out xDest, out yDest, out version, out newpos, out r); | ||
1402 | } | ||
1403 | |||
1404 | public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos, out string reason) | ||
1405 | { | ||
1387 | version = String.Empty; | 1406 | version = String.Empty; |
1407 | reason = String.Empty; | ||
1388 | newpos = pos; | 1408 | newpos = pos; |
1389 | 1409 | ||
1390 | // m_log.DebugFormat( | 1410 | // m_log.DebugFormat( |
@@ -1498,8 +1518,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1498 | } | 1518 | } |
1499 | 1519 | ||
1500 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); | 1520 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); |
1501 | 1521 | ||
1502 | string reason; | ||
1503 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out reason)) | 1522 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out reason)) |
1504 | { | 1523 | { |
1505 | if (r == null) | 1524 | if (r == null) |
@@ -1525,11 +1544,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1525 | uint y; | 1544 | uint y; |
1526 | Vector3 newpos; | 1545 | Vector3 newpos; |
1527 | string version; | 1546 | string version; |
1547 | string reason; | ||
1528 | 1548 | ||
1529 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos); | 1549 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos, out reason); |
1530 | if (neighbourRegion == null) | 1550 | if (neighbourRegion == null) |
1531 | { | 1551 | { |
1532 | agent.ControllingClient.SendAlertMessage("Cannot region cross into void"); | 1552 | if (reason == String.Empty) |
1553 | agent.ControllingClient.SendAlertMessage("Cannot cross to region"); | ||
1554 | else | ||
1555 | agent.ControllingClient.SendAlertMessage("Cannot cross to region: " + reason); | ||
1533 | return false; | 1556 | return false; |
1534 | } | 1557 | } |
1535 | 1558 | ||
@@ -1656,10 +1679,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1656 | 1679 | ||
1657 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying) | 1680 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying) |
1658 | { | 1681 | { |
1682 | int ts = Util.EnvironmentTickCount(); | ||
1659 | try | 1683 | try |
1660 | { | 1684 | { |
1685 | |||
1661 | AgentData cAgent = new AgentData(); | 1686 | AgentData cAgent = new AgentData(); |
1662 | agent.CopyTo(cAgent); | 1687 | agent.CopyTo(cAgent); |
1688 | |||
1689 | // agent.Appearance.WearableCacheItems = null; | ||
1690 | |||
1663 | cAgent.Position = pos + agent.Velocity; | 1691 | cAgent.Position = pos + agent.Velocity; |
1664 | if (isFlying) | 1692 | if (isFlying) |
1665 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 1693 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
@@ -1686,6 +1714,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1686 | return false; | 1714 | return false; |
1687 | } | 1715 | } |
1688 | 1716 | ||
1717 | m_log.DebugFormat("[CrossAgentIntoNewRegionMain] ok, time {0}ms",Util.EnvironmentTickCountSubtract(ts)); | ||
1718 | |||
1689 | } | 1719 | } |
1690 | catch (Exception e) | 1720 | catch (Exception e) |
1691 | { | 1721 | { |
@@ -1703,6 +1733,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1703 | public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, | 1733 | public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, |
1704 | bool isFlying, string version) | 1734 | bool isFlying, string version) |
1705 | { | 1735 | { |
1736 | |||
1706 | agent.ControllingClient.RequestClientInfo(); | 1737 | agent.ControllingClient.RequestClientInfo(); |
1707 | 1738 | ||
1708 | string agentcaps; | 1739 | string agentcaps; |
@@ -1714,6 +1745,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1714 | } | 1745 | } |
1715 | 1746 | ||
1716 | // No turning back | 1747 | // No turning back |
1748 | |||
1749 | |||
1750 | |||
1717 | agent.IsChildAgent = true; | 1751 | agent.IsChildAgent = true; |
1718 | 1752 | ||
1719 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); | 1753 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); |
@@ -1737,12 +1771,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1737 | capsPath); | 1771 | capsPath); |
1738 | } | 1772 | } |
1739 | 1773 | ||
1774 | // Backwards compatibility. Best effort | ||
1775 | if (version == "Unknown" || version == string.Empty) | ||
1776 | { | ||
1777 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); | ||
1778 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback | ||
1779 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1780 | } | ||
1781 | |||
1740 | // SUCCESS! | 1782 | // SUCCESS! |
1741 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); | 1783 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); |
1742 | 1784 | ||
1743 | // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. | 1785 | // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. |
1744 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | 1786 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
1745 | 1787 | ||
1788 | // this may need the attachments | ||
1789 | agent.parcelRegionCross(); | ||
1790 | |||
1791 | AgentHasMovedAway(agent, true); | ||
1792 | |||
1746 | agent.MakeChildAgent(); | 1793 | agent.MakeChildAgent(); |
1747 | 1794 | ||
1748 | // FIXME: Possibly this should occur lower down after other commands to close other agents, | 1795 | // FIXME: Possibly this should occur lower down after other commands to close other agents, |
@@ -1756,16 +1803,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1756 | // agent.SendOtherAgentsAvatarDataToMe(); | 1803 | // agent.SendOtherAgentsAvatarDataToMe(); |
1757 | // agent.SendOtherAgentsAppearanceToMe(); | 1804 | // agent.SendOtherAgentsAppearanceToMe(); |
1758 | 1805 | ||
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. | 1806 | // Next, let's close the child agent connections that are too far away. |
1770 | uint neighbourx; | 1807 | uint neighbourx; |
1771 | uint neighboury; | 1808 | uint neighboury; |
@@ -1777,7 +1814,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1777 | 1814 | ||
1778 | agent.CloseChildAgents(neighbourx, neighboury); | 1815 | agent.CloseChildAgents(neighbourx, neighboury); |
1779 | 1816 | ||
1780 | AgentHasMovedAway(agent, false); | 1817 | |
1781 | 1818 | ||
1782 | // the user may change their profile information in other region, | 1819 | // the user may change their profile information in other region, |
1783 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 1820 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
@@ -1817,7 +1854,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1817 | #region Enable Child Agent | 1854 | #region Enable Child Agent |
1818 | 1855 | ||
1819 | /// <summary> | 1856 | /// <summary> |
1820 | /// This informs a single neighbouring region about agent "avatar". | 1857 | /// 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. | 1858 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
1822 | /// </summary> | 1859 | /// </summary> |
1823 | /// <param name="sp"></param> | 1860 | /// <param name="sp"></param> |
@@ -1833,8 +1870,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1833 | agent.startpos = new Vector3(128, 128, 70); | 1870 | agent.startpos = new Vector3(128, 128, 70); |
1834 | agent.child = true; | 1871 | agent.child = true; |
1835 | 1872 | ||
1836 | //agent.Appearance = sp.Appearance; | 1873 | agent.Appearance = new AvatarAppearance(); |
1837 | agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); // guess this should be a lot less | 1874 | agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; |
1838 | 1875 | ||
1839 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 1876 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
1840 | 1877 | ||
@@ -1866,6 +1903,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1866 | agent.Id0 = currentAgentCircuit.Id0; | 1903 | agent.Id0 = currentAgentCircuit.Id0; |
1867 | } | 1904 | } |
1868 | 1905 | ||
1906 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start | ||
1907 | |||
1869 | IPEndPoint external = region.ExternalEndPoint; | 1908 | IPEndPoint external = region.ExternalEndPoint; |
1870 | if (external != null) | 1909 | if (external != null) |
1871 | { | 1910 | { |
@@ -1884,6 +1923,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1884 | 1923 | ||
1885 | /// <summary> | 1924 | /// <summary> |
1886 | /// This informs all neighbouring regions about agent "avatar". | 1925 | /// This informs all neighbouring regions about agent "avatar". |
1926 | /// and as important informs the avatar about then | ||
1887 | /// </summary> | 1927 | /// </summary> |
1888 | /// <param name="sp"></param> | 1928 | /// <param name="sp"></param> |
1889 | public void EnableChildAgents(ScenePresence sp) | 1929 | public void EnableChildAgents(ScenePresence sp) |
@@ -1900,81 +1940,77 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1900 | m_log.Debug("[ENTITY TRANSFER MODULE]: m_regionInfo was null in EnableChildAgents, is this a NPC?"); | 1940 | m_log.Debug("[ENTITY TRANSFER MODULE]: m_regionInfo was null in EnableChildAgents, is this a NPC?"); |
1901 | } | 1941 | } |
1902 | 1942 | ||
1903 | /// We need to find the difference between the new regions where there are no child agents | 1943 | LinkedList<ulong> previousRegionNeighbourHandles; |
1904 | /// and the regions where there are already child agents. We only send notification to the former. | 1944 | |
1905 | List<ulong> neighbourHandles = NeighbourHandles(neighbours); // on this region | 1945 | Dictionary<ulong, string> seeds; |
1906 | neighbourHandles.Add(sp.Scene.RegionInfo.RegionHandle); // add this region too | ||
1907 | List<ulong> previousRegionNeighbourHandles; | ||
1908 | 1946 | ||
1909 | if (sp.Scene.CapsModule != null) | 1947 | if (sp.Scene.CapsModule != null) |
1910 | { | 1948 | { |
1911 | previousRegionNeighbourHandles = | 1949 | seeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); |
1912 | new List<ulong>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID).Keys); | 1950 | previousRegionNeighbourHandles = new LinkedList<ulong>(seeds.Keys); |
1913 | } | 1951 | } |
1914 | else | 1952 | else |
1915 | { | 1953 | { |
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>(); | 1954 | seeds = new Dictionary<ulong, string>(); |
1955 | previousRegionNeighbourHandles = new LinkedList<ulong>(); | ||
1956 | } | ||
1936 | 1957 | ||
1937 | //m_log.Debug(" !!! No. of seeds: " + seeds.Count); | ||
1938 | if (!seeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) | 1958 | if (!seeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) |
1939 | seeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); | 1959 | seeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); |
1940 | 1960 | ||
1941 | /// Create the necessary child agents | 1961 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
1962 | |||
1963 | List<ulong> newneighbours = new List<ulong>(); | ||
1942 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); | 1964 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); |
1965 | |||
1966 | ulong currentRegionHandler = sp.Scene.RegionInfo.RegionHandle; | ||
1967 | |||
1943 | foreach (GridRegion neighbour in neighbours) | 1968 | foreach (GridRegion neighbour in neighbours) |
1944 | { | 1969 | { |
1945 | if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) | 1970 | 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 | 1971 | ||
1965 | if (newRegions.Contains(neighbour.RegionHandle)) | 1972 | if (handler == currentRegionHandler) |
1966 | { | 1973 | continue; |
1967 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 1974 | |
1968 | sp.AddNeighbourRegion(neighbour.RegionHandle, agent.CapsPath); | 1975 | AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); |
1969 | seeds.Add(neighbour.RegionHandle, agent.CapsPath); | 1976 | agent.BaseFolder = UUID.Zero; |
1970 | } | 1977 | agent.InventoryFolder = UUID.Zero; |
1971 | else | 1978 | agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour); |
1972 | { | 1979 | agent.child = true; |
1973 | agent.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, neighbour.RegionHandle); | 1980 | agent.Appearance = new AvatarAppearance(); |
1974 | } | 1981 | agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; |
1982 | |||
1983 | if (currentAgentCircuit != null) | ||
1984 | { | ||
1985 | agent.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
1986 | agent.IPAddress = currentAgentCircuit.IPAddress; | ||
1987 | agent.Viewer = currentAgentCircuit.Viewer; | ||
1988 | agent.Channel = currentAgentCircuit.Channel; | ||
1989 | agent.Mac = currentAgentCircuit.Mac; | ||
1990 | agent.Id0 = currentAgentCircuit.Id0; | ||
1991 | } | ||
1975 | 1992 | ||
1976 | cagents.Add(agent); | 1993 | if (previousRegionNeighbourHandles.Contains(handler)) |
1994 | { | ||
1995 | previousRegionNeighbourHandles.Remove(handler); | ||
1996 | agent.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, handler); | ||
1977 | } | 1997 | } |
1998 | else | ||
1999 | { | ||
2000 | newneighbours.Add(handler); | ||
2001 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
2002 | sp.AddNeighbourRegion(handler, agent.CapsPath); | ||
2003 | seeds.Add(handler, agent.CapsPath); | ||
2004 | } | ||
2005 | |||
2006 | cagents.Add(agent); | ||
2007 | } | ||
2008 | |||
2009 | //sp.DropOldNeighbours(previousRegionNeighbourHandles); | ||
2010 | foreach (ulong handle in previousRegionNeighbourHandles) | ||
2011 | { | ||
2012 | sp.RemoveNeighbourRegion(handle); | ||
2013 | Scene.CapsModule.DropChildSeed(sp.UUID, handle); | ||
1978 | } | 2014 | } |
1979 | 2015 | ||
1980 | /// Update all child agent with everyone's seeds | 2016 | /// Update all child agent with everyone's seeds |
@@ -1987,34 +2023,23 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1987 | { | 2023 | { |
1988 | sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds); | 2024 | sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds); |
1989 | } | 2025 | } |
2026 | |||
1990 | sp.KnownRegions = seeds; | 2027 | sp.KnownRegions = seeds; |
1991 | //avatar.Scene.DumpChildrenSeeds(avatar.UUID); | 2028 | //avatar.Scene.DumpChildrenSeeds(avatar.UUID); |
1992 | //avatar.DumpKnownRegions(); | 2029 | //avatar.DumpKnownRegions(); |
1993 | 2030 | ||
1994 | bool newAgent = false; | 2031 | Util.FireAndForget(delegate |
1995 | int count = 0; | ||
1996 | foreach (GridRegion neighbour in neighbours) | ||
1997 | { | 2032 | { |
1998 | //m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName); | 2033 | 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 | 2034 | int count = 0; |
2000 | if (newRegions.Contains(neighbour.RegionHandle)) | 2035 | bool newagent; |
2001 | newAgent = true; | ||
2002 | else | ||
2003 | newAgent = false; | ||
2004 | // continue; | ||
2005 | 2036 | ||
2006 | if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) | 2037 | foreach (GridRegion neighbour in neighbours) |
2007 | { | 2038 | { |
2008 | try | 2039 | try |
2009 | { | 2040 | { |
2010 | // Let's put this back at sync, so that it doesn't clog | 2041 | newagent = newneighbours.Contains(neighbour.RegionHandle); |
2011 | // the network, especially for regions in the same physical server. | 2042 | 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 | } | 2043 | } |
2019 | 2044 | ||
2020 | catch (ArgumentOutOfRangeException) | 2045 | catch (ArgumentOutOfRangeException) |
@@ -2022,9 +2047,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2022 | m_log.ErrorFormat( | 2047 | 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}).", | 2048 | "[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, | 2049 | neighbour.ExternalHostName, |
2025 | neighbour.RegionHandle, | 2050 | neighbour.RegionHandle, |
2026 | neighbour.RegionLocX, | 2051 | neighbour.RegionLocX, |
2027 | neighbour.RegionLocY); | 2052 | neighbour.RegionLocY); |
2028 | } | 2053 | } |
2029 | catch (Exception e) | 2054 | catch (Exception e) |
2030 | { | 2055 | { |
@@ -2041,11 +2066,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2041 | 2066 | ||
2042 | // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. | 2067 | // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. |
2043 | // throw e; | 2068 | // throw e; |
2044 | |||
2045 | } | 2069 | } |
2070 | count++; | ||
2046 | } | 2071 | } |
2047 | count++; | 2072 | }); |
2048 | } | ||
2049 | } | 2073 | } |
2050 | 2074 | ||
2051 | Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) | 2075 | Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) |
@@ -2079,11 +2103,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2079 | private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, | 2103 | private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, |
2080 | IPEndPoint endPoint, bool newAgent) | 2104 | IPEndPoint endPoint, bool newAgent) |
2081 | { | 2105 | { |
2082 | // Let's wait just a little to give time to originating regions to catch up with closing child agents | 2106 | Scene scene = sp.Scene; |
2083 | // after a cross here | 2107 | if (!newAgent) |
2084 | Thread.Sleep(500); | 2108 | return; |
2085 | |||
2086 | Scene scene = sp.Scene; | ||
2087 | 2109 | ||
2088 | m_log.DebugFormat( | 2110 | m_log.DebugFormat( |
2089 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", | 2111 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", |
@@ -2097,6 +2119,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2097 | 2119 | ||
2098 | if (regionAccepted && newAgent) | 2120 | if (regionAccepted && newAgent) |
2099 | { | 2121 | { |
2122 | // give time for createAgent to finish, since it is async and does grid services access | ||
2123 | Thread.Sleep(500); | ||
2124 | |||
2100 | if (m_eqModule != null) | 2125 | if (m_eqModule != null) |
2101 | { | 2126 | { |
2102 | #region IP Translation for NAT | 2127 | #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..c0405ad 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 2; |
170 | 179 | ||
171 | if (entity is SceneObjectPart) | 180 | pqueue = ComputeDistancePriority(client, entity, false); |
172 | { | 181 | |
173 | // Attachments are high priority, | 182 | // Non physical prims are lower priority than physical prims |
174 | if (((SceneObjectPart)entity).ParentGroup.IsAttachment) | 183 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; |
175 | return 1; | 184 | if (physActor == null || !physActor.IsPhysical) |
176 | 185 | pqueue++; | |
177 | // Non physical prims are lower priority than physical prims | ||
178 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | ||
179 | if (physActor == null || !physActor.IsPhysical) | ||
180 | pqueue++; | ||
181 | } | ||
182 | } | 186 | } |
183 | } | 187 | } |
188 | else | ||
189 | pqueue = ComputeDistancePriority(client, entity, false); | ||
184 | 190 | ||
185 | return pqueue; | 191 | return pqueue; |
186 | } | 192 | } |
@@ -227,16 +233,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
227 | 233 | ||
228 | // And convert the distance to a priority queue, this computation gives queues | 234 | // And convert the distance to a priority queue, this computation gives queues |
229 | // at 10, 20, 40, 80, 160, 320, 640, and 1280m | 235 | // at 10, 20, 40, 80, 160, 320, 640, and 1280m |
230 | uint pqueue = PriorityQueue.NumberOfImmediateQueues; | 236 | uint pqueue = PriorityQueue.NumberOfImmediateQueues + 1; // reserve attachments queue |
231 | uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; | 237 | uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; |
232 | 238 | /* | |
233 | for (int i = 0; i < queues - 1; i++) | 239 | for (int i = 0; i < queues - 1; i++) |
234 | { | 240 | { |
235 | if (distance < 30 * Math.Pow(2.0,i)) | 241 | if (distance < 30 * Math.Pow(2.0,i)) |
236 | break; | 242 | break; |
237 | pqueue++; | 243 | pqueue++; |
238 | } | 244 | } |
239 | 245 | */ | |
246 | if (distance > 10f) | ||
247 | { | ||
248 | float tmp = (float)Math.Log((double)distance) * 1.4426950408889634073599246810019f - 3.3219280948873623478703194294894f; | ||
249 | // for a map identical to original: | ||
250 | // now | ||
251 | // 1st constant is 1/(log(2)) (natural log) so we get log2(distance) | ||
252 | // 2st constant makes it be log2(distance/10) | ||
253 | pqueue += (uint)tmp; | ||
254 | if (pqueue > queues - 1) | ||
255 | pqueue = queues - 1; | ||
256 | } | ||
257 | |||
240 | // If this is a root agent, then determine front & back | 258 | // If this is a root agent, then determine front & back |
241 | // Bump up the priority queue (drop the priority) for any objects behind the avatar | 259 | // Bump up the priority queue (drop the priority) for any objects behind the avatar |
242 | if (useFrontBack && ! presence.IsChildAgent) | 260 | if (useFrontBack && ! presence.IsChildAgent) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index dd0c828..f5be7a7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -295,6 +295,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
295 | 295 | ||
296 | return myID; | 296 | return myID; |
297 | } | 297 | } |
298 | |||
299 | public uint AllocatePresenceLocalId() | ||
300 | { | ||
301 | uint myID; | ||
302 | |||
303 | _primAllocateMutex.WaitOne(); | ||
304 | myID = ++m_lastAllocatedLocalId; | ||
305 | ++m_lastAllocatedLocalId; | ||
306 | _primAllocateMutex.ReleaseMutex(); | ||
307 | |||
308 | return myID; | ||
309 | } | ||
298 | 310 | ||
299 | #region Module Methods | 311 | #region Module Methods |
300 | 312 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 28758a9..dd5ee65 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2636,6 +2636,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2636 | m_rootPart.UpdateFlag = UpdateRequired.TERSE; | 2636 | m_rootPart.UpdateFlag = UpdateRequired.TERSE; |
2637 | } | 2637 | } |
2638 | 2638 | ||
2639 | if (IsAttachment) | ||
2640 | { | ||
2641 | ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar); | ||
2642 | if (sp != null) | ||
2643 | { | ||
2644 | sp.SendAttachmentScheduleUpdate(this); | ||
2645 | return; | ||
2646 | } | ||
2647 | } | ||
2648 | |||
2639 | SceneObjectPart[] parts = m_parts.GetArray(); | 2649 | SceneObjectPart[] parts = m_parts.GetArray(); |
2640 | for (int i = 0; i < parts.Length; i++) | 2650 | for (int i = 0; i < parts.Length; i++) |
2641 | { | 2651 | { |
@@ -2697,6 +2707,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2697 | return; | 2707 | return; |
2698 | 2708 | ||
2699 | // m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID); | 2709 | // m_log.DebugFormat("[SOG]: Sending immediate full group update for {0} {1}", Name, UUID); |
2710 | |||
2711 | if (IsAttachment) | ||
2712 | { | ||
2713 | ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar); | ||
2714 | if (sp != null) | ||
2715 | { | ||
2716 | sp.SendAttachmentUpdate(this,UpdateRequired.FULL); | ||
2717 | return; | ||
2718 | } | ||
2719 | } | ||
2700 | 2720 | ||
2701 | RootPart.SendFullUpdateToAllClients(); | 2721 | RootPart.SendFullUpdateToAllClients(); |
2702 | 2722 | ||
@@ -2720,6 +2740,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2720 | if (IsDeleted) | 2740 | if (IsDeleted) |
2721 | return; | 2741 | return; |
2722 | 2742 | ||
2743 | if (IsAttachment) | ||
2744 | { | ||
2745 | ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar); | ||
2746 | if (sp != null) | ||
2747 | { | ||
2748 | sp.SendAttachmentUpdate(RootPart, UpdateRequired.TERSE); | ||
2749 | return; | ||
2750 | } | ||
2751 | } | ||
2752 | |||
2723 | RootPart.SendTerseUpdateToAllClients(); | 2753 | RootPart.SendTerseUpdateToAllClients(); |
2724 | } | 2754 | } |
2725 | 2755 | ||
@@ -2739,6 +2769,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2739 | if (IsDeleted) | 2769 | if (IsDeleted) |
2740 | return; | 2770 | return; |
2741 | 2771 | ||
2772 | if (IsAttachment) | ||
2773 | { | ||
2774 | ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar); | ||
2775 | if (sp != null) | ||
2776 | { | ||
2777 | sp.SendAttachmentUpdate(this, UpdateRequired.TERSE); | ||
2778 | return; | ||
2779 | } | ||
2780 | } | ||
2781 | |||
2742 | SceneObjectPart[] parts = m_parts.GetArray(); | 2782 | SceneObjectPart[] parts = m_parts.GetArray(); |
2743 | for (int i = 0; i < parts.Length; i++) | 2783 | for (int i = 0; i < parts.Length; i++) |
2744 | parts[i].SendTerseUpdateToAllClients(); | 2784 | parts[i].SendTerseUpdateToAllClients(); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0f67d07..5bfc640 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -969,7 +969,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
969 | m_name = String.Format("{0} {1}", Firstname, Lastname); | 969 | m_name = String.Format("{0} {1}", Firstname, Lastname); |
970 | m_scene = world; | 970 | m_scene = world; |
971 | m_uuid = client.AgentId; | 971 | m_uuid = client.AgentId; |
972 | LocalId = m_scene.AllocateLocalId(); | 972 | LocalId = m_scene.AllocatePresenceLocalId(); |
973 | 973 | ||
974 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); | 974 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); |
975 | if (account != null) | 975 | if (account != null) |
@@ -1268,79 +1268,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1268 | 1268 | ||
1269 | m_scene.SwapRootAgentCount(false); | 1269 | m_scene.SwapRootAgentCount(false); |
1270 | 1270 | ||
1271 | // The initial login scene presence is already root when it gets here | ||
1272 | // and it has already rezzed the attachments and started their scripts. | ||
1273 | // We do the following only for non-login agents, because their scripts | ||
1274 | // haven't started yet. | ||
1275 | /* moved down | ||
1276 | if (PresenceType == PresenceType.Npc || (TeleportFlags & TeleportFlags.ViaLogin) != 0) | ||
1277 | { | ||
1278 | // Viewers which have a current outfit folder will actually rez their own attachments. However, | ||
1279 | // viewers without (e.g. v1 viewers) will not, so we still need to make this call. | ||
1280 | if (Scene.AttachmentsModule != null) | ||
1281 | Util.FireAndForget( | ||
1282 | o => | ||
1283 | { | ||
1284 | // if (PresenceType != PresenceType.Npc && Util.FireAndForgetMethod != FireAndForgetMethod.None) | ||
1285 | // System.Threading.Thread.Sleep(7000); | ||
1286 | |||
1287 | Scene.AttachmentsModule.RezAttachments(this); | ||
1288 | }); | ||
1289 | } | ||
1290 | else | ||
1291 | |||
1292 | { | ||
1293 | // We need to restart scripts here so that they receive the correct changed events (CHANGED_TELEPORT | ||
1294 | // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently | ||
1295 | // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are | ||
1296 | // not transporting the required data. | ||
1297 | // | ||
1298 | // We need to restart scripts here so that they receive the correct changed events (CHANGED_TELEPORT | ||
1299 | // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently | ||
1300 | // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are | ||
1301 | // not transporting the required data. | ||
1302 | // | ||
1303 | // We must take a copy of the attachments list here (rather than locking) to avoid a deadlock where a script in one of | ||
1304 | // the attachments may start processing an event (which locks ScriptInstance.m_Script) that then calls a method here | ||
1305 | // which needs to lock m_attachments. ResumeScripts() needs to take a ScriptInstance.m_Script lock to try to unset the Suspend status. | ||
1306 | // | ||
1307 | // FIXME: In theory, this deadlock should not arise since scripts should not be processing events until ResumeScripts(). | ||
1308 | // But XEngine starts all scripts unsuspended. Starting them suspended will not currently work because script rezzing | ||
1309 | // is placed in an asynchronous queue in XEngine and so the ResumeScripts() call will almost certainly execute before the | ||
1310 | // script is rezzed. This means the ResumeScripts() does absolutely nothing when using XEngine. | ||
1311 | // | ||
1312 | // One cannot simply iterate over attachments in a fire and forget thread because this would no longer | ||
1313 | // be locked, allowing race conditions if other code changes the attachments list. | ||
1314 | |||
1315 | List<SceneObjectGroup> attachments = GetAttachments(); | ||
1316 | |||
1317 | if (attachments.Count > 0) | ||
1318 | { | ||
1319 | m_log.DebugFormat( | ||
1320 | "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); | ||
1321 | |||
1322 | // Resume scripts this possible should also be moved down after sending the avatar to viewer ? | ||
1323 | foreach (SceneObjectGroup sog in attachments) | ||
1324 | { | ||
1325 | // sending attachments before the avatar ? | ||
1326 | // moved to completemovement where it already was | ||
1327 | // sog.ScheduleGroupForFullUpdate(); | ||
1328 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); | ||
1329 | sog.ResumeScripts(); | ||
1330 | } | ||
1331 | } | ||
1332 | } | ||
1333 | */ | ||
1334 | /* | ||
1335 | SendAvatarDataToAllAgents(); | ||
1336 | |||
1337 | // send the animations of the other presences to me | ||
1338 | m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) | ||
1339 | { | ||
1340 | if (presence != this) | ||
1341 | presence.Animator.SendAnimPackToClient(ControllingClient); | ||
1342 | }); | ||
1343 | */ | ||
1344 | 1271 | ||
1345 | // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will | 1272 | // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will |
1346 | // stall on the border crossing since the existing child agent will still have the last movement | 1273 | // stall on the border crossing since the existing child agent will still have the last movement |
@@ -1400,7 +1327,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1400 | else | 1327 | else |
1401 | Animator.ResetAnimations(); | 1328 | Animator.ResetAnimations(); |
1402 | 1329 | ||
1403 | 1330 | ||
1404 | // m_log.DebugFormat( | 1331 | // m_log.DebugFormat( |
1405 | // "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", | 1332 | // "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", |
1406 | // Name, UUID, m_scene.RegionInfo.RegionName); | 1333 | // Name, UUID, m_scene.RegionInfo.RegionName); |
@@ -1754,7 +1681,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1754 | /// </param> | 1681 | /// </param> |
1755 | public void CompleteMovement(IClientAPI client, bool openChildAgents) | 1682 | public void CompleteMovement(IClientAPI client, bool openChildAgents) |
1756 | { | 1683 | { |
1757 | // DateTime startTime = DateTime.Now; | 1684 | int ts = Util.EnvironmentTickCount(); |
1758 | 1685 | ||
1759 | m_log.InfoFormat( | 1686 | m_log.InfoFormat( |
1760 | "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}", | 1687 | "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}", |
@@ -1767,6 +1694,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 | 1694 | // 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) | 1695 | if (!isNPC && (m_teleportFlags & TeleportFlags.ViaLogin) == 0) |
1769 | { | 1696 | { |
1697 | |||
1770 | // Let's wait until UpdateAgent (called by departing region) is done | 1698 | // Let's wait until UpdateAgent (called by departing region) is done |
1771 | if (!WaitForUpdateAgent(client)) | 1699 | if (!WaitForUpdateAgent(client)) |
1772 | // The sending region never sent the UpdateAgent data, we have to refuse | 1700 | // The sending region never sent the UpdateAgent data, we have to refuse |
@@ -1786,6 +1714,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1786 | AbsolutePosition = pos; | 1714 | AbsolutePosition = pos; |
1787 | } | 1715 | } |
1788 | */ | 1716 | */ |
1717 | |||
1718 | m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
1719 | |||
1789 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1720 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1790 | if (!MakeRootAgent(AbsolutePosition, flying)) | 1721 | if (!MakeRootAgent(AbsolutePosition, flying)) |
1791 | { | 1722 | { |
@@ -1796,6 +1727,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1796 | return; | 1727 | return; |
1797 | } | 1728 | } |
1798 | 1729 | ||
1730 | m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
1731 | |||
1799 | Vector3 look = Lookat; | 1732 | Vector3 look = Lookat; |
1800 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01)) | 1733 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01)) |
1801 | { | 1734 | { |
@@ -1806,6 +1739,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1806 | look = new Vector3(0.99f, 0.042f, 0); | 1739 | look = new Vector3(0.99f, 0.042f, 0); |
1807 | } | 1740 | } |
1808 | 1741 | ||
1742 | if (!IsChildAgent) | ||
1743 | { | ||
1744 | InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (AssetType)46); | ||
1745 | if (cof == null) | ||
1746 | COF = UUID.Zero; | ||
1747 | else | ||
1748 | COF = cof.ID; | ||
1749 | |||
1750 | m_log.DebugFormat("[ScenePresence]: CompleteMovement COF for {0} is {1}", client.AgentId, COF); | ||
1751 | } | ||
1752 | |||
1809 | // Tell the client that we're totally ready | 1753 | // Tell the client that we're totally ready |
1810 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | 1754 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); |
1811 | 1755 | ||
@@ -1816,6 +1760,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1816 | 1760 | ||
1817 | // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); | 1761 | // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); |
1818 | 1762 | ||
1763 | m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
1764 | |||
1819 | if (!string.IsNullOrEmpty(m_callbackURI)) | 1765 | if (!string.IsNullOrEmpty(m_callbackURI)) |
1820 | { | 1766 | { |
1821 | // We cannot sleep here since this would hold up the inbound packet processing thread, as | 1767 | // We cannot sleep here since this would hold up the inbound packet processing thread, as |
@@ -1844,6 +1790,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1844 | // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); | 1790 | // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); |
1845 | // } | 1791 | // } |
1846 | 1792 | ||
1793 | m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
1794 | |||
1847 | m_previusParcelHide = false; | 1795 | m_previusParcelHide = false; |
1848 | m_previusParcelUUID = UUID.Zero; | 1796 | m_previusParcelUUID = UUID.Zero; |
1849 | m_currentParcelHide = false; | 1797 | m_currentParcelHide = false; |
@@ -1856,15 +1804,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1856 | 1804 | ||
1857 | if (!IsChildAgent) | 1805 | if (!IsChildAgent) |
1858 | { | 1806 | { |
1859 | newhide = m_currentParcelHide; | ||
1860 | m_currentParcelHide = false; | ||
1861 | |||
1862 | // take this region out of children Neighbours list | ||
1863 | // possible should be done elsewhere | ||
1864 | DropThisRootRegionFromNeighbours(); | ||
1865 | 1807 | ||
1866 | ValidateAndSendAppearanceAndAgentData(); | 1808 | ValidateAndSendAppearanceAndAgentData(); |
1867 | 1809 | ||
1810 | m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
1811 | |||
1868 | // attachments | 1812 | // attachments |
1869 | if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) | 1813 | if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) |
1870 | { | 1814 | { |
@@ -1877,23 +1821,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
1877 | } | 1821 | } |
1878 | else | 1822 | else |
1879 | { | 1823 | { |
1880 | List<SceneObjectGroup> attachments = GetAttachments(); | 1824 | if (m_attachments.Count > 0) |
1881 | |||
1882 | if (attachments.Count > 0) | ||
1883 | { | 1825 | { |
1884 | m_log.DebugFormat( | 1826 | m_log.DebugFormat( |
1885 | "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); | 1827 | "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); |
1886 | 1828 | ||
1887 | // Resume scripts this possible should also be moved down after sending the avatar to viewer ? | 1829 | // Resume scripts this possible should also be moved down after sending the avatar to viewer ? |
1888 | foreach (SceneObjectGroup sog in attachments) | 1830 | foreach (SceneObjectGroup sog in m_attachments) |
1889 | { | 1831 | { |
1890 | sog.ScheduleGroupForFullUpdate(); | 1832 | sog.SendFullUpdateToClient(ControllingClient); |
1833 | SendFullUpdateToClient(ControllingClient); | ||
1834 | |||
1835 | if (!sog.HasPrivateAttachmentPoint) | ||
1836 | { | ||
1837 | // sog.ScheduleGroupForFullUpdate(); | ||
1838 | m_scene.ForEachScenePresence(delegate(ScenePresence p) | ||
1839 | { | ||
1840 | if (p == this) | ||
1841 | return; | ||
1842 | |||
1843 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | ||
1844 | return; | ||
1845 | |||
1846 | sog.SendFullUpdateToClient(p.ControllingClient); | ||
1847 | SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path | ||
1848 | }); | ||
1849 | } | ||
1891 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); | 1850 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); |
1892 | sog.ResumeScripts(); | 1851 | sog.ResumeScripts(); |
1893 | } | 1852 | } |
1894 | } | 1853 | } |
1895 | } | 1854 | } |
1896 | 1855 | ||
1856 | m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
1857 | |||
1897 | // Create child agents in neighbouring regions | 1858 | // Create child agents in neighbouring regions |
1898 | if (openChildAgents) | 1859 | if (openChildAgents) |
1899 | { | 1860 | { |
@@ -1903,10 +1864,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1903 | } | 1864 | } |
1904 | } | 1865 | } |
1905 | 1866 | ||
1867 | m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
1868 | |||
1906 | // send the rest of the world | 1869 | // send the rest of the world |
1907 | if (m_teleportFlags > 0 && !isNPC) | 1870 | if (m_teleportFlags > 0 && !isNPC || m_currentParcelHide) |
1908 | SendInitialDataToMe(); | 1871 | SendInitialDataToMe(); |
1909 | 1872 | ||
1873 | m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
1874 | |||
1910 | if (!IsChildAgent) | 1875 | if (!IsChildAgent) |
1911 | { | 1876 | { |
1912 | // moved from makeroot missing in sendInitialDataToMe | 1877 | // moved from makeroot missing in sendInitialDataToMe |
@@ -1923,6 +1888,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1923 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | 1888 | IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
1924 | if (friendsModule != null) | 1889 | if (friendsModule != null) |
1925 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | 1890 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); |
1891 | |||
1892 | m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
1926 | } | 1893 | } |
1927 | } | 1894 | } |
1928 | } | 1895 | } |
@@ -1931,11 +1898,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1931 | m_inTransit = false; | 1898 | m_inTransit = false; |
1932 | } | 1899 | } |
1933 | // if hide force a check | 1900 | // if hide force a check |
1934 | if (!IsChildAgent && newhide) | 1901 | // if (!IsChildAgent && newhide) |
1935 | { | 1902 | // { |
1936 | ParcelLoginCheck(m_currentParcelUUID); | 1903 | // ParcelLoginCheck(m_currentParcelUUID); |
1937 | m_currentParcelHide = newhide; | 1904 | // m_currentParcelHide = newhide; |
1938 | } | 1905 | // } |
1906 | |||
1907 | m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | ||
1939 | } | 1908 | } |
1940 | 1909 | ||
1941 | /// <summary> | 1910 | /// <summary> |
@@ -2776,34 +2745,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2776 | 2745 | ||
2777 | if (satOnObject) | 2746 | if (satOnObject) |
2778 | { | 2747 | { |
2779 | // SendAvatarDataToAllAgents(); | ||
2780 | m_requestedSitTargetID = 0; | 2748 | m_requestedSitTargetID = 0; |
2781 | |||
2782 | part.RemoveSittingAvatar(UUID); | 2749 | part.RemoveSittingAvatar(UUID); |
2783 | |||
2784 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 2750 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
2785 | } | ||
2786 | 2751 | ||
2787 | else if (PhysicsActor == null) | 2752 | SendAvatarDataToAllAgents(); |
2788 | AddToPhysicalScene(false); | 2753 | } |
2789 | 2754 | ||
2790 | Animator.TrySetMovementAnimation("STAND"); | 2755 | Animator.TrySetMovementAnimation("STAND"); |
2791 | 2756 | ||
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(); | 2757 | TriggerScenePresenceUpdated(); |
2808 | } | 2758 | } |
2809 | 2759 | ||
@@ -3078,11 +3028,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3078 | 3028 | ||
3079 | ParentPart = part; | 3029 | ParentPart = part; |
3080 | ParentID = part.LocalId; | 3030 | ParentID = part.LocalId; |
3031 | |||
3032 | SendAvatarDataToAllAgents(); | ||
3033 | |||
3081 | if(status == 3) | 3034 | if(status == 3) |
3082 | Animator.TrySetMovementAnimation("SIT_GROUND"); | 3035 | Animator.TrySetMovementAnimation("SIT_GROUND"); |
3083 | else | 3036 | else |
3084 | Animator.TrySetMovementAnimation("SIT"); | 3037 | Animator.TrySetMovementAnimation("SIT"); |
3085 | SendAvatarDataToAllAgents(); | 3038 | |
3086 | 3039 | ||
3087 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 3040 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
3088 | } | 3041 | } |
@@ -3182,13 +3135,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3182 | Velocity = Vector3.Zero; | 3135 | Velocity = Vector3.Zero; |
3183 | RemoveFromPhysicalScene(); | 3136 | RemoveFromPhysicalScene(); |
3184 | 3137 | ||
3138 | SendAvatarDataToAllAgents(); | ||
3139 | |||
3185 | String sitAnimation = "SIT"; | 3140 | String sitAnimation = "SIT"; |
3186 | if (!String.IsNullOrEmpty(part.SitAnimation)) | 3141 | if (!String.IsNullOrEmpty(part.SitAnimation)) |
3187 | { | 3142 | { |
3188 | sitAnimation = part.SitAnimation; | 3143 | sitAnimation = part.SitAnimation; |
3189 | } | 3144 | } |
3190 | Animator.TrySetMovementAnimation(sitAnimation); | 3145 | Animator.TrySetMovementAnimation(sitAnimation); |
3191 | SendAvatarDataToAllAgents(); | ||
3192 | TriggerScenePresenceUpdated(); | 3146 | TriggerScenePresenceUpdated(); |
3193 | } | 3147 | } |
3194 | } | 3148 | } |
@@ -3349,8 +3303,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
3349 | 3303 | ||
3350 | #region Update Client(s) | 3304 | #region Update Client(s) |
3351 | 3305 | ||
3306 | public void SendUpdateToAgent(ScenePresence p) | ||
3307 | { | ||
3308 | IClientAPI remoteClient = p.ControllingClient; | ||
3309 | |||
3310 | if (remoteClient.IsActive) | ||
3311 | { | ||
3312 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); | ||
3313 | remoteClient.SendEntityUpdate(this, PrimUpdateFlags.FullUpdate); | ||
3314 | m_scene.StatsReporter.AddAgentUpdates(1); | ||
3315 | } | ||
3316 | } | ||
3317 | |||
3318 | public void SendFullUpdateToClient(IClientAPI remoteClient) | ||
3319 | { | ||
3320 | if (remoteClient.IsActive) | ||
3321 | { | ||
3322 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); | ||
3323 | remoteClient.SendEntityUpdate(this, PrimUpdateFlags.FullUpdate); | ||
3324 | m_scene.StatsReporter.AddAgentUpdates(1); | ||
3325 | } | ||
3326 | } | ||
3327 | |||
3352 | // this is diferente from SendTerseUpdateToClient | 3328 | // this is diferente from SendTerseUpdateToClient |
3353 | // this sends bypassing ententies updates | 3329 | // this sends bypassing entities updates |
3354 | public void SendAgentTerseUpdate(ISceneEntity p) | 3330 | public void SendAgentTerseUpdate(ISceneEntity p) |
3355 | { | 3331 | { |
3356 | ControllingClient.SendAgentTerseUpdate(p); | 3332 | ControllingClient.SendAgentTerseUpdate(p); |
@@ -3377,7 +3353,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3377 | } | 3353 | } |
3378 | } | 3354 | } |
3379 | 3355 | ||
3380 | public void SendTerseUpdateToAgentClient(ScenePresence p) | 3356 | public void SendTerseUpdateToAgent(ScenePresence p) |
3381 | { | 3357 | { |
3382 | IClientAPI remoteClient = p.ControllingClient; | 3358 | IClientAPI remoteClient = p.ControllingClient; |
3383 | 3359 | ||
@@ -3396,6 +3372,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3396 | m_scene.StatsReporter.AddAgentUpdates(1); | 3372 | m_scene.StatsReporter.AddAgentUpdates(1); |
3397 | } | 3373 | } |
3398 | 3374 | ||
3375 | public void SendTerseUpdateToAgentNF(ScenePresence p) | ||
3376 | { | ||
3377 | IClientAPI remoteClient = p.ControllingClient; | ||
3378 | if (remoteClient.IsActive) | ||
3379 | { | ||
3380 | //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); | ||
3381 | remoteClient.SendEntityUpdate(this, PrimUpdateFlags.FullUpdate); | ||
3382 | m_scene.StatsReporter.AddAgentUpdates(1); | ||
3383 | } | ||
3384 | } | ||
3385 | |||
3386 | |||
3399 | // vars to support reduced update frequency when velocity is unchanged | 3387 | // vars to support reduced update frequency when velocity is unchanged |
3400 | private Vector3 lastVelocitySentToAllClients = Vector3.Zero; | 3388 | private Vector3 lastVelocitySentToAllClients = Vector3.Zero; |
3401 | private Vector3 lastPositionSentToAllClients = Vector3.Zero; | 3389 | private Vector3 lastPositionSentToAllClients = Vector3.Zero; |
@@ -3437,7 +3425,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3437 | 3425 | ||
3438 | // Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); | 3426 | // Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); |
3439 | // m_scene.ForEachClient(SendTerseUpdateToClient); | 3427 | // m_scene.ForEachClient(SendTerseUpdateToClient); |
3440 | m_scene.ForEachScenePresence(SendTerseUpdateToAgentClient); | 3428 | m_scene.ForEachScenePresence(SendTerseUpdateToAgent); |
3441 | } | 3429 | } |
3442 | TriggerScenePresenceUpdated(); | 3430 | TriggerScenePresenceUpdated(); |
3443 | } | 3431 | } |
@@ -3478,16 +3466,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3478 | landch.sendClientInitialLandInfo(ControllingClient); | 3466 | landch.sendClientInitialLandInfo(ControllingClient); |
3479 | } | 3467 | } |
3480 | } | 3468 | } |
3481 | SendOtherAgentsAvatarDataToMe(); | ||
3482 | SendOtherAgentsAppearanceToMe(); | ||
3483 | 3469 | ||
3470 | SendOtherAgentsAvatarFullToMe(); | ||
3484 | EntityBase[] entities = Scene.Entities.GetEntities(); | 3471 | EntityBase[] entities = Scene.Entities.GetEntities(); |
3485 | foreach (EntityBase e in entities) | 3472 | foreach (EntityBase e in entities) |
3486 | { | 3473 | { |
3487 | if (e != null && e is SceneObjectGroup) | 3474 | if (e != null && e is SceneObjectGroup) |
3488 | ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); | 3475 | ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); |
3489 | } | 3476 | } |
3490 | |||
3491 | }); | 3477 | }); |
3492 | } | 3478 | } |
3493 | 3479 | ||
@@ -3508,40 +3494,56 @@ namespace OpenSim.Region.Framework.Scenes | |||
3508 | // to see if all the baked textures are already here. | 3494 | // to see if all the baked textures are already here. |
3509 | if (m_scene.AvatarFactory != null) | 3495 | if (m_scene.AvatarFactory != null) |
3510 | cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(this); | 3496 | cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(this); |
3511 | 3497 | ||
3512 | // If we aren't using a cached appearance, then clear out the baked textures | 3498 | // If we aren't using a cached appearance, then clear out the baked textures |
3513 | if (!cachedappearance) | 3499 | if (!cachedappearance) |
3514 | { | 3500 | { |
3515 | // Appearance.ResetAppearance(); | ||
3516 | // save what ???? | ||
3517 | // maybe needed so the tryretry repair works? | ||
3518 | if (m_scene.AvatarFactory != null) | 3501 | if (m_scene.AvatarFactory != null) |
3519 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); | 3502 | m_scene.AvatarFactory.QueueAppearanceSave(UUID); |
3520 | } | 3503 | } |
3521 | 3504 | ||
3505 | bool newhide = m_currentParcelHide; | ||
3506 | m_currentParcelHide = false; | ||
3522 | 3507 | ||
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(); | 3508 | SendAvatarDataToAllAgents(); |
3528 | 3509 | ||
3529 | // This invocation always shows up in the viewer logs as an error. Is it needed? | 3510 | if (newhide) |
3530 | // send all information we have | 3511 | { |
3531 | // possible not needed since viewer should ask about it | 3512 | ParcelLoginCheck(m_currentParcelUUID); |
3532 | // least it all ask for baked | 3513 | m_currentParcelHide = true; |
3514 | } | ||
3515 | |||
3533 | SendAppearanceToAgent(this); | 3516 | SendAppearanceToAgent(this); |
3534 | 3517 | ||
3535 | // If we are using the the cached appearance then send it out to everyone | 3518 | m_inTransit = false; |
3536 | // send even grays | 3519 | |
3537 | if (cachedappearance) | 3520 | SendAppearanceToAllOtherAgents(); |
3521 | |||
3522 | if(Animator!= null) | ||
3523 | Animator.SendAnimPack(); | ||
3524 | } | ||
3525 | |||
3526 | /// <summary> | ||
3527 | /// Send avatar full data appearance and animations for all other root agents to this agent, this agent | ||
3528 | /// can be either a child or root | ||
3529 | /// </summary> | ||
3530 | public void SendOtherAgentsAvatarFullToMe() | ||
3531 | { | ||
3532 | int count = 0; | ||
3533 | m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) | ||
3538 | { | 3534 | { |
3539 | // m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name); | 3535 | // only send information about other root agents |
3540 | // If the avatars baked textures are all in the cache, then we have a | 3536 | if (scenePresence.UUID == UUID) |
3541 | // complete appearance... send it out, if not, then we'll send it when | 3537 | return; |
3542 | // the avatar finishes updating its appearance | 3538 | |
3543 | SendAppearanceToAllOtherAgents(); | 3539 | scenePresence.SendAvatarDataToAgent(this); |
3544 | } | 3540 | scenePresence.SendAppearanceToAgent(this); |
3541 | scenePresence.SendAnimPackToAgent(this); | ||
3542 | // for now attachments are sent with all SOG | ||
3543 | count++; | ||
3544 | }); | ||
3545 | |||
3546 | m_scene.StatsReporter.AddAgentUpdates(count); | ||
3545 | } | 3547 | } |
3546 | 3548 | ||
3547 | /// <summary> | 3549 | /// <summary> |
@@ -3566,33 +3568,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3566 | 3568 | ||
3567 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 3569 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
3568 | { | 3570 | { |
3569 | SendAvatarDataToAgent(scenePresence); | 3571 | SendAvatarDataToAgent(scenePresence); |
3570 | count++; | 3572 | count++; |
3571 | }); | 3573 | }); |
3572 | 3574 | ||
3573 | m_scene.StatsReporter.AddAgentUpdates(count); | 3575 | m_scene.StatsReporter.AddAgentUpdates(count); |
3574 | } | 3576 | } |
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 | 3577 | ||
3597 | /// <summary> | 3578 | /// <summary> |
3598 | /// Send avatar data to an agent. | 3579 | /// Send avatar data to an agent. |
@@ -3604,7 +3585,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3604 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) | 3585 | if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) |
3605 | return; | 3586 | return; |
3606 | avatar.ControllingClient.SendAvatarDataImmediate(this); | 3587 | avatar.ControllingClient.SendAvatarDataImmediate(this); |
3607 | Animator.SendAnimPackToClient(avatar.ControllingClient); | 3588 | } |
3589 | |||
3590 | public void SendAvatarDataToAgentNF(ScenePresence avatar) | ||
3591 | { | ||
3592 | avatar.ControllingClient.SendAvatarDataImmediate(this); | ||
3608 | } | 3593 | } |
3609 | 3594 | ||
3610 | /// <summary> | 3595 | /// <summary> |
@@ -3639,28 +3624,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3639 | } | 3624 | } |
3640 | 3625 | ||
3641 | /// <summary> | 3626 | /// <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. | 3627 | /// Send appearance data to an agent. |
3665 | /// </summary> | 3628 | /// </summary> |
3666 | /// <param name="avatar"></param> | 3629 | /// <param name="avatar"></param> |
@@ -3674,6 +3637,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
3674 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); | 3637 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); |
3675 | } | 3638 | } |
3676 | 3639 | ||
3640 | public void SendAnimPackToAgent(ScenePresence p) | ||
3641 | { | ||
3642 | if (IsChildAgent || Animator == null) | ||
3643 | return; | ||
3644 | |||
3645 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | ||
3646 | return; | ||
3647 | |||
3648 | Animator.SendAnimPackToClient(p.ControllingClient); | ||
3649 | } | ||
3650 | |||
3651 | public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs) | ||
3652 | { | ||
3653 | if (IsChildAgent) | ||
3654 | return; | ||
3655 | |||
3656 | m_scene.ForEachScenePresence(delegate(ScenePresence p) | ||
3657 | { | ||
3658 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | ||
3659 | return; | ||
3660 | p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); | ||
3661 | }); | ||
3662 | } | ||
3663 | |||
3677 | #endregion | 3664 | #endregion |
3678 | 3665 | ||
3679 | #region Significant Movement Method | 3666 | #region Significant Movement Method |
@@ -4072,19 +4059,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4072 | cAgent.Far = DrawDistance; | 4059 | cAgent.Far = DrawDistance; |
4073 | 4060 | ||
4074 | // Throttles | 4061 | // Throttles |
4075 | float multiplier = 1; | 4062 | cAgent.Throttles = ControllingClient.GetThrottlesPacked(1); |
4076 | |||
4077 | /* this is also used to send to new main regions not children | ||
4078 | |||
4079 | int childRegions = KnownRegionCount; | ||
4080 | if (childRegions != 0) | ||
4081 | multiplier = 1f / childRegions; | ||
4082 | |||
4083 | // Minimum throttle for a child region is 1/4 of the root region throttle | ||
4084 | if (multiplier <= 0.25f) | ||
4085 | multiplier = 0.25f; | ||
4086 | */ | ||
4087 | cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier); | ||
4088 | 4063 | ||
4089 | cAgent.HeadRotation = m_headrotation; | 4064 | cAgent.HeadRotation = m_headrotation; |
4090 | cAgent.BodyRotation = Rotation; | 4065 | cAgent.BodyRotation = Rotation; |
@@ -4193,13 +4168,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4193 | } | 4168 | } |
4194 | catch { } | 4169 | catch { } |
4195 | 4170 | ||
4171 | Animator.ResetAnimations(); | ||
4172 | |||
4196 | // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? | 4173 | // 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) | 4174 | if (cAgent.DefaultAnim != null) |
4200 | Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero); | 4175 | Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero); |
4201 | if (cAgent.AnimState != null) | 4176 | if (cAgent.AnimState != null) |
4202 | Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero); | 4177 | Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero); |
4178 | if (cAgent.Anims != null) | ||
4179 | Animator.Animations.FromArray(cAgent.Anims); | ||
4203 | 4180 | ||
4204 | if (Scene.AttachmentsModule != null) | 4181 | if (Scene.AttachmentsModule != null) |
4205 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); | 4182 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); |
@@ -4653,15 +4630,245 @@ namespace OpenSim.Region.Framework.Scenes | |||
4653 | return validated; | 4630 | return validated; |
4654 | } | 4631 | } |
4655 | 4632 | ||
4633 | public void SendAttachmentsToAllAgents() | ||
4634 | { | ||
4635 | lock (m_attachments) | ||
4636 | { | ||
4637 | foreach (SceneObjectGroup sog in m_attachments) | ||
4638 | { | ||
4639 | m_scene.ForEachScenePresence(delegate(ScenePresence p) | ||
4640 | { | ||
4641 | if (p != this && sog.HasPrivateAttachmentPoint) | ||
4642 | return; | ||
4643 | if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) | ||
4644 | return; | ||
4645 | sog.SendFullUpdateToClient(p.ControllingClient); | ||
4646 | SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path | ||
4647 | }); | ||
4648 | } | ||
4649 | } | ||
4650 | } | ||
4656 | 4651 | ||
4657 | public void SendAttachmentsToClient(IClientAPI client) | 4652 | // send attachments to a client without filters except for huds |
4653 | // for now they are checked in several places down the line... | ||
4654 | public void SendAttachmentsToAgentNF(ScenePresence p) | ||
4658 | { | 4655 | { |
4659 | lock (m_attachments) | 4656 | lock (m_attachments) |
4660 | { | 4657 | { |
4661 | foreach (SceneObjectGroup gobj in m_attachments) | 4658 | foreach (SceneObjectGroup sog in m_attachments) |
4662 | { | 4659 | { |
4663 | gobj.SendFullUpdateToClient(client); | 4660 | if (p == this || !sog.HasPrivateAttachmentPoint) |
4661 | { | ||
4662 | sog.SendFullUpdateToClient(p.ControllingClient); | ||
4663 | } | ||
4664 | } | 4664 | } |
4665 | SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path | ||
4666 | } | ||
4667 | } | ||
4668 | |||
4669 | public void SendAttachmentScheduleUpdate(SceneObjectGroup sog) | ||
4670 | { | ||
4671 | if (IsChildAgent || IsInTransit) | ||
4672 | return; | ||
4673 | |||
4674 | SceneObjectPart[] origparts = sog.Parts; | ||
4675 | SceneObjectPart[] parts = new SceneObjectPart[origparts.Length]; | ||
4676 | PrimUpdateFlags[] flags = new PrimUpdateFlags[origparts.Length]; | ||
4677 | |||
4678 | SceneObjectPart rootpart = sog.RootPart; | ||
4679 | UpdateRequired rootreq = sog.RootPart.UpdateFlag; | ||
4680 | |||
4681 | int j = 0; | ||
4682 | bool allterse = true; | ||
4683 | |||
4684 | for (int i = 0; i < origparts.Length; i++) | ||
4685 | { | ||
4686 | switch (origparts[i].UpdateFlag) | ||
4687 | { | ||
4688 | case UpdateRequired.TERSE: | ||
4689 | flags[j] = PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | ||
4690 | | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity; | ||
4691 | parts[j] = origparts[i]; | ||
4692 | j++; | ||
4693 | break; | ||
4694 | |||
4695 | case UpdateRequired.FULL: | ||
4696 | flags[j] = PrimUpdateFlags.FullUpdate; | ||
4697 | parts[j] = origparts[i]; | ||
4698 | j++; | ||
4699 | allterse = false; | ||
4700 | break; | ||
4701 | } | ||
4702 | origparts[i].UpdateFlag = 0; | ||
4703 | } | ||
4704 | |||
4705 | if (j == 0) | ||
4706 | return; | ||
4707 | |||
4708 | if (rootreq == UpdateRequired.NONE) | ||
4709 | { | ||
4710 | if (allterse) | ||
4711 | rootreq = UpdateRequired.TERSE; | ||
4712 | else | ||
4713 | rootreq = UpdateRequired.FULL; | ||
4714 | } | ||
4715 | |||
4716 | PrimUpdateFlags rootflag = PrimUpdateFlags.FullUpdate; | ||
4717 | if (rootreq == UpdateRequired.TERSE) | ||
4718 | rootflag = PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | ||
4719 | | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity; | ||
4720 | |||
4721 | int nparts = j; | ||
4722 | |||
4723 | bool priv = sog.HasPrivateAttachmentPoint; | ||
4724 | |||
4725 | List<ScenePresence> allPresences = m_scene.GetScenePresences(); | ||
4726 | foreach (ScenePresence p in allPresences) | ||
4727 | { | ||
4728 | if (p != this) | ||
4729 | { | ||
4730 | if (priv || | ||
4731 | (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)) | ||
4732 | continue; | ||
4733 | } | ||
4734 | |||
4735 | p.ControllingClient.SendEntityUpdate(rootpart, rootflag); | ||
4736 | |||
4737 | for (int i = 0; i < nparts; i++) | ||
4738 | { | ||
4739 | SceneObjectPart part = parts[i]; | ||
4740 | if (part == rootpart) | ||
4741 | continue; | ||
4742 | p.ControllingClient.SendEntityUpdate(part, flags[i]); | ||
4743 | } | ||
4744 | } | ||
4745 | } | ||
4746 | |||
4747 | public void SendAttachmentUpdate(SceneObjectGroup sog, UpdateRequired UpdateFlag) | ||
4748 | { | ||
4749 | if (IsChildAgent || IsInTransit) | ||
4750 | return; | ||
4751 | |||
4752 | PrimUpdateFlags flag; | ||
4753 | switch (UpdateFlag) | ||
4754 | { | ||
4755 | case UpdateRequired.TERSE: | ||
4756 | flag = PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | ||
4757 | | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity; | ||
4758 | break; | ||
4759 | |||
4760 | case UpdateRequired.FULL: | ||
4761 | flag = PrimUpdateFlags.FullUpdate; | ||
4762 | break; | ||
4763 | |||
4764 | default: | ||
4765 | return; | ||
4766 | } | ||
4767 | |||
4768 | SceneObjectPart[] parts = sog.Parts; | ||
4769 | SceneObjectPart rootpart = sog.RootPart; | ||
4770 | |||
4771 | bool priv = sog.HasPrivateAttachmentPoint; | ||
4772 | |||
4773 | List<ScenePresence> allPresences = m_scene.GetScenePresences(); | ||
4774 | foreach (ScenePresence p in allPresences) | ||
4775 | { | ||
4776 | if (p != this) | ||
4777 | { | ||
4778 | if (priv || | ||
4779 | (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)) | ||
4780 | continue; | ||
4781 | } | ||
4782 | |||
4783 | p.ControllingClient.SendEntityUpdate(rootpart, flag); | ||
4784 | rootpart.UpdateFlag = 0; | ||
4785 | |||
4786 | for (int i = 0; i < parts.Length; i++) | ||
4787 | { | ||
4788 | SceneObjectPart part = parts[i]; | ||
4789 | if (part == rootpart) | ||
4790 | continue; | ||
4791 | p.ControllingClient.SendEntityUpdate(part, flag); | ||
4792 | part.UpdateFlag = 0; | ||
4793 | } | ||
4794 | } | ||
4795 | } | ||
4796 | |||
4797 | public void SendAttachmentScheduleUpdate(SceneObjectPart part) | ||
4798 | { | ||
4799 | if (IsChildAgent || IsInTransit) | ||
4800 | return; | ||
4801 | |||
4802 | |||
4803 | PrimUpdateFlags flag; | ||
4804 | switch (part.UpdateFlag) | ||
4805 | { | ||
4806 | case UpdateRequired.TERSE: | ||
4807 | flag = PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | ||
4808 | | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity; | ||
4809 | break; | ||
4810 | |||
4811 | case UpdateRequired.FULL: | ||
4812 | flag = PrimUpdateFlags.FullUpdate; | ||
4813 | break; | ||
4814 | |||
4815 | default: | ||
4816 | return; | ||
4817 | } | ||
4818 | |||
4819 | bool priv = part.ParentGroup.HasPrivateAttachmentPoint; | ||
4820 | |||
4821 | List<ScenePresence> allPresences = m_scene.GetScenePresences(); | ||
4822 | foreach (ScenePresence p in allPresences) | ||
4823 | { | ||
4824 | if (p != this) | ||
4825 | { | ||
4826 | |||
4827 | if (priv || | ||
4828 | (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)) | ||
4829 | continue; | ||
4830 | } | ||
4831 | |||
4832 | p.ControllingClient.SendEntityUpdate(part, flag); | ||
4833 | part.UpdateFlag = 0; | ||
4834 | } | ||
4835 | } | ||
4836 | |||
4837 | public void SendAttachmentUpdate(SceneObjectPart part, UpdateRequired UpdateFlag) | ||
4838 | { | ||
4839 | if (IsChildAgent || IsInTransit) | ||
4840 | return; | ||
4841 | |||
4842 | PrimUpdateFlags flag; | ||
4843 | switch (UpdateFlag) | ||
4844 | { | ||
4845 | case UpdateRequired.TERSE: | ||
4846 | flag = PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | ||
4847 | | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity; | ||
4848 | break; | ||
4849 | |||
4850 | case UpdateRequired.FULL: | ||
4851 | flag = PrimUpdateFlags.FullUpdate; | ||
4852 | break; | ||
4853 | |||
4854 | default: | ||
4855 | return; | ||
4856 | } | ||
4857 | |||
4858 | bool priv = part.ParentGroup.HasPrivateAttachmentPoint; | ||
4859 | |||
4860 | List<ScenePresence> allPresences = m_scene.GetScenePresences(); | ||
4861 | foreach (ScenePresence p in allPresences) | ||
4862 | { | ||
4863 | if (p != this) | ||
4864 | { | ||
4865 | if ( priv || | ||
4866 | (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)) | ||
4867 | continue; | ||
4868 | } | ||
4869 | |||
4870 | p.ControllingClient.SendEntityUpdate(part, flag); | ||
4871 | part.UpdateFlag = 0; | ||
4665 | } | 4872 | } |
4666 | } | 4873 | } |
4667 | 4874 | ||
@@ -5410,217 +5617,58 @@ namespace OpenSim.Region.Framework.Scenes | |||
5410 | 5617 | ||
5411 | private void parcelGodCheck(UUID currentParcelID, bool isGod) | 5618 | private void parcelGodCheck(UUID currentParcelID, bool isGod) |
5412 | { | 5619 | { |
5413 | List<ScenePresence> allpresences = null; | 5620 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); |
5414 | |||
5415 | |||
5416 | allpresences = m_scene.GetScenePresences(); | ||
5417 | |||
5418 | if (isGod) | ||
5419 | { | ||
5420 | List<ScenePresence> viewsToSendme = new List<ScenePresence>(); | ||
5421 | |||
5422 | foreach (ScenePresence p in allpresences) | ||
5423 | { | ||
5424 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) | ||
5425 | continue; | ||
5426 | 5621 | ||
5427 | if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelID) | 5622 | foreach (ScenePresence p in allpresences) |
5428 | { | ||
5429 | viewsToSendme.Add(p); // i see them | ||
5430 | } | ||
5431 | } | ||
5432 | |||
5433 | if (viewsToSendme.Count > 0) | ||
5434 | { | ||
5435 | foreach (ScenePresence p in viewsToSendme) | ||
5436 | { | ||
5437 | if (p.IsChildAgent) | ||
5438 | continue; | ||
5439 | m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); | ||
5440 | ControllingClient.SendAvatarDataImmediate(p); | ||
5441 | p.SendAppearanceToAgent(this); | ||
5442 | p.SendAttachmentsToClient(ControllingClient); | ||
5443 | if (p.Animator != null) | ||
5444 | p.Animator.SendAnimPackToClient(ControllingClient); | ||
5445 | } | ||
5446 | } | ||
5447 | } | ||
5448 | else | ||
5449 | { | 5623 | { |
5450 | List<ScenePresence> killsToSendme = new List<ScenePresence>(); | 5624 | if (p.IsDeleted || p.IsChildAgent || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) |
5451 | 5625 | continue; | |
5452 | foreach (ScenePresence p in allpresences) | ||
5453 | { | ||
5454 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) | ||
5455 | continue; | ||
5456 | |||
5457 | if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelID) | ||
5458 | { | ||
5459 | killsToSendme.Add(p); | ||
5460 | } | ||
5461 | } | ||
5462 | 5626 | ||
5463 | if (killsToSendme.Count > 0) | 5627 | if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelID) |
5464 | { | 5628 | { |
5465 | foreach (ScenePresence p in killsToSendme) | 5629 | if (isGod) |
5466 | { | 5630 | p.SendViewTo(this); |
5467 | m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); | 5631 | else |
5468 | try { ControllingClient.SendKillObject(new List<uint> { p.LocalId }); } | 5632 | p.SendKillTo(this); |
5469 | catch (NullReferenceException) { } | ||
5470 | } | ||
5471 | } | 5633 | } |
5472 | } | 5634 | } |
5473 | |||
5474 | } | 5635 | } |
5475 | 5636 | ||
5476 | private void ParcelLoginCheck(UUID currentParcelID) | 5637 | private void ParcelLoginCheck(UUID currentParcelID) |
5477 | { | 5638 | { |
5478 | List<ScenePresence> killsToSendto = new List<ScenePresence>(); | 5639 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); |
5479 | List<ScenePresence> killsToSendme = new List<ScenePresence>(); | ||
5480 | List<ScenePresence> viewsToSendto = new List<ScenePresence>(); | ||
5481 | List<ScenePresence> viewsToSendme = new List<ScenePresence>(); | ||
5482 | List<ScenePresence> allpresences = null; | ||
5483 | |||
5484 | allpresences = m_scene.GetScenePresences(); | ||
5485 | 5640 | ||
5486 | foreach (ScenePresence p in allpresences) | 5641 | foreach (ScenePresence p in allpresences) |
5487 | { | 5642 | { |
5488 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) | 5643 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) |
5489 | continue; | 5644 | continue; |
5490 | 5645 | ||
5491 | if (currentParcelID != p.currentParcelUUID) | 5646 | if (currentParcelID != p.currentParcelUUID && p.GodLevel < 200) |
5492 | { | 5647 | { |
5493 | if (p.GodLevel < 200) | 5648 | SendKillTo(p); |
5494 | killsToSendto.Add(p); | ||
5495 | if (GodLevel < 200 && p.ParcelHideThisAvatar) | ||
5496 | killsToSendme.Add(p); | ||
5497 | } | ||
5498 | else | ||
5499 | { | ||
5500 | viewsToSendto.Add(p); | ||
5501 | viewsToSendme.Add(p); | ||
5502 | } | ||
5503 | } | ||
5504 | allpresences.Clear(); | ||
5505 | |||
5506 | // send the things | ||
5507 | // kill main avatar object | ||
5508 | if (killsToSendto.Count > 0 && PresenceType != PresenceType.Npc) | ||
5509 | { | ||
5510 | foreach (ScenePresence p in killsToSendto) | ||
5511 | { | ||
5512 | m_log.Debug("[AVATAR]: killTo: " + Lastname + " " + p.Lastname); | ||
5513 | try { p.ControllingClient.SendKillObject(new List<uint> { LocalId }); } | ||
5514 | catch (NullReferenceException) { } | ||
5515 | } | ||
5516 | } | ||
5517 | |||
5518 | if (killsToSendme.Count > 0) | ||
5519 | { | ||
5520 | foreach (ScenePresence p in killsToSendme) | ||
5521 | { | ||
5522 | m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); | ||
5523 | try { ControllingClient.SendKillObject(new List<uint> { p.LocalId }); } | ||
5524 | catch (NullReferenceException) { } | ||
5525 | } | ||
5526 | } | ||
5527 | |||
5528 | if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) | ||
5529 | { | ||
5530 | foreach (ScenePresence p in viewsToSendto) | ||
5531 | { | ||
5532 | m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname); | ||
5533 | p.ControllingClient.SendAvatarDataImmediate(this); | ||
5534 | SendAppearanceToAgent(p); | ||
5535 | SendAttachmentsToClient(p.ControllingClient); | ||
5536 | if (Animator != null) | ||
5537 | Animator.SendAnimPackToClient(p.ControllingClient); | ||
5538 | } | ||
5539 | } | ||
5540 | |||
5541 | if (viewsToSendme.Count > 0) | ||
5542 | { | ||
5543 | foreach (ScenePresence p in viewsToSendme) | ||
5544 | { | ||
5545 | m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); | ||
5546 | if (p.IsChildAgent) | ||
5547 | continue; | ||
5548 | ControllingClient.SendAvatarDataImmediate(p); | ||
5549 | p.SendAppearanceToAgent(this); | ||
5550 | p.SendAttachmentsToClient(ControllingClient); | ||
5551 | if (p.Animator != null) | ||
5552 | p.Animator.SendAnimPackToClient(ControllingClient); | ||
5553 | } | 5649 | } |
5554 | } | 5650 | } |
5555 | } | 5651 | } |
5556 | 5652 | ||
5557 | public void parcelRegionCross(bool abort) | 5653 | public void parcelRegionCross() |
5558 | { | 5654 | { |
5559 | if (!ParcelHideThisAvatar) | 5655 | if (!ParcelHideThisAvatar || GodLevel >= 200) |
5560 | return; | 5656 | return; |
5561 | 5657 | ||
5562 | List<ScenePresence> allpresences = null; | 5658 | List<ScenePresence> allpresences = null; |
5563 | allpresences = m_scene.GetScenePresences(); | 5659 | allpresences = m_scene.GetScenePresences(); |
5564 | 5660 | ||
5565 | if (abort) | 5661 | foreach (ScenePresence p in allpresences) |
5566 | { | 5662 | { |
5567 | List<ScenePresence> viewsToSendme = new List<ScenePresence>(); | 5663 | if (p.IsDeleted || p == this || p.IsChildAgent || p.ControllingClient == null || !p.ControllingClient.IsActive) |
5568 | 5664 | continue; | |
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 | 5665 | ||
5580 | if (viewsToSendme.Count > 0) | 5666 | if (p.currentParcelUUID == m_currentParcelUUID) |
5581 | { | 5667 | { |
5582 | foreach (ScenePresence p in viewsToSendme) | 5668 | p.SendKillTo(this); |
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 | { | ||
5597 | if (GodLevel >= 200) | ||
5598 | return; | ||
5599 | |||
5600 | List<ScenePresence> killsToSendme = new List<ScenePresence>(); | ||
5601 | foreach (ScenePresence p in allpresences) | ||
5602 | { | ||
5603 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) | ||
5604 | continue; | ||
5605 | |||
5606 | if (p.currentParcelUUID == m_currentParcelUUID) | ||
5607 | { | ||
5608 | killsToSendme.Add(p); | ||
5609 | } | ||
5610 | } | ||
5611 | |||
5612 | if (killsToSendme.Count > 0) | ||
5613 | { | ||
5614 | foreach (ScenePresence p in 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 | } | 5669 | } |
5621 | } | 5670 | } |
5622 | } | 5671 | } |
5623 | |||
5624 | 5672 | ||
5625 | private void ParcelCrossCheck(UUID currentParcelID,UUID previusParcelID, | 5673 | private void ParcelCrossCheck(UUID currentParcelID,UUID previusParcelID, |
5626 | bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check) | 5674 | bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check) |
@@ -5631,10 +5679,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5631 | List<ScenePresence> viewsToSendme = new List<ScenePresence>(); | 5679 | List<ScenePresence> viewsToSendme = new List<ScenePresence>(); |
5632 | List<ScenePresence> allpresences = null; | 5680 | List<ScenePresence> allpresences = null; |
5633 | 5681 | ||
5634 | if (IsInTransit) | 5682 | if (IsInTransit || IsChildAgent) |
5635 | return; | ||
5636 | |||
5637 | if (IsChildAgent) | ||
5638 | return; | 5683 | return; |
5639 | 5684 | ||
5640 | if (check) | 5685 | if (check) |
@@ -5743,7 +5788,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5743 | { | 5788 | { |
5744 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) | 5789 | if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) |
5745 | continue; | 5790 | continue; |
5746 | // only those old parcel need receive kills | 5791 | // only those old parcel need kills |
5747 | if (previusParcelID == p.currentParcelUUID && GodLevel < 200) | 5792 | if (previusParcelID == p.currentParcelUUID && GodLevel < 200) |
5748 | { | 5793 | { |
5749 | killsToSendme.Add(p); // i dont see them | 5794 | killsToSendme.Add(p); // i dont see them |
@@ -5760,37 +5805,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
5760 | } | 5805 | } |
5761 | 5806 | ||
5762 | // send the things | 5807 | // send the things |
5763 | // kill main avatar object | 5808 | |
5764 | if (killsToSendto.Count > 0 && PresenceType != PresenceType.Npc) | 5809 | if (killsToSendto.Count > 0) |
5765 | { | 5810 | { |
5766 | foreach (ScenePresence p in killsToSendto) | 5811 | foreach (ScenePresence p in killsToSendto) |
5767 | { | 5812 | { |
5768 | m_log.Debug("[AVATAR]: killTo: " + Lastname + " " + p.Lastname); | 5813 | m_log.Debug("[AVATAR]: killTo: " + Lastname + " " + p.Lastname); |
5769 | try { p.ControllingClient.SendKillObject(new List<uint> { LocalId }); } | 5814 | SendKillTo(p); |
5770 | catch (NullReferenceException) { } | ||
5771 | } | 5815 | } |
5772 | } | 5816 | } |
5773 | 5817 | ||
5774 | if (killsToSendme.Count > 0 ) | 5818 | if (killsToSendme.Count > 0) |
5775 | { | 5819 | { |
5820 | m_log.Debug("[AVATAR]: killtoMe: " + Lastname + " " + killsToSendme.Count.ToString()); | ||
5821 | |||
5776 | foreach (ScenePresence p in killsToSendme) | 5822 | foreach (ScenePresence p in killsToSendme) |
5777 | { | 5823 | { |
5778 | m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); | 5824 | m_log.Debug("[AVATAR]: killToMe: " + Lastname + " " + p.Lastname); |
5779 | try {ControllingClient.SendKillObject(new List<uint> { p.LocalId }); } | 5825 | p.SendKillTo(this); |
5780 | catch (NullReferenceException) { } | ||
5781 | } | 5826 | } |
5782 | } | 5827 | } |
5783 | 5828 | ||
5784 | if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) | 5829 | if (viewsToSendto.Count > 0) |
5785 | { | 5830 | { |
5786 | foreach (ScenePresence p in viewsToSendto) | 5831 | foreach (ScenePresence p in viewsToSendto) |
5787 | { | 5832 | { |
5788 | p.ControllingClient.SendAvatarDataImmediate(this); | 5833 | SendViewTo(p); |
5789 | // m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname); | ||
5790 | SendAppearanceToAgent(p); | ||
5791 | SendAttachmentsToClient(p.ControllingClient); | ||
5792 | if (Animator != null) | ||
5793 | Animator.SendAnimPackToClient(p.ControllingClient); | ||
5794 | } | 5834 | } |
5795 | } | 5835 | } |
5796 | 5836 | ||
@@ -5801,13 +5841,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
5801 | if (p.IsChildAgent) | 5841 | if (p.IsChildAgent) |
5802 | continue; | 5842 | continue; |
5803 | // m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); | 5843 | // m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); |
5804 | ControllingClient.SendAvatarDataImmediate(p); | 5844 | p.SendViewTo(this); |
5805 | p.SendAppearanceToAgent(this); | ||
5806 | p.SendAttachmentsToClient(ControllingClient); | ||
5807 | if (p.Animator != null) | ||
5808 | p.Animator.SendAnimPackToClient(ControllingClient); | ||
5809 | } | 5845 | } |
5810 | } | 5846 | } |
5811 | } | 5847 | } |
5848 | |||
5849 | public void HasMovedAway() | ||
5850 | { | ||
5851 | List<ScenePresence> allpresences = m_scene.GetScenePresences(); | ||
5852 | foreach (ScenePresence p in allpresences) | ||
5853 | { | ||
5854 | if (p == this) | ||
5855 | continue; | ||
5856 | SendKillTo(p); | ||
5857 | p.SendKillTo(this); | ||
5858 | } | ||
5859 | if (Scene.AttachmentsModule != null) | ||
5860 | Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); | ||
5861 | } | ||
5862 | |||
5863 | public void SendFullKillsTo(ScenePresence p) | ||
5864 | { | ||
5865 | List<uint> ids = new List<uint>(); | ||
5866 | foreach (SceneObjectGroup sog in m_attachments) | ||
5867 | p.ControllingClient.SendPartFullUpdate(sog.RootPart, LocalId + 1); | ||
5868 | ids.Add(LocalId); | ||
5869 | p.ControllingClient.SendKillObject(ids); | ||
5870 | } | ||
5871 | |||
5872 | public void SendKillTo(ScenePresence p) | ||
5873 | { | ||
5874 | foreach (SceneObjectGroup sog in m_attachments) | ||
5875 | p.ControllingClient.SendPartFullUpdate(sog.RootPart, LocalId + 1); | ||
5876 | p.ControllingClient.SendKillObject(new List<uint> { LocalId }); | ||
5877 | } | ||
5878 | |||
5879 | public void SendViewTo(ScenePresence p) | ||
5880 | { | ||
5881 | SendAvatarDataToAgentNF(p); | ||
5882 | SendAppearanceToAgent(p); | ||
5883 | if (Animator != null) | ||
5884 | Animator.SendAnimPackToClient(p.ControllingClient); | ||
5885 | SendAttachmentsToAgentNF(p); | ||
5886 | } | ||
5812 | } | 5887 | } |
5813 | } | 5888 | } |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 373ed41..2112b71 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 | ||
@@ -1700,5 +1702,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1700 | { | 1702 | { |
1701 | } | 1703 | } |
1702 | 1704 | ||
1705 | public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) | ||
1706 | { | ||
1707 | } | ||
1703 | } | 1708 | } |
1704 | } | 1709 | } |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index c88ccc5..fa1d38a 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; } |
@@ -1270,5 +1272,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
1270 | { | 1272 | { |
1271 | } | 1273 | } |
1272 | 1274 | ||
1275 | public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) | ||
1276 | { | ||
1277 | } | ||
1278 | |||
1273 | } | 1279 | } |
1274 | } | 1280 | } |