diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 698 |
1 files changed, 413 insertions, 285 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4ba441e..873c56c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -158,6 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
158 | public event RequestTaskInventory OnRequestTaskInventory; | 158 | public event RequestTaskInventory OnRequestTaskInventory; |
159 | public event UpdateInventoryItem OnUpdateInventoryItem; | 159 | public event UpdateInventoryItem OnUpdateInventoryItem; |
160 | public event CopyInventoryItem OnCopyInventoryItem; | 160 | public event CopyInventoryItem OnCopyInventoryItem; |
161 | public event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | ||
161 | public event MoveInventoryItem OnMoveInventoryItem; | 162 | public event MoveInventoryItem OnMoveInventoryItem; |
162 | public event RemoveInventoryItem OnRemoveInventoryItem; | 163 | public event RemoveInventoryItem OnRemoveInventoryItem; |
163 | public event RemoveInventoryFolder OnRemoveInventoryFolder; | 164 | public event RemoveInventoryFolder OnRemoveInventoryFolder; |
@@ -255,7 +256,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
255 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; | 256 | public event ClassifiedInfoRequest OnClassifiedInfoRequest; |
256 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; | 257 | public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; |
257 | public event ClassifiedDelete OnClassifiedDelete; | 258 | public event ClassifiedDelete OnClassifiedDelete; |
258 | public event ClassifiedDelete OnClassifiedGodDelete; | 259 | public event ClassifiedGodDelete OnClassifiedGodDelete; |
259 | public event EventNotificationAddRequest OnEventNotificationAddRequest; | 260 | public event EventNotificationAddRequest OnEventNotificationAddRequest; |
260 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; | 261 | public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; |
261 | public event EventGodDelete OnEventGodDelete; | 262 | public event EventGodDelete OnEventGodDelete; |
@@ -286,6 +287,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
286 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; | 287 | public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; |
287 | public event SimWideDeletesDelegate OnSimWideDeletes; | 288 | public event SimWideDeletesDelegate OnSimWideDeletes; |
288 | public event SendPostcard OnSendPostcard; | 289 | public event SendPostcard OnSendPostcard; |
290 | public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; | ||
289 | public event MuteListEntryUpdate OnUpdateMuteListEntry; | 291 | public event MuteListEntryUpdate OnUpdateMuteListEntry; |
290 | public event MuteListEntryRemove OnRemoveMuteListEntry; | 292 | public event MuteListEntryRemove OnRemoveMuteListEntry; |
291 | public event GodlikeMessage onGodlikeMessage; | 293 | public event GodlikeMessage onGodlikeMessage; |
@@ -336,7 +338,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
336 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an | 338 | /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an |
337 | /// ownerless phantom. | 339 | /// ownerless phantom. |
338 | /// | 340 | /// |
339 | /// All manipulation of this set has to occur under a lock | 341 | /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock |
340 | /// | 342 | /// |
341 | /// </value> | 343 | /// </value> |
342 | protected HashSet<uint> m_killRecord; | 344 | protected HashSet<uint> m_killRecord; |
@@ -344,6 +346,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
344 | // protected HashSet<uint> m_attachmentsSent; | 346 | // protected HashSet<uint> m_attachmentsSent; |
345 | 347 | ||
346 | private int m_moneyBalance; | 348 | private int m_moneyBalance; |
349 | private bool m_deliverPackets = true; | ||
347 | private int m_animationSequenceNumber = 1; | 350 | private int m_animationSequenceNumber = 1; |
348 | private bool m_SendLogoutPacketWhenClosing = true; | 351 | private bool m_SendLogoutPacketWhenClosing = true; |
349 | private AgentUpdateArgs lastarg; | 352 | private AgentUpdateArgs lastarg; |
@@ -383,6 +386,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
383 | get { return m_startpos; } | 386 | get { return m_startpos; } |
384 | set { m_startpos = value; } | 387 | set { m_startpos = value; } |
385 | } | 388 | } |
389 | public bool DeliverPackets | ||
390 | { | ||
391 | get { return m_deliverPackets; } | ||
392 | set { | ||
393 | m_deliverPackets = value; | ||
394 | m_udpClient.m_deliverPackets = value; | ||
395 | } | ||
396 | } | ||
386 | public UUID AgentId { get { return m_agentId; } } | 397 | public UUID AgentId { get { return m_agentId; } } |
387 | public ISceneAgent SceneAgent { get; private set; } | 398 | public ISceneAgent SceneAgent { get; private set; } |
388 | public UUID ActiveGroupId { get { return m_activeGroupID; } } | 399 | public UUID ActiveGroupId { get { return m_activeGroupID; } } |
@@ -487,18 +498,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
487 | 498 | ||
488 | #region Client Methods | 499 | #region Client Methods |
489 | 500 | ||
501 | |||
490 | /// <summary> | 502 | /// <summary> |
491 | /// Shut down the client view | 503 | /// Shut down the client view |
492 | /// </summary> | 504 | /// </summary> |
493 | public void Close() | 505 | public void Close() |
494 | { | 506 | { |
507 | Close(true); | ||
508 | } | ||
509 | |||
510 | /// <summary> | ||
511 | /// Shut down the client view | ||
512 | /// </summary> | ||
513 | public void Close(bool sendStop) | ||
514 | { | ||
495 | m_log.DebugFormat( | 515 | m_log.DebugFormat( |
496 | "[CLIENT]: Close has been called for {0} attached to scene {1}", | 516 | "[CLIENT]: Close has been called for {0} attached to scene {1}", |
497 | Name, m_scene.RegionInfo.RegionName); | 517 | Name, m_scene.RegionInfo.RegionName); |
498 | 518 | ||
499 | // Send the STOP packet | 519 | if (sendStop) |
500 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | 520 | { |
501 | OutPacket(disable, ThrottleOutPacketType.Unknown); | 521 | // Send the STOP packet |
522 | DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator); | ||
523 | OutPacket(disable, ThrottleOutPacketType.Unknown); | ||
524 | } | ||
502 | 525 | ||
503 | IsActive = false; | 526 | IsActive = false; |
504 | 527 | ||
@@ -798,7 +821,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
798 | reply.ChatData.OwnerID = fromAgentID; | 821 | reply.ChatData.OwnerID = fromAgentID; |
799 | reply.ChatData.SourceID = fromAgentID; | 822 | reply.ChatData.SourceID = fromAgentID; |
800 | 823 | ||
801 | OutPacket(reply, ThrottleOutPacketType.Task); | 824 | OutPacket(reply, ThrottleOutPacketType.Unknown); |
802 | } | 825 | } |
803 | 826 | ||
804 | /// <summary> | 827 | /// <summary> |
@@ -1084,6 +1107,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1084 | public virtual void SendLayerData(float[] map) | 1107 | public virtual void SendLayerData(float[] map) |
1085 | { | 1108 | { |
1086 | Util.FireAndForget(DoSendLayerData, map); | 1109 | Util.FireAndForget(DoSendLayerData, map); |
1110 | |||
1111 | // Send it sync, and async. It's not that much data | ||
1112 | // and it improves user experience just so much! | ||
1113 | DoSendLayerData(map); | ||
1087 | } | 1114 | } |
1088 | 1115 | ||
1089 | /// <summary> | 1116 | /// <summary> |
@@ -1096,16 +1123,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1096 | 1123 | ||
1097 | try | 1124 | try |
1098 | { | 1125 | { |
1099 | //for (int y = 0; y < 16; y++) | 1126 | for (int y = 0; y < 16; y++) |
1100 | //{ | 1127 | { |
1101 | // for (int x = 0; x < 16; x++) | 1128 | for (int x = 0; x < 16; x+=4) |
1102 | // { | 1129 | { |
1103 | // SendLayerData(x, y, map); | 1130 | SendLayerPacket(x, y, map); |
1104 | // } | 1131 | } |
1105 | //} | 1132 | } |
1106 | |||
1107 | // Send LayerData in a spiral pattern. Fun! | ||
1108 | SendLayerTopRight(map, 0, 0, 15, 15); | ||
1109 | } | 1133 | } |
1110 | catch (Exception e) | 1134 | catch (Exception e) |
1111 | { | 1135 | { |
@@ -1113,51 +1137,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1113 | } | 1137 | } |
1114 | } | 1138 | } |
1115 | 1139 | ||
1116 | private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2) | ||
1117 | { | ||
1118 | // Row | ||
1119 | for (int i = x1; i <= x2; i++) | ||
1120 | SendLayerData(i, y1, map); | ||
1121 | |||
1122 | // Column | ||
1123 | for (int j = y1 + 1; j <= y2; j++) | ||
1124 | SendLayerData(x2, j, map); | ||
1125 | |||
1126 | if (x2 - x1 > 0) | ||
1127 | SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2); | ||
1128 | } | ||
1129 | |||
1130 | void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2) | ||
1131 | { | ||
1132 | // Row in reverse | ||
1133 | for (int i = x2; i >= x1; i--) | ||
1134 | SendLayerData(i, y2, map); | ||
1135 | |||
1136 | // Column in reverse | ||
1137 | for (int j = y2 - 1; j >= y1; j--) | ||
1138 | SendLayerData(x1, j, map); | ||
1139 | |||
1140 | if (x2 - x1 > 0) | ||
1141 | SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1); | ||
1142 | } | ||
1143 | |||
1144 | /// <summary> | 1140 | /// <summary> |
1145 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client | 1141 | /// Sends a set of four patches (x, x+1, ..., x+3) to the client |
1146 | /// </summary> | 1142 | /// </summary> |
1147 | /// <param name="map">heightmap</param> | 1143 | /// <param name="map">heightmap</param> |
1148 | /// <param name="px">X coordinate for patches 0..12</param> | 1144 | /// <param name="px">X coordinate for patches 0..12</param> |
1149 | /// <param name="py">Y coordinate for patches 0..15</param> | 1145 | /// <param name="py">Y coordinate for patches 0..15</param> |
1150 | // private void SendLayerPacket(float[] map, int y, int x) | 1146 | private void SendLayerPacket(int x, int y, float[] map) |
1151 | // { | 1147 | { |
1152 | // int[] patches = new int[4]; | 1148 | int[] patches = new int[4]; |
1153 | // patches[0] = x + 0 + y * 16; | 1149 | patches[0] = x + 0 + y * 16; |
1154 | // patches[1] = x + 1 + y * 16; | 1150 | patches[1] = x + 1 + y * 16; |
1155 | // patches[2] = x + 2 + y * 16; | 1151 | patches[2] = x + 2 + y * 16; |
1156 | // patches[3] = x + 3 + y * 16; | 1152 | patches[3] = x + 3 + y * 16; |
1157 | 1153 | ||
1158 | // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches); | 1154 | float[] heightmap = (map.Length == 65536) ? |
1159 | // OutPacket(layerpack, ThrottleOutPacketType.Land); | 1155 | map : |
1160 | // } | 1156 | LLHeightFieldMoronize(map); |
1157 | |||
1158 | try | ||
1159 | { | ||
1160 | Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | ||
1161 | OutPacket(layerpack, ThrottleOutPacketType.Land); | ||
1162 | } | ||
1163 | catch | ||
1164 | { | ||
1165 | for (int px = x ; px < x + 4 ; px++) | ||
1166 | SendLayerData(px, y, map); | ||
1167 | } | ||
1168 | } | ||
1161 | 1169 | ||
1162 | /// <summary> | 1170 | /// <summary> |
1163 | /// Sends a specified patch to a client | 1171 | /// Sends a specified patch to a client |
@@ -1177,7 +1185,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1177 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1185 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1178 | layerpack.Header.Reliable = true; | 1186 | layerpack.Header.Reliable = true; |
1179 | 1187 | ||
1180 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1188 | OutPacket(layerpack, ThrottleOutPacketType.Task); |
1181 | } | 1189 | } |
1182 | catch (Exception e) | 1190 | catch (Exception e) |
1183 | { | 1191 | { |
@@ -2301,6 +2309,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2301 | OutPacket(sound, ThrottleOutPacketType.Task); | 2309 | OutPacket(sound, ThrottleOutPacketType.Task); |
2302 | } | 2310 | } |
2303 | 2311 | ||
2312 | public void SendTransferAbort(TransferRequestPacket transferRequest) | ||
2313 | { | ||
2314 | TransferAbortPacket abort = (TransferAbortPacket)PacketPool.Instance.GetPacket(PacketType.TransferAbort); | ||
2315 | abort.TransferInfo.TransferID = transferRequest.TransferInfo.TransferID; | ||
2316 | abort.TransferInfo.ChannelType = transferRequest.TransferInfo.ChannelType; | ||
2317 | m_log.Debug("[Assets] Aborting transfer; asset request failed"); | ||
2318 | OutPacket(abort, ThrottleOutPacketType.Task); | ||
2319 | } | ||
2320 | |||
2304 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) | 2321 | public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain) |
2305 | { | 2322 | { |
2306 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); | 2323 | SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger); |
@@ -3611,7 +3628,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3611 | /// </summary> | 3628 | /// </summary> |
3612 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 3629 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
3613 | { | 3630 | { |
3614 | //double priority = m_prioritizer.GetUpdatePriority(this, entity); | 3631 | if (entity is SceneObjectPart) |
3632 | { | ||
3633 | SceneObjectPart e = (SceneObjectPart)entity; | ||
3634 | SceneObjectGroup g = e.ParentGroup; | ||
3635 | if (g.RootPart.Shape.State > 30) // HUD | ||
3636 | if (g.OwnerID != AgentId) | ||
3637 | return; // Don't send updates for other people's HUDs | ||
3638 | } | ||
3639 | |||
3615 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); | 3640 | uint priority = m_prioritizer.GetUpdatePriority(this, entity); |
3616 | 3641 | ||
3617 | lock (m_entityUpdates.SyncRoot) | 3642 | lock (m_entityUpdates.SyncRoot) |
@@ -3678,211 +3703,230 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3678 | 3703 | ||
3679 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race | 3704 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race |
3680 | // condition where a kill can be processed before an out-of-date update for the same object. | 3705 | // condition where a kill can be processed before an out-of-date update for the same object. |
3681 | lock (m_killRecord) | 3706 | float avgTimeDilation = 1.0f; |
3707 | IEntityUpdate iupdate; | ||
3708 | Int32 timeinqueue; // this is just debugging code & can be dropped later | ||
3709 | |||
3710 | while (updatesThisCall < maxUpdates) | ||
3682 | { | 3711 | { |
3683 | float avgTimeDilation = 1.0f; | 3712 | lock (m_entityUpdates.SyncRoot) |
3684 | IEntityUpdate iupdate; | 3713 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) |
3685 | Int32 timeinqueue; // this is just debugging code & can be dropped later | 3714 | break; |
3686 | |||
3687 | while (updatesThisCall < maxUpdates) | ||
3688 | { | ||
3689 | lock (m_entityUpdates.SyncRoot) | ||
3690 | if (!m_entityUpdates.TryDequeue(out iupdate, out timeinqueue)) | ||
3691 | break; | ||
3692 | 3715 | ||
3693 | EntityUpdate update = (EntityUpdate)iupdate; | 3716 | EntityUpdate update = (EntityUpdate)iupdate; |
3694 | 3717 | ||
3695 | avgTimeDilation += update.TimeDilation; | 3718 | avgTimeDilation += update.TimeDilation; |
3696 | avgTimeDilation *= 0.5f; | 3719 | avgTimeDilation *= 0.5f; |
3697 | 3720 | ||
3698 | if (update.Entity is SceneObjectPart) | 3721 | if (update.Entity is SceneObjectPart) |
3722 | { | ||
3723 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3724 | |||
3725 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | ||
3726 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | ||
3727 | // safety measure. | ||
3728 | // | ||
3729 | // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update | ||
3730 | // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs | ||
3731 | // updates and kills on different threads with different scheduling strategies, hence this protection. | ||
3732 | // | ||
3733 | // This doesn't appear to apply to child prims - a client will happily ignore these updates | ||
3734 | // after the root prim has been deleted. | ||
3735 | lock (m_killRecord) | ||
3699 | { | 3736 | { |
3700 | SceneObjectPart part = (SceneObjectPart)update.Entity; | ||
3701 | |||
3702 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | ||
3703 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | ||
3704 | // safety measure. | ||
3705 | // | ||
3706 | // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update | ||
3707 | // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs | ||
3708 | // updates and kills on different threads with different scheduling strategies, hence this protection. | ||
3709 | // | ||
3710 | // This doesn't appear to apply to child prims - a client will happily ignore these updates | ||
3711 | // after the root prim has been deleted. | ||
3712 | if (m_killRecord.Contains(part.LocalId)) | 3737 | if (m_killRecord.Contains(part.LocalId)) |
3713 | { | ||
3714 | // m_log.WarnFormat( | ||
3715 | // "[CLIENT]: Preventing update for prim with local id {0} after client for user {1} told it was deleted", | ||
3716 | // part.LocalId, Name); | ||
3717 | continue; | 3738 | continue; |
3718 | } | 3739 | if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) |
3719 | 3740 | continue; | |
3720 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | 3741 | } |
3742 | |||
3743 | if (part.ParentGroup.IsDeleted) | ||
3744 | continue; | ||
3745 | |||
3746 | if (part.ParentGroup.IsAttachment) | ||
3747 | { // Someone else's HUD, why are we getting these? | ||
3748 | if (part.ParentGroup.OwnerID != AgentId && | ||
3749 | part.ParentGroup.RootPart.Shape.State >= 30) | ||
3750 | continue; | ||
3751 | ScenePresence sp; | ||
3752 | // Owner is not in the sim, don't update it to | ||
3753 | // anyone | ||
3754 | if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) | ||
3755 | continue; | ||
3756 | |||
3757 | List<SceneObjectGroup> atts = sp.GetAttachments(); | ||
3758 | bool found = false; | ||
3759 | foreach (SceneObjectGroup att in atts) | ||
3721 | { | 3760 | { |
3722 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | 3761 | if (att == part.ParentGroup) |
3723 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) | ||
3724 | { | 3762 | { |
3725 | part.Shape.LightEntry = false; | 3763 | found = true; |
3764 | break; | ||
3726 | } | 3765 | } |
3727 | } | 3766 | } |
3767 | |||
3768 | // It's an attachment of a valid avatar, but | ||
3769 | // doesn't seem to be attached, skip | ||
3770 | if (!found) | ||
3771 | continue; | ||
3728 | } | 3772 | } |
3729 | 3773 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | |
3730 | ++updatesThisCall; | ||
3731 | |||
3732 | #region UpdateFlags to packet type conversion | ||
3733 | |||
3734 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | ||
3735 | |||
3736 | bool canUseCompressed = true; | ||
3737 | bool canUseImproved = true; | ||
3738 | |||
3739 | // Compressed object updates only make sense for LL primitives | ||
3740 | if (!(update.Entity is SceneObjectPart)) | ||
3741 | { | ||
3742 | canUseCompressed = false; | ||
3743 | } | ||
3744 | |||
3745 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) | ||
3746 | { | ||
3747 | canUseCompressed = false; | ||
3748 | canUseImproved = false; | ||
3749 | } | ||
3750 | else | ||
3751 | { | 3774 | { |
3752 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || | 3775 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && |
3753 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || | 3776 | part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.RightHand) |
3754 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || | ||
3755 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3756 | { | ||
3757 | canUseCompressed = false; | ||
3758 | } | ||
3759 | |||
3760 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
3761 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3762 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3763 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3764 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3765 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3766 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3767 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3768 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3769 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3770 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3771 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3772 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3773 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3774 | { | 3777 | { |
3775 | canUseImproved = false; | 3778 | part.Shape.LightEntry = false; |
3776 | } | 3779 | } |
3777 | } | 3780 | } |
3778 | 3781 | } | |
3779 | #endregion UpdateFlags to packet type conversion | 3782 | |
3780 | 3783 | ++updatesThisCall; | |
3781 | #region Block Construction | 3784 | |
3782 | 3785 | #region UpdateFlags to packet type conversion | |
3783 | // TODO: Remove this once we can build compressed updates | 3786 | |
3787 | PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags; | ||
3788 | |||
3789 | bool canUseCompressed = true; | ||
3790 | bool canUseImproved = true; | ||
3791 | |||
3792 | // Compressed object updates only make sense for LL primitives | ||
3793 | if (!(update.Entity is SceneObjectPart)) | ||
3794 | { | ||
3784 | canUseCompressed = false; | 3795 | canUseCompressed = false; |
3785 | 3796 | } | |
3786 | if (!canUseImproved && !canUseCompressed) | 3797 | |
3787 | { | 3798 | if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) |
3788 | if (update.Entity is ScenePresence) | 3799 | { |
3789 | { | 3800 | canUseCompressed = false; |
3790 | objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); | 3801 | canUseImproved = false; |
3791 | objectUpdates.Value.Add(update); | 3802 | } |
3792 | } | 3803 | else |
3793 | else | 3804 | { |
3794 | { | 3805 | if (updateFlags.HasFlag(PrimUpdateFlags.Velocity) || |
3795 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); | 3806 | updateFlags.HasFlag(PrimUpdateFlags.Acceleration) || |
3796 | objectUpdates.Value.Add(update); | 3807 | updateFlags.HasFlag(PrimUpdateFlags.CollisionPlane) || |
3797 | } | 3808 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) |
3798 | } | ||
3799 | else if (!canUseImproved) | ||
3800 | { | 3809 | { |
3801 | compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); | 3810 | canUseCompressed = false; |
3802 | compressedUpdates.Value.Add(update); | ||
3803 | } | 3811 | } |
3804 | else | 3812 | |
3813 | if (updateFlags.HasFlag(PrimUpdateFlags.PrimFlags) || | ||
3814 | updateFlags.HasFlag(PrimUpdateFlags.ParentID) || | ||
3815 | updateFlags.HasFlag(PrimUpdateFlags.Scale) || | ||
3816 | updateFlags.HasFlag(PrimUpdateFlags.PrimData) || | ||
3817 | updateFlags.HasFlag(PrimUpdateFlags.Text) || | ||
3818 | updateFlags.HasFlag(PrimUpdateFlags.NameValue) || | ||
3819 | updateFlags.HasFlag(PrimUpdateFlags.ExtraData) || | ||
3820 | updateFlags.HasFlag(PrimUpdateFlags.TextureAnim) || | ||
3821 | updateFlags.HasFlag(PrimUpdateFlags.Sound) || | ||
3822 | updateFlags.HasFlag(PrimUpdateFlags.Particles) || | ||
3823 | updateFlags.HasFlag(PrimUpdateFlags.Material) || | ||
3824 | updateFlags.HasFlag(PrimUpdateFlags.ClickAction) || | ||
3825 | updateFlags.HasFlag(PrimUpdateFlags.MediaURL) || | ||
3826 | updateFlags.HasFlag(PrimUpdateFlags.Joint)) | ||
3805 | { | 3827 | { |
3806 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) | 3828 | canUseImproved = false; |
3807 | { | ||
3808 | // Self updates go into a special list | ||
3809 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3810 | terseAgentUpdates.Value.Add(update); | ||
3811 | } | ||
3812 | else | ||
3813 | { | ||
3814 | // Everything else goes here | ||
3815 | terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); | ||
3816 | terseUpdates.Value.Add(update); | ||
3817 | } | ||
3818 | } | 3829 | } |
3819 | |||
3820 | #endregion Block Construction | ||
3821 | } | 3830 | } |
3822 | |||
3823 | |||
3824 | #region Packet Sending | ||
3825 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | ||
3826 | 3831 | ||
3827 | if (terseAgentUpdateBlocks.IsValueCreated) | 3832 | #endregion UpdateFlags to packet type conversion |
3828 | { | ||
3829 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | ||
3830 | 3833 | ||
3831 | ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); | 3834 | #region Block Construction |
3832 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3833 | packet.RegionData.TimeDilation = timeDilation; | ||
3834 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3835 | 3835 | ||
3836 | for (int i = 0; i < blocks.Count; i++) | 3836 | // TODO: Remove this once we can build compressed updates |
3837 | packet.ObjectData[i] = blocks[i]; | 3837 | canUseCompressed = false; |
3838 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
3839 | OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseAgentUpdates.Value, oPacket); }); | ||
3840 | } | ||
3841 | 3838 | ||
3842 | if (objectUpdateBlocks.IsValueCreated) | 3839 | if (!canUseImproved && !canUseCompressed) |
3843 | { | 3840 | { |
3844 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; | 3841 | if (update.Entity is ScenePresence) |
3845 | 3842 | { | |
3846 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | 3843 | objectUpdateBlocks.Value.Add(CreateAvatarUpdateBlock((ScenePresence)update.Entity)); |
3847 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 3844 | } |
3848 | packet.RegionData.TimeDilation = timeDilation; | 3845 | else |
3849 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 3846 | { |
3850 | 3847 | objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); | |
3851 | for (int i = 0; i < blocks.Count; i++) | 3848 | } |
3852 | packet.ObjectData[i] = blocks[i]; | ||
3853 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
3854 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(objectUpdates.Value, oPacket); }); | ||
3855 | } | 3849 | } |
3856 | 3850 | else if (!canUseImproved) | |
3857 | if (compressedUpdateBlocks.IsValueCreated) | ||
3858 | { | 3851 | { |
3859 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | 3852 | compressedUpdateBlocks.Value.Add(CreateCompressedUpdateBlock((SceneObjectPart)update.Entity, updateFlags)); |
3860 | |||
3861 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
3862 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3863 | packet.RegionData.TimeDilation = timeDilation; | ||
3864 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
3865 | |||
3866 | for (int i = 0; i < blocks.Count; i++) | ||
3867 | packet.ObjectData[i] = blocks[i]; | ||
3868 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
3869 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(compressedUpdates.Value, oPacket); }); | ||
3870 | } | 3853 | } |
3871 | 3854 | else | |
3872 | if (terseUpdateBlocks.IsValueCreated) | ||
3873 | { | 3855 | { |
3874 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | 3856 | if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) |
3875 | 3857 | // Self updates go into a special list | |
3876 | ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); | 3858 | terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); |
3877 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | 3859 | else |
3878 | packet.RegionData.TimeDilation = timeDilation; | 3860 | // Everything else goes here |
3879 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | 3861 | terseUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); |
3880 | |||
3881 | for (int i = 0; i < blocks.Count; i++) | ||
3882 | packet.ObjectData[i] = blocks[i]; | ||
3883 | // If any of the packets created from this call go unacknowledged, all of the updates will be resent | ||
3884 | OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); | ||
3885 | } | 3862 | } |
3863 | |||
3864 | #endregion Block Construction | ||
3865 | } | ||
3866 | |||
3867 | #region Packet Sending | ||
3868 | |||
3869 | const float TIME_DILATION = 1.0f; | ||
3870 | ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); | ||
3871 | |||
3872 | if (terseAgentUpdateBlocks.IsValueCreated) | ||
3873 | { | ||
3874 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value; | ||
3875 | |||
3876 | ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); | ||
3877 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3878 | packet.RegionData.TimeDilation = timeDilation; | ||
3879 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3880 | |||
3881 | for (int i = 0; i < blocks.Count; i++) | ||
3882 | packet.ObjectData[i] = blocks[i]; | ||
3883 | |||
3884 | OutPacket(packet, ThrottleOutPacketType.Unknown, true); | ||
3885 | } | ||
3886 | |||
3887 | if (objectUpdateBlocks.IsValueCreated) | ||
3888 | { | ||
3889 | List<ObjectUpdatePacket.ObjectDataBlock> blocks = objectUpdateBlocks.Value; | ||
3890 | |||
3891 | ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | ||
3892 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3893 | packet.RegionData.TimeDilation = timeDilation; | ||
3894 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3895 | |||
3896 | for (int i = 0; i < blocks.Count; i++) | ||
3897 | packet.ObjectData[i] = blocks[i]; | ||
3898 | |||
3899 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
3900 | } | ||
3901 | |||
3902 | if (compressedUpdateBlocks.IsValueCreated) | ||
3903 | { | ||
3904 | List<ObjectUpdateCompressedPacket.ObjectDataBlock> blocks = compressedUpdateBlocks.Value; | ||
3905 | |||
3906 | ObjectUpdateCompressedPacket packet = (ObjectUpdateCompressedPacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdateCompressed); | ||
3907 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3908 | packet.RegionData.TimeDilation = timeDilation; | ||
3909 | packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count]; | ||
3910 | |||
3911 | for (int i = 0; i < blocks.Count; i++) | ||
3912 | packet.ObjectData[i] = blocks[i]; | ||
3913 | |||
3914 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
3915 | } | ||
3916 | |||
3917 | if (terseUpdateBlocks.IsValueCreated) | ||
3918 | { | ||
3919 | List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseUpdateBlocks.Value; | ||
3920 | |||
3921 | ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); | ||
3922 | packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; | ||
3923 | packet.RegionData.TimeDilation = timeDilation; | ||
3924 | packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; | ||
3925 | |||
3926 | for (int i = 0; i < blocks.Count; i++) | ||
3927 | packet.ObjectData[i] = blocks[i]; | ||
3928 | |||
3929 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
3886 | } | 3930 | } |
3887 | 3931 | ||
3888 | #endregion Packet Sending | 3932 | #endregion Packet Sending |
@@ -4175,11 +4219,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4175 | 4219 | ||
4176 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties | 4220 | // Pass in the delegate so that if this packet needs to be resent, we send the current properties |
4177 | // of the object rather than the properties when the packet was created | 4221 | // of the object rather than the properties when the packet was created |
4178 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4222 | // HACK : Remove intelligent resending until it's fixed in core |
4179 | delegate(OutgoingPacket oPacket) | 4223 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4180 | { | 4224 | // delegate(OutgoingPacket oPacket) |
4181 | ResendPropertyUpdates(updates, oPacket); | 4225 | // { |
4182 | }); | 4226 | // ResendPropertyUpdates(updates, oPacket); |
4227 | // }); | ||
4228 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4183 | 4229 | ||
4184 | // pbcnt += blocks.Count; | 4230 | // pbcnt += blocks.Count; |
4185 | // ppcnt++; | 4231 | // ppcnt++; |
@@ -4205,11 +4251,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4205 | // of the object rather than the properties when the packet was created | 4251 | // of the object rather than the properties when the packet was created |
4206 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); | 4252 | List<ObjectPropertyUpdate> updates = new List<ObjectPropertyUpdate>(); |
4207 | updates.Add(familyUpdates.Value[i]); | 4253 | updates.Add(familyUpdates.Value[i]); |
4208 | OutPacket(packet, ThrottleOutPacketType.Task, true, | 4254 | // HACK : Remove intelligent resending until it's fixed in core |
4209 | delegate(OutgoingPacket oPacket) | 4255 | //OutPacket(packet, ThrottleOutPacketType.Task, true, |
4210 | { | 4256 | // delegate(OutgoingPacket oPacket) |
4211 | ResendPropertyUpdates(updates, oPacket); | 4257 | // { |
4212 | }); | 4258 | // ResendPropertyUpdates(updates, oPacket); |
4259 | // }); | ||
4260 | OutPacket(packet, ThrottleOutPacketType.Task, true); | ||
4213 | 4261 | ||
4214 | // fpcnt++; | 4262 | // fpcnt++; |
4215 | // fbcnt++; | 4263 | // fbcnt++; |
@@ -4358,37 +4406,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4358 | if (bl[i].BannedUserID == UUID.Zero) | 4406 | if (bl[i].BannedUserID == UUID.Zero) |
4359 | continue; | 4407 | continue; |
4360 | BannedUsers.Add(bl[i].BannedUserID); | 4408 | BannedUsers.Add(bl[i].BannedUserID); |
4361 | } | ||
4362 | 4409 | ||
4363 | EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); | 4410 | if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0)) |
4364 | packet.AgentData.TransactionID = UUID.Random(); | 4411 | { |
4365 | packet.AgentData.AgentID = AgentId; | 4412 | EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); |
4366 | packet.AgentData.SessionID = SessionId; | 4413 | packet.AgentData.TransactionID = UUID.Random(); |
4367 | packet.MethodData.Invoice = invoice; | 4414 | packet.AgentData.AgentID = AgentId; |
4368 | packet.MethodData.Method = Utils.StringToBytes("setaccess"); | 4415 | packet.AgentData.SessionID = SessionId; |
4416 | packet.MethodData.Invoice = invoice; | ||
4417 | packet.MethodData.Method = Utils.StringToBytes("setaccess"); | ||
4369 | 4418 | ||
4370 | EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count]; | 4419 | EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count]; |
4371 | 4420 | ||
4372 | for (int i = 0; i < (6 + BannedUsers.Count); i++) | 4421 | int j; |
4373 | { | 4422 | for (j = 0; j < (6 + BannedUsers.Count); j++) |
4374 | returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); | 4423 | { |
4375 | } | 4424 | returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock(); |
4376 | int j = 0; | 4425 | } |
4426 | j = 0; | ||
4377 | 4427 | ||
4378 | returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; | 4428 | returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; |
4379 | returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; | 4429 | returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; |
4380 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; | 4430 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; |
4381 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; | 4431 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; |
4382 | returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++; | 4432 | returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++; |
4383 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; | 4433 | returnblock[j].Parameter = Utils.StringToBytes("0"); j++; |
4384 | 4434 | ||
4385 | foreach (UUID banned in BannedUsers) | 4435 | foreach (UUID banned in BannedUsers) |
4386 | { | 4436 | { |
4387 | returnblock[j].Parameter = banned.GetBytes(); j++; | 4437 | returnblock[j].Parameter = banned.GetBytes(); j++; |
4438 | } | ||
4439 | packet.ParamList = returnblock; | ||
4440 | packet.Header.Reliable = true; | ||
4441 | OutPacket(packet, ThrottleOutPacketType.Task); | ||
4442 | |||
4443 | BannedUsers.Clear(); | ||
4444 | } | ||
4388 | } | 4445 | } |
4389 | packet.ParamList = returnblock; | 4446 | |
4390 | packet.Header.Reliable = false; | ||
4391 | OutPacket(packet, ThrottleOutPacketType.Task); | ||
4392 | } | 4447 | } |
4393 | 4448 | ||
4394 | public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) | 4449 | public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) |
@@ -4557,7 +4612,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4557 | 4612 | ||
4558 | if (landData.SimwideArea > 0) | 4613 | if (landData.SimwideArea > 0) |
4559 | { | 4614 | { |
4560 | int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 4615 | int simulatorCapacity = (int)((double)(landData.SimwideArea * m_scene.RegionInfo.ObjectCapacity) * m_scene.RegionInfo.RegionSettings.ObjectBonus) / 65536; |
4616 | // Never report more than sim total capacity | ||
4617 | if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity) | ||
4618 | simulatorCapacity = m_scene.RegionInfo.ObjectCapacity; | ||
4561 | updateMessage.SimWideMaxPrims = simulatorCapacity; | 4619 | updateMessage.SimWideMaxPrims = simulatorCapacity; |
4562 | } | 4620 | } |
4563 | else | 4621 | else |
@@ -4686,14 +4744,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4686 | 4744 | ||
4687 | if (notifyCount > 0) | 4745 | if (notifyCount > 0) |
4688 | { | 4746 | { |
4689 | if (notifyCount > 32) | 4747 | // if (notifyCount > 32) |
4690 | { | 4748 | // { |
4691 | m_log.InfoFormat( | 4749 | // m_log.InfoFormat( |
4692 | "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" | 4750 | // "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" |
4693 | + " - a developer might want to investigate whether this is a hard limit", 32); | 4751 | // + " - a developer might want to investigate whether this is a hard limit", 32); |
4694 | 4752 | // | |
4695 | notifyCount = 32; | 4753 | // notifyCount = 32; |
4696 | } | 4754 | // } |
4697 | 4755 | ||
4698 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock | 4756 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock |
4699 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; | 4757 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; |
@@ -5226,6 +5284,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5226 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); | 5284 | AddLocalPacketHandler(PacketType.TransferAbort, HandleTransferAbort, false); |
5227 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); | 5285 | AddLocalPacketHandler(PacketType.MuteListRequest, HandleMuteListRequest, false); |
5228 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); | 5286 | AddLocalPacketHandler(PacketType.UseCircuitCode, HandleUseCircuitCode); |
5287 | AddLocalPacketHandler(PacketType.CreateNewOutfitAttachments, HandleCreateNewOutfitAttachments); | ||
5229 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); | 5288 | AddLocalPacketHandler(PacketType.AgentHeightWidth, HandleAgentHeightWidth, false); |
5230 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); | 5289 | AddLocalPacketHandler(PacketType.InventoryDescendents, HandleInventoryDescendents); |
5231 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); | 5290 | AddLocalPacketHandler(PacketType.DirPlacesQuery, HandleDirPlacesQuery); |
@@ -5292,6 +5351,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5292 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); | 5351 | AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); |
5293 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); | 5352 | AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); |
5294 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); | 5353 | AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); |
5354 | AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags); | ||
5295 | 5355 | ||
5296 | AddGenericPacketHandler("autopilot", HandleAutopilot); | 5356 | AddGenericPacketHandler("autopilot", HandleAutopilot); |
5297 | } | 5357 | } |
@@ -5327,6 +5387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5327 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || | 5387 | (x.CameraLeftAxis != lastarg.CameraLeftAxis) || |
5328 | (x.CameraUpAxis != lastarg.CameraUpAxis) || | 5388 | (x.CameraUpAxis != lastarg.CameraUpAxis) || |
5329 | (x.ControlFlags != lastarg.ControlFlags) || | 5389 | (x.ControlFlags != lastarg.ControlFlags) || |
5390 | (x.ControlFlags != 0) || | ||
5330 | (x.Far != lastarg.Far) || | 5391 | (x.Far != lastarg.Far) || |
5331 | (x.Flags != lastarg.Flags) || | 5392 | (x.Flags != lastarg.Flags) || |
5332 | (x.State != lastarg.State) || | 5393 | (x.State != lastarg.State) || |
@@ -5704,7 +5765,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5704 | args.Channel = ch; | 5765 | args.Channel = ch; |
5705 | args.From = String.Empty; | 5766 | args.From = String.Empty; |
5706 | args.Message = Utils.BytesToString(msg); | 5767 | args.Message = Utils.BytesToString(msg); |
5707 | args.Type = ChatTypeEnum.Shout; | 5768 | args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance |
5708 | args.Position = new Vector3(); | 5769 | args.Position = new Vector3(); |
5709 | args.Scene = Scene; | 5770 | args.Scene = Scene; |
5710 | args.Sender = this; | 5771 | args.Sender = this; |
@@ -9716,7 +9777,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9716 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, | 9777 | handlerUpdateMuteListEntry(this, UpdateMuteListEntry.MuteData.MuteID, |
9717 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), | 9778 | Utils.BytesToString(UpdateMuteListEntry.MuteData.MuteName), |
9718 | UpdateMuteListEntry.MuteData.MuteType, | 9779 | UpdateMuteListEntry.MuteData.MuteType, |
9719 | UpdateMuteListEntry.AgentData.AgentID); | 9780 | UpdateMuteListEntry.MuteData.MuteFlags); |
9720 | return true; | 9781 | return true; |
9721 | } | 9782 | } |
9722 | return false; | 9783 | return false; |
@@ -9731,8 +9792,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9731 | { | 9792 | { |
9732 | handlerRemoveMuteListEntry(this, | 9793 | handlerRemoveMuteListEntry(this, |
9733 | RemoveMuteListEntry.MuteData.MuteID, | 9794 | RemoveMuteListEntry.MuteData.MuteID, |
9734 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName), | 9795 | Utils.BytesToString(RemoveMuteListEntry.MuteData.MuteName)); |
9735 | RemoveMuteListEntry.AgentData.AgentID); | ||
9736 | return true; | 9796 | return true; |
9737 | } | 9797 | } |
9738 | return false; | 9798 | return false; |
@@ -9776,10 +9836,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9776 | return false; | 9836 | return false; |
9777 | } | 9837 | } |
9778 | 9838 | ||
9839 | private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet) | ||
9840 | { | ||
9841 | ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags = | ||
9842 | (ChangeInventoryItemFlagsPacket)packet; | ||
9843 | ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags; | ||
9844 | if (handlerChangeInventoryItemFlags != null) | ||
9845 | { | ||
9846 | foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData) | ||
9847 | handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags); | ||
9848 | return true; | ||
9849 | } | ||
9850 | return false; | ||
9851 | } | ||
9852 | |||
9779 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) | 9853 | private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) |
9780 | { | 9854 | { |
9781 | return true; | 9855 | return true; |
9782 | } | 9856 | } |
9857 | |||
9858 | private bool HandleCreateNewOutfitAttachments(IClientAPI sender, Packet Pack) | ||
9859 | { | ||
9860 | CreateNewOutfitAttachmentsPacket packet = (CreateNewOutfitAttachmentsPacket)Pack; | ||
9861 | |||
9862 | #region Packet Session and User Check | ||
9863 | if (m_checkPackets) | ||
9864 | { | ||
9865 | if (packet.AgentData.SessionID != SessionId || | ||
9866 | packet.AgentData.AgentID != AgentId) | ||
9867 | return true; | ||
9868 | } | ||
9869 | #endregion | ||
9870 | MoveItemsAndLeaveCopy handlerMoveItemsAndLeaveCopy = null; | ||
9871 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
9872 | foreach (CreateNewOutfitAttachmentsPacket.ObjectDataBlock n in packet.ObjectData) | ||
9873 | { | ||
9874 | InventoryItemBase b = new InventoryItemBase(); | ||
9875 | b.ID = n.OldItemID; | ||
9876 | b.Folder = n.OldFolderID; | ||
9877 | items.Add(b); | ||
9878 | } | ||
9879 | |||
9880 | handlerMoveItemsAndLeaveCopy = OnMoveItemsAndLeaveCopy; | ||
9881 | if (handlerMoveItemsAndLeaveCopy != null) | ||
9882 | { | ||
9883 | handlerMoveItemsAndLeaveCopy(this, items, packet.HeaderData.NewFolderID); | ||
9884 | } | ||
9885 | |||
9886 | return true; | ||
9887 | } | ||
9783 | 9888 | ||
9784 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) | 9889 | private bool HandleAgentHeightWidth(IClientAPI sender, Packet Pack) |
9785 | { | 9890 | { |
@@ -10206,6 +10311,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10206 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; | 10311 | groupProfileReply.GroupData.MaturePublish = d.MaturePublish; |
10207 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; | 10312 | groupProfileReply.GroupData.OwnerRole = d.OwnerRole; |
10208 | 10313 | ||
10314 | Scene scene = (Scene)m_scene; | ||
10315 | if (scene.Permissions.IsGod(sender.AgentId) && (!sender.IsGroupMember(groupProfileRequest.GroupData.GroupID))) | ||
10316 | { | ||
10317 | ScenePresence p; | ||
10318 | if (scene.TryGetScenePresence(sender.AgentId, out p)) | ||
10319 | { | ||
10320 | if (p.GodLevel >= 200) | ||
10321 | { | ||
10322 | groupProfileReply.GroupData.OpenEnrollment = true; | ||
10323 | groupProfileReply.GroupData.MembershipFee = 0; | ||
10324 | } | ||
10325 | } | ||
10326 | } | ||
10327 | |||
10209 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); | 10328 | OutPacket(groupProfileReply, ThrottleOutPacketType.Task); |
10210 | } | 10329 | } |
10211 | return true; | 10330 | return true; |
@@ -10779,11 +10898,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10779 | 10898 | ||
10780 | StartLure handlerStartLure = OnStartLure; | 10899 | StartLure handlerStartLure = OnStartLure; |
10781 | if (handlerStartLure != null) | 10900 | if (handlerStartLure != null) |
10782 | handlerStartLure(startLureRequest.Info.LureType, | 10901 | { |
10783 | Utils.BytesToString( | 10902 | for (int i = 0 ; i < startLureRequest.TargetData.Length ; i++) |
10784 | startLureRequest.Info.Message), | 10903 | { |
10785 | startLureRequest.TargetData[0].TargetID, | 10904 | handlerStartLure(startLureRequest.Info.LureType, |
10786 | this); | 10905 | Utils.BytesToString( |
10906 | startLureRequest.Info.Message), | ||
10907 | startLureRequest.TargetData[i].TargetID, | ||
10908 | this); | ||
10909 | } | ||
10910 | } | ||
10787 | return true; | 10911 | return true; |
10788 | } | 10912 | } |
10789 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) | 10913 | private bool HandleTeleportLureRequest(IClientAPI sender, Packet Pack) |
@@ -10897,10 +11021,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
10897 | } | 11021 | } |
10898 | #endregion | 11022 | #endregion |
10899 | 11023 | ||
10900 | ClassifiedDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; | 11024 | ClassifiedGodDelete handlerClassifiedGodDelete = OnClassifiedGodDelete; |
10901 | if (handlerClassifiedGodDelete != null) | 11025 | if (handlerClassifiedGodDelete != null) |
10902 | handlerClassifiedGodDelete( | 11026 | handlerClassifiedGodDelete( |
10903 | classifiedGodDelete.Data.ClassifiedID, | 11027 | classifiedGodDelete.Data.ClassifiedID, |
11028 | classifiedGodDelete.Data.QueryID, | ||
10904 | this); | 11029 | this); |
10905 | return true; | 11030 | return true; |
10906 | } | 11031 | } |
@@ -11944,7 +12069,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11944 | 12069 | ||
11945 | // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); | 12070 | // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); |
11946 | 12071 | ||
12072 | |||
12073 | //Note, the bool returned from the below function is useless since it is always false. | ||
11947 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); | 12074 | m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); |
12075 | |||
11948 | } | 12076 | } |
11949 | 12077 | ||
11950 | /// <summary> | 12078 | /// <summary> |