*Fixed bug that incorrectly tabulated 'others' prims on a parcel

*Added support for selected prims (does not yet support prims being sat on)
*Added support for listing avatars with prims on parcel with their prim count
afrisby
mingchen 2007-07-16 01:25:16 +00:00
parent 9685c65901
commit 7f10179129
10 changed files with 119 additions and 14 deletions

View File

@ -54,6 +54,7 @@ namespace OpenSim.Framework.Interfaces
public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock);
public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); public delegate void ObjectSelect(uint localID, IClientAPI remoteClient);
public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient);
public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient);
public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient); public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient);
@ -71,7 +72,7 @@ namespace OpenSim.Framework.Interfaces
public delegate void ParcelJoinRequest(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); 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 ParcelSelectObjects(int parcel_local_id, int request_type, IClientAPI remote_client);
public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client);
public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client); public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client);
public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client);
@ -106,6 +107,7 @@ namespace OpenSim.Framework.Interfaces
event UpdateShape OnUpdatePrimShape; event UpdateShape OnUpdatePrimShape;
event ObjectSelect OnObjectSelect; event ObjectSelect OnObjectSelect;
event ObjectDeselect OnObjectDeselect;
event GenericCall7 OnObjectDescription; event GenericCall7 OnObjectDescription;
event GenericCall7 OnObjectName; event GenericCall7 OnObjectName;
event UpdatePrimFlags OnUpdatePrimFlags; event UpdatePrimFlags OnUpdatePrimFlags;
@ -128,7 +130,7 @@ namespace OpenSim.Framework.Interfaces
event ParcelJoinRequest OnParcelJoinRequest; event ParcelJoinRequest OnParcelJoinRequest;
event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
event ParcelSelectObjects OnParcelSelectObjects; event ParcelSelectObjects OnParcelSelectObjects;
event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
event EstateOwnerMessageRequest OnEstateOwnerMessage; event EstateOwnerMessageRequest OnEstateOwnerMessage;
LLVector3 StartPos LLVector3 StartPos

View File

@ -49,6 +49,7 @@ namespace OpenSim.Framework.Types
public int groupPrims = 0; public int groupPrims = 0;
public int otherPrims = 0; public int otherPrims = 0;
public int ownerPrims = 0; public int ownerPrims = 0;
public int selectedPrims = 0;
public int simwidePrims = 0; public int simwidePrims = 0;
public int simwideArea = 0; public int simwideArea = 0;
public int salePrice = 0; //Unemeplemented. Parcels price. public int salePrice = 0; //Unemeplemented. Parcels price.
@ -90,6 +91,7 @@ namespace OpenSim.Framework.Types
parcelData.groupPrims = this.groupPrims; parcelData.groupPrims = this.groupPrims;
parcelData.otherPrims = this.otherPrims; parcelData.otherPrims = this.otherPrims;
parcelData.ownerPrims = this.ownerPrims; parcelData.ownerPrims = this.ownerPrims;
parcelData.selectedPrims = this.selectedPrims;
parcelData.isGroupOwned = this.isGroupOwned; parcelData.isGroupOwned = this.isGroupOwned;
parcelData.localID = this.localID; parcelData.localID = this.localID;
parcelData.landingType = this.landingType; parcelData.landingType = this.landingType;

View File

@ -240,7 +240,7 @@ namespace OpenSim
LocalWorld.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero; LocalWorld.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero;
LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.ParcelManager); LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.ParcelManager);
} }
LocalWorld.performParcelPrimCountUpdate();
LocalWorld.StartTimer(); LocalWorld.StartTimer();
} }
} }

View File

@ -61,6 +61,7 @@ namespace OpenSim.Region.ClientStack
public event AddNewPrim OnAddPrim; public event AddNewPrim OnAddPrim;
public event UpdateShape OnUpdatePrimShape; public event UpdateShape OnUpdatePrimShape;
public event ObjectSelect OnObjectSelect; public event ObjectSelect OnObjectSelect;
public event ObjectDeselect OnObjectDeselect;
public event GenericCall7 OnObjectDescription; public event GenericCall7 OnObjectDescription;
public event GenericCall7 OnObjectName; public event GenericCall7 OnObjectName;
public event UpdatePrimFlags OnUpdatePrimFlags; public event UpdatePrimFlags OnUpdatePrimFlags;
@ -85,7 +86,7 @@ namespace OpenSim.Region.ClientStack
public event ParcelJoinRequest OnParcelJoinRequest; public event ParcelJoinRequest OnParcelJoinRequest;
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public event ParcelSelectObjects OnParcelSelectObjects; public event ParcelSelectObjects OnParcelSelectObjects;
public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
public event EstateOwnerMessageRequest OnEstateOwnerMessage; public event EstateOwnerMessageRequest OnEstateOwnerMessage;
/// <summary> /// <summary>

View File

@ -279,6 +279,16 @@ namespace OpenSim.Region.ClientStack
} }
} }
break; break;
case PacketType.ObjectDeselect:
ObjectDeselectPacket incomingdeselect = (ObjectDeselectPacket)Pack;
for (int i = 0; i < incomingdeselect.ObjectData.Length; i++)
{
if (OnObjectDeselect != null)
{
OnObjectDeselect(incomingdeselect.ObjectData[i].ObjectLocalID, this);
}
}
break;
case PacketType.ObjectFlagUpdate: case PacketType.ObjectFlagUpdate:
ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
if (OnUpdatePrimFlags != null) if (OnUpdatePrimFlags != null)
@ -601,6 +611,14 @@ namespace OpenSim.Region.ClientStack
OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); OnParcelSelectObjects(selectPacket.ParcelData.LocalID, Convert.ToInt32(selectPacket.ParcelData.ReturnType), this);
} }
break; break;
case PacketType.ParcelObjectOwnersRequest:
ParcelObjectOwnersRequestPacket reqPacket = (ParcelObjectOwnersRequestPacket)Pack;
if (OnParcelObjectOwnerRequest != null)
{
OnParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this);
}
break;
#endregion #endregion
#region Estate Packets #region Estate Packets

View File

@ -33,6 +33,7 @@ using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence;
using System.IO;
namespace OpenSim.Region.Environment namespace OpenSim.Region.Environment
{ {
@ -501,6 +502,11 @@ namespace OpenSim.Region.Environment
{ {
parcelList[local_id].sendForceObjectSelect(local_id, request_type, remote_client); parcelList[local_id].sendForceObjectSelect(local_id, request_type, remote_client);
} }
public void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client)
{
parcelList[local_id].sendParcelObjectOwners(remote_client);
}
#endregion #endregion
/// <summary> /// <summary>
@ -591,7 +597,7 @@ namespace OpenSim.Region.Environment
foreach (Parcel p in parcelOwnersAndParcels[owner]) foreach (Parcel p in parcelOwnersAndParcels[owner])
{ {
simArea += p.parcelData.area; simArea += p.parcelData.area;
simPrims += p.parcelData.ownerPrims + p.parcelData.otherPrims + p.parcelData.groupPrims; simPrims += p.parcelData.ownerPrims + p.parcelData.otherPrims + p.parcelData.groupPrims + p.parcelData.selectedPrims;
} }
foreach (Parcel p in parcelOwnersAndParcels[owner]) foreach (Parcel p in parcelOwnersAndParcels[owner])
@ -713,7 +719,7 @@ namespace OpenSim.Region.Environment
updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName); updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName);
updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented
updatePacket.ParcelData.OtherCount = 0; //unemplemented updatePacket.ParcelData.OtherCount = 0; //unemplemented
updatePacket.ParcelData.OtherPrims = parcelData.groupPrims; updatePacket.ParcelData.OtherPrims = parcelData.otherPrims;
updatePacket.ParcelData.OwnerID = parcelData.ownerID; updatePacket.ParcelData.OwnerID = parcelData.ownerID;
updatePacket.ParcelData.OwnerPrims = parcelData.ownerPrims; updatePacket.ParcelData.OwnerPrims = parcelData.ownerPrims;
updatePacket.ParcelData.ParcelFlags = parcelData.parcelFlags; updatePacket.ParcelData.ParcelFlags = parcelData.parcelFlags;
@ -728,7 +734,7 @@ namespace OpenSim.Region.Environment
updatePacket.ParcelData.RentPrice = 0; updatePacket.ParcelData.RentPrice = 0;
updatePacket.ParcelData.RequestResult = request_result; updatePacket.ParcelData.RequestResult = request_result;
updatePacket.ParcelData.SalePrice = parcelData.salePrice; updatePacket.ParcelData.SalePrice = parcelData.salePrice;
updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented updatePacket.ParcelData.SelectedPrims = parcelData.selectedPrims;
updatePacket.ParcelData.SelfCount = 0;//unemplemented updatePacket.ParcelData.SelfCount = 0;//unemplemented
updatePacket.ParcelData.SequenceID = sequence_id; updatePacket.ParcelData.SequenceID = sequence_id;
if (parcelData.simwideArea > 0) if (parcelData.simwideArea > 0)
@ -743,7 +749,7 @@ namespace OpenSim.Region.Environment
updatePacket.ParcelData.SnapSelection = snap_selection; updatePacket.ParcelData.SnapSelection = snap_selection;
updatePacket.ParcelData.SnapshotID = parcelData.snapshotID; updatePacket.ParcelData.SnapshotID = parcelData.snapshotID;
updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus; updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus;
updatePacket.ParcelData.TotalPrims = parcelData.ownerPrims + parcelData.groupPrims + parcelData.otherPrims; updatePacket.ParcelData.TotalPrims = parcelData.ownerPrims + parcelData.groupPrims + parcelData.otherPrims + parcelData.selectedPrims;
updatePacket.ParcelData.UserLocation = parcelData.userLocation; updatePacket.ParcelData.UserLocation = parcelData.userLocation;
updatePacket.ParcelData.UserLookAt = parcelData.userLookAt; updatePacket.ParcelData.UserLookAt = parcelData.userLookAt;
remote_client.OutPacket((Packet)updatePacket); remote_client.OutPacket((Packet)updatePacket);
@ -1042,7 +1048,7 @@ namespace OpenSim.Region.Environment
bool firstCall = true; bool firstCall = true;
int MAX_OBJECTS_PER_PACKET = 255; int MAX_OBJECTS_PER_PACKET = 251;
ForceObjectSelectPacket pack = new ForceObjectSelectPacket(); ForceObjectSelectPacket pack = new ForceObjectSelectPacket();
ForceObjectSelectPacket.DataBlock[] data; ForceObjectSelectPacket.DataBlock[] data;
while (resultLocalIDs.Count > 0) while (resultLocalIDs.Count > 0)
@ -1074,16 +1080,55 @@ namespace OpenSim.Region.Environment
resultLocalIDs.RemoveAt(0); resultLocalIDs.RemoveAt(0);
} }
pack.Data = data; pack.Data = data;
remote_client.OutPacket((Packet)pack); remote_client.OutPacket((Packet)pack);
} }
} }
public void sendParcelObjectOwners(IClientAPI remote_client)
{
Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID,int>();
foreach(SceneObject obj in primsOverMe)
{
if(!ownersAndCount.ContainsKey(obj.rootPrimitive.OwnerID))
{
ownersAndCount.Add(obj.rootPrimitive.OwnerID,0);
}
ownersAndCount[obj.rootPrimitive.OwnerID] += obj.primCount;
}
if (ownersAndCount.Count > 0)
{
ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32];
if(ownersAndCount.Count < 32)
{
dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[ownersAndCount.Count];
}
int num = 0;
foreach (LLUUID owner in ownersAndCount.Keys)
{
dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock();
dataBlock[num].Count = ownersAndCount[owner];
dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added
dataBlock[num].OnlineStatus = true; //TODO: fix me later
dataBlock[num].OwnerID = owner;
num++;
}
ParcelObjectOwnersReplyPacket pack = new ParcelObjectOwnersReplyPacket();
pack.Data = dataBlock;
remote_client.OutPacket(pack);
}
}
public void resetParcelPrimCounts() public void resetParcelPrimCounts()
{ {
parcelData.groupPrims = 0; parcelData.groupPrims = 0;
parcelData.ownerPrims = 0; parcelData.ownerPrims = 0;
parcelData.groupPrims = 0; parcelData.otherPrims = 0;
parcelData.selectedPrims = 0;
primsOverMe.Clear(); primsOverMe.Clear();
} }
@ -1092,6 +1137,12 @@ namespace OpenSim.Region.Environment
LLUUID prim_owner = obj.rootPrimitive.OwnerID; LLUUID prim_owner = obj.rootPrimitive.OwnerID;
int prim_count = obj.primCount; int prim_count = obj.primCount;
if (obj.isSelected)
{
parcelData.selectedPrims += prim_count;
}
else
{
if (prim_owner == parcelData.ownerID) if (prim_owner == parcelData.ownerID)
{ {
parcelData.ownerPrims += prim_count; parcelData.ownerPrims += prim_count;
@ -1100,6 +1151,8 @@ namespace OpenSim.Region.Environment
{ {
parcelData.otherPrims += prim_count; parcelData.otherPrims += prim_count;
} }
}
primsOverMe.Add(obj); primsOverMe.Add(obj);
} }

View File

@ -341,6 +341,29 @@ namespace OpenSim.Region.Environment.Scenes
if (((SceneObject)ent).rootLocalID == primLocalID) if (((SceneObject)ent).rootLocalID == primLocalID)
{ {
((SceneObject)ent).GetProperites(remoteClient); ((SceneObject)ent).GetProperites(remoteClient);
((SceneObject)ent).isSelected = true;
this.ParcelManager.setPrimsTainted();
break;
}
}
}
}
/// <summary>
///
/// </summary>
/// <param name="primLocalID"></param>
/// <param name="remoteClient"></param>
public void DeselectPrim(uint primLocalID, IClientAPI remoteClient)
{
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObject)
{
if (((SceneObject)ent).rootLocalID == primLocalID)
{
((SceneObject)ent).isSelected = false;
this.ParcelManager.setPrimsTainted();
break; break;
} }
} }

View File

@ -537,6 +537,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnUpdatePrimTexture += this.UpdatePrimTexture; client.OnUpdatePrimTexture += this.UpdatePrimTexture;
client.OnTeleportLocationRequest += this.RequestTeleportLocation; client.OnTeleportLocationRequest += this.RequestTeleportLocation;
client.OnObjectSelect += this.SelectPrim; client.OnObjectSelect += this.SelectPrim;
client.OnObjectDeselect += this.DeselectPrim;
client.OnGrapUpdate += this.MoveObject; client.OnGrapUpdate += this.MoveObject;
client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
client.OnObjectDescription += this.PrimDescription; client.OnObjectDescription += this.PrimDescription;
@ -549,6 +550,8 @@ namespace OpenSim.Region.Environment.Scenes
client.OnParcelJoinRequest += new ParcelJoinRequest(m_parcelManager.handleParcelJoinRequest); client.OnParcelJoinRequest += new ParcelJoinRequest(m_parcelManager.handleParcelJoinRequest);
client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_parcelManager.handleParcelPropertiesUpdateRequest); client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_parcelManager.handleParcelPropertiesUpdateRequest);
client.OnParcelSelectObjects += new ParcelSelectObjects(m_parcelManager.handleParcelSelectObjectsRequest); client.OnParcelSelectObjects += new ParcelSelectObjects(m_parcelManager.handleParcelSelectObjectsRequest);
client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(m_parcelManager.handleParcelObjectOwnersRequest);
client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
} }

View File

@ -49,6 +49,8 @@ namespace OpenSim.Region.Environment.Scenes
private EventManager m_eventManager; private EventManager m_eventManager;
public bool isSelected = false;
public LLUUID rootUUID public LLUUID rootUUID
{ {
get get

View File

@ -71,6 +71,7 @@ namespace SimpleApp
world.LoadWorldMap(); world.LoadWorldMap();
world.PhysScene.SetTerrain(world.Terrain.getHeights1D()); world.PhysScene.SetTerrain(world.Terrain.getHeights1D());
world.performParcelPrimCountUpdate();
udpServer.LocalWorld = world; udpServer.LocalWorld = world;