diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index fbd239f300..4c6a0e0dc2 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs @@ -69,7 +69,8 @@ namespace OpenSim.Framework.Interfaces public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client); public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client); - public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); // NOTETOSELFremove the packet part + public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); + public delegate void ParcelSelectObjects(int parcel_local_id, int request_type, IClientAPI remote_client); public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client); @@ -126,6 +127,7 @@ namespace OpenSim.Framework.Interfaces event ParcelDivideRequest OnParcelDivideRequest; event ParcelJoinRequest OnParcelJoinRequest; event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; + event ParcelSelectObjects OnParcelSelectObjects; event EstateOwnerMessageRequest OnEstateOwnerMessage; diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 5458795a38..cf0e294a2f 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -84,6 +84,7 @@ namespace OpenSim.Region.ClientStack public event ParcelDivideRequest OnParcelDivideRequest; public event ParcelJoinRequest OnParcelJoinRequest; public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; + public event ParcelSelectObjects OnParcelSelectObjects; public event EstateOwnerMessageRequest OnEstateOwnerMessage; diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 169f2c4cc1..37591d9040 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -594,6 +594,13 @@ namespace OpenSim.Region.ClientStack } break; + case PacketType.ParcelSelectObjects: + ParcelSelectObjectsPacket selectPacket = (ParcelSelectObjectsPacket)Pack; + if (OnParcelSelectObjects != null) + { + OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); + } + break; #endregion #region Estate Packets diff --git a/OpenSim/Region/ClientStack/ClientViewBase.cs b/OpenSim/Region/ClientStack/ClientViewBase.cs index 2bc3ed80e9..cc04bda854 100644 --- a/OpenSim/Region/ClientStack/ClientViewBase.cs +++ b/OpenSim/Region/ClientStack/ClientViewBase.cs @@ -1,4 +1,3 @@ - /* * Copyright (c) Contributors, http://www.openmetaverse.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs index 4f836efe85..838a003d89 100644 --- a/OpenSim/Region/Environment/ParcelManager.cs +++ b/OpenSim/Region/Environment/ParcelManager.cs @@ -66,6 +66,12 @@ namespace OpenSim.Region.Environment public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel + //ParcelSelectObjects + public const int PARCEL_SELECT_OBJECTS_OWNER = 2; + public const int PARCEL_SELECT_OBJECTS_GROUP = 4; + public const int PARCEL_SELECT_OBJECTS_OTHER = 8; + + //These are other constants. Yay! public const int START_PARCEL_LOCAL_ID = 1; #endregion @@ -490,6 +496,11 @@ namespace OpenSim.Region.Environment join(west, south, east, north, remote_client.AgentId); } + + public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) + { + parcelList[local_id].sendForceObjectSelect(local_id, request_type, remote_client); + } #endregion /// @@ -532,10 +543,14 @@ namespace OpenSim.Region.Environment p.resetParcelPrimCounts(); } } + public void setPrimsTainted() + { + this.parcelPrimCountTainted = true; + } public void addPrimToParcelCounts(SceneObject obj) { - LLVector3 position = obj.rootPrimitive.Pos; + LLVector3 position = obj.Pos; Parcel parcelUnderPrim = getParcel(position.X, position.Y); if (parcelUnderPrim != null) { @@ -551,13 +566,6 @@ namespace OpenSim.Region.Environment } } - public void setPrimsTainted() - { - this.parcelPrimCountTainted = true; - } - - - public void finalizeParcelPrimCountUpdate() { //Get Simwide prim count for owner @@ -1010,6 +1018,67 @@ namespace OpenSim.Region.Environment } #endregion + public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) + { + List resultLocalIDs = new List(); + foreach (SceneObject obj in primsOverMe) + { + if (obj.rootLocalID > 0) + { + if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_OWNER && obj.rootPrimitive.OwnerID == this.parcelData.ownerID) + { + resultLocalIDs.Add(obj.rootLocalID); + } + else if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_GROUP && false) //TODO: change false to group support! + { + + } + else if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_OTHER && obj.rootPrimitive.OwnerID != remote_client.AgentId) + { + resultLocalIDs.Add(obj.rootLocalID); + } + } + } + + + bool firstCall = true; + int MAX_OBJECTS_PER_PACKET = 255; + ForceObjectSelectPacket pack = new ForceObjectSelectPacket(); + ForceObjectSelectPacket.DataBlock[] data; + while (resultLocalIDs.Count > 0) + { + if (firstCall) + { + pack._Header.ResetList = true; + firstCall = false; + } + else + { + pack._Header.ResetList = false; + } + + if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET) + { + data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET]; + } + else + { + data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count]; + } + + int i; + for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++) + { + data[i] = new ForceObjectSelectPacket.DataBlock(); + data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]); + resultLocalIDs.RemoveAt(0); + } + pack.Data = data; + + remote_client.OutPacket((Packet)pack); + } + + } public void resetParcelPrimCounts() { parcelData.groupPrims = 0; @@ -1027,10 +1096,6 @@ namespace OpenSim.Region.Environment { parcelData.ownerPrims += prim_count; } - else if (prim_owner == parcelData.groupID) - { - parcelData.groupPrims += prim_count; - } else { parcelData.otherPrims += prim_count; diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 0186ba8995..a06679a05d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -229,7 +229,7 @@ namespace OpenSim.Region.Environment.Scenes } this.parcelPrimCheckCount++; - if (this.parcelPrimCheckCount > 100) //check every 10 seconds for tainted prims + if (this.parcelPrimCheckCount > 50) //check every 5 seconds for tainted prims { if (m_parcelManager.parcelPrimCountTainted) { @@ -534,6 +534,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnParcelDivideRequest += new ParcelDivideRequest(m_parcelManager.handleParcelDivideRequest); client.OnParcelJoinRequest += new ParcelJoinRequest(m_parcelManager.handleParcelJoinRequest); client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_parcelManager.handleParcelPropertiesUpdateRequest); + client.OnParcelSelectObjects += new ParcelSelectObjects(m_parcelManager.handleParcelSelectObjectsRequest); client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 95db271bd8..c9255841bd 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -170,8 +170,7 @@ namespace OpenSim.Region.Environment.Scenes dupe.children.Add(dupe.rootPrimitive); dupe.rootPrimitive.Pos = this.Pos; dupe.Rotation = this.Rotation; - LLUUID rootu = dupe.rootUUID; - uint rooti = dupe.rootLocalID; + dupe.LocalId = m_world.PrimIDAllocate(); dupe.registerEvents(); return dupe;