From f5812b3702f38d4535f042303eef4bd37f8a448c Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 28 Mar 2009 01:40:33 +0000 Subject: [PATCH] * Adds AgentUUIDs into the CourseLocationUpdate to improve compatibility with LibOMV based clients. * Modifies the IClientAPI! So client stacks will need to be modified! --- OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 2 +- OpenSim/Framework/IClientAPI.cs | 2 +- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 9 +++++++-- OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 +++++- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 0da0743820..4f4bd93a4c 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -1001,7 +1001,7 @@ namespace OpenSim.Client.MXP.ClientStack Session.Send(me); } - public void SendCoarseLocationUpdate(List CoarseLocations) + public void SendCoarseLocationUpdate(List users, List CoarseLocations) { // Minimap function, not used. } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index ce4d411ab9..66699b152e 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -855,7 +855,7 @@ namespace OpenSim.Framework void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Vector3 velocity, Quaternion rotation); - void SendCoarseLocationUpdate(List CoarseLocations); + void SendCoarseLocationUpdate(List users, List CoarseLocations); void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID); void SetChildAgentThrottle(byte[] throttle); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 47585f9293..07f72c36e9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2674,7 +2674,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(terse, ThrottleOutPacketType.Task); } - public void SendCoarseLocationUpdate(List CoarseLocations) + public void SendCoarseLocationUpdate(List users, List CoarseLocations) { if (!IsActive) return; // We don't need to update inactive clients. @@ -2684,14 +2684,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP CoarseLocationUpdatePacket.IndexBlock ib = new CoarseLocationUpdatePacket.IndexBlock(); loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; + loc.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[total]; + for (int i = 0; i < total; i++) { CoarseLocationUpdatePacket.LocationBlock lb = new CoarseLocationUpdatePacket.LocationBlock(); lb.X = (byte)CoarseLocations[i].X; lb.Y = (byte)CoarseLocations[i].Y; - lb.Z = (byte)(CoarseLocations[i].Z / 4); + + lb.Z = CoarseLocations[i].Z > 1024 ? (byte)0 : (byte)(CoarseLocations[i].Z * 0.25); loc.Location[i] = lb; + loc.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock(); + loc.AgentData[i].AgentID = users[i]; } ib.You = -1; ib.Prey = -1; diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 599236e854..c5b6a1e819 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -499,7 +499,7 @@ namespace OpenSim.Region.Examples.SimpleModule { } - public virtual void SendCoarseLocationUpdate(List CoarseLocations) + public virtual void SendCoarseLocationUpdate(List users, List CoarseLocations) { } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 42820c4ba8..b05962435b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2178,6 +2178,7 @@ namespace OpenSim.Region.Framework.Scenes m_perfMonMS = System.Environment.TickCount; List CoarseLocations = new List(); + List AvatarUUIDs = new List(); List avatars = m_scene.GetAvatars(); for (int i = 0; i < avatars.Count; i++) { @@ -2190,21 +2191,24 @@ namespace OpenSim.Region.Framework.Scenes if (sop != null) { CoarseLocations.Add(sop.AbsolutePosition + avatars[i].m_pos); + AvatarUUIDs.Add(avatars[i].UUID); } else { // we can't find the parent.. ! arg! CoarseLocations.Add(avatars[i].m_pos); + AvatarUUIDs.Add(avatars[i].UUID); } } else { CoarseLocations.Add(avatars[i].m_pos); + AvatarUUIDs.Add(avatars[i].UUID); } } } - m_controllingClient.SendCoarseLocationUpdate(CoarseLocations); + m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index c182048a3c..e810b4eaf5 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -588,7 +588,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { } - public virtual void SendCoarseLocationUpdate(List CoarseLocations) + public virtual void SendCoarseLocationUpdate(List users, List CoarseLocations) { } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index b4b0bea1d1..fac018574d 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -586,7 +586,7 @@ namespace OpenSim.Tests.Common.Mock { } - public virtual void SendCoarseLocationUpdate(List CoarseLocations) + public virtual void SendCoarseLocationUpdate(List users, List CoarseLocations) { }