Megapatch. :) Fix skull attachment editing. Streamline Object terse updates.

Add rezzing time to objects. Add Object return and traffic fields to land
database. Add plumbing for auto return. Implement auto return.
Contains a migration. May contain nuts.
0.6.0-stable
Melanie Thielker 2008-10-18 05:51:36 +00:00
parent 0916b38b83
commit efe3f3eb2a
20 changed files with 419 additions and 226 deletions

View File

@ -994,6 +994,8 @@ namespace OpenSim.Data.MySQL
createCol(land, "UserLookAtY", typeof (Double));
createCol(land, "UserLookAtZ", typeof (Double));
createCol(land, "AuthBuyerID", typeof (String));
createCol(land, "OtherCleanTime", typeof(Int32));
createCol(land, "Dwell", typeof(Int32));
land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
@ -1357,6 +1359,8 @@ namespace OpenSim.Data.MySQL
UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer);
UUID.TryParse((string)row["SnapshotUUID"], out snapshotID);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
newData.AuthBuyerID = authedbuyer;
newData.SnapshotID = snapshotID;
@ -1661,6 +1665,8 @@ namespace OpenSim.Data.MySQL
row["UserLookAtY"] = land.UserLookAt.Y;
row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthBuyerID"] = land.AuthBuyerID;
row["OtherCleanTime"] = land.OtherCleanTime;
row["Dwell"] = land.Dwell;
}
/// <summary>

View File

@ -0,0 +1,7 @@
begin;
ALTER TABLE land ADD COLUMN OtherCleanTime integer NOT NULL default 0;
ALTER TABLE land ADD COLUMN Dwell integer NOT NULL default 0;
commit;

View File

@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE land ADD COLUMN OtherCleanTime INTEGER NOT NULL default 0;
ALTER TABLE land ADD COLUMN Dwell INTEGER NOT NULL default 0;
COMMIT;

View File

@ -992,6 +992,8 @@ namespace OpenSim.Data.SQLite
createCol(land, "UserLookAtY", typeof (Double));
createCol(land, "UserLookAtZ", typeof (Double));
createCol(land, "AuthbuyerID", typeof(String));
createCol(land, "OtherCleanTime", typeof(Int32));
createCol(land, "Dwell", typeof(Int32));
land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
@ -1315,6 +1317,9 @@ namespace OpenSim.Data.SQLite
UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID);
newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
newData.Dwell = Convert.ToInt32(row["Dwell"]);
return newData;
}
@ -1611,6 +1616,8 @@ namespace OpenSim.Data.SQLite
row["UserLookAtY"] = land.UserLookAt.Y;
row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthbuyerID"] = Util.ToRawUuidString(land.AuthBuyerID);
row["OtherCleanTime"] = land.OtherCleanTime;
row["Dwell"] = land.Dwell;
}
/// <summary>

View File

@ -715,7 +715,7 @@ namespace OpenSim.Framework.Communications.Cache
}
}
private InventoryFolderImpl FindFolderForType(int type)
public InventoryFolderImpl FindFolderForType(int type)
{
if (RootFolder == null)
return null;

View File

@ -95,6 +95,7 @@ namespace OpenSim.Framework
// really don't want to be passing packets in these events, so this is very temporary.
public delegate void GenericCall4(Packet packet, IClientAPI remoteClient);
public delegate void DeRezObject(IClientAPI remoteClient, uint localID, UUID groupID, byte destination, UUID destinationID);
public delegate void GenericCall5(IClientAPI remoteClient, bool status);
@ -319,6 +320,7 @@ namespace OpenSim.Framework
public delegate void DirPopularQuery(IClientAPI remoteClient, UUID queryID, uint queryFlags);
public delegate void DirClassifiedQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, uint category, int queryStart);
public delegate void EventInfoRequest(IClientAPI remoteClient, uint eventID);
public delegate void ParcelSetOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime);
public delegate void MapItemRequest(IClientAPI remoteClient, uint flags, uint EstateID, bool godlike, uint itemtype, ulong regionhandle);
@ -468,7 +470,7 @@ namespace OpenSim.Framework
event RequestAvatarProperties OnRequestAvatarProperties;
event SetAlwaysRun OnSetAlwaysRun;
event TeleportLandmarkRequest OnTeleportLandmarkRequest;
event GenericCall4 OnDeRezObject;
event DeRezObject OnDeRezObject;
event Action<IClientAPI> OnRegionHandShakeReply;
event GenericCall2 OnRequestWearables;
event GenericCall2 OnCompleteMovementToRegion;
@ -619,6 +621,7 @@ namespace OpenSim.Framework
event DirPopularQuery OnDirPopularQuery;
event DirClassifiedQuery OnDirClassifiedQuery;
event EventInfoRequest OnEventInfoRequest;
event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
event MapItemRequest OnMapItemRequest;
@ -700,9 +703,6 @@ namespace OpenSim.Framework
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId);
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity);
void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items,
List<InventoryFolderBase> folders, bool fetchFolders,
bool fetchItems);

View File

@ -77,6 +77,8 @@ namespace OpenSim.Framework
private UUID _snapshotID = UUID.Zero;
private Vector3 _userLocation = new Vector3();
private Vector3 _userLookAt = new Vector3();
private int _dwell = 0;
private int _otherCleanTime = 0;
public Vector3 AABBMax {
get {
@ -402,6 +404,24 @@ namespace OpenSim.Framework
}
}
public int Dwell {
get {
return _dwell;
}
set {
_dwell = value;
}
}
public int OtherCleanTime {
get {
return _otherCleanTime;
}
set {
_otherCleanTime = value;
}
}
public LandData()
{
_globalID = UUID.Random();
@ -444,6 +464,8 @@ namespace OpenSim.Framework
landData._snapshotID = _snapshotID;
landData._userLocation = _userLocation;
landData._userLookAt = _userLookAt;
landData._otherCleanTime = _otherCleanTime;
landData._dwell = _dwell;
landData._parcelAccessList.Clear();
foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)

View File

@ -132,7 +132,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private FriendActionDelegate handlerApproveFriendRequest = null; //OnApproveFriendRequest;
private FriendshipTermination handlerTerminateFriendship = null; //OnTerminateFriendship;
private RezObject handlerRezObject = null; //OnRezObject;
private GenericCall4 handlerDeRezObject = null; //OnDeRezObject;
private DeRezObject handlerDeRezObject = null; //OnDeRezObject;
private ModifyTerrain handlerModifyTerrain = null;
private BakeTerrain handlerBakeTerrain = null;
private EstateChangeInfo handlerEstateChangeInfo = null;
@ -269,6 +269,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private DirLandQuery handlerDirLandQuery = null;
private DirPopularQuery handlerDirPopularQuery = null;
private DirClassifiedQuery handlerDirClassifiedQuery = null;
private ParcelSetOtherCleanTime handlerParcelSetOtherCleanTime = null;
private MapItemRequest handlerMapItemRequest = null;
@ -851,7 +852,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event ChatMessage OnChatFromClient;
public event TextureRequest OnRequestTexture;
public event RezObject OnRezObject;
public event GenericCall4 OnDeRezObject;
public event DeRezObject OnDeRezObject;
public event ModifyTerrain OnModifyTerrain;
public event Action<IClientAPI> OnRegionHandShakeReply;
public event GenericCall2 OnRequestWearables;
@ -1004,6 +1005,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event DirPopularQuery OnDirPopularQuery;
public event DirClassifiedQuery OnDirClassifiedQuery;
public event EventInfoRequest OnEventInfoRequest;
public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
public event MapItemRequest OnMapItemRequest;
@ -2560,22 +2562,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(terse, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority);
}
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity)
{
if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0)
rotation = Quaternion.Identity;
ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
// TODO: don't create new blocks if recycling an old packet
terse.RegionData.RegionHandle = regionHandle;
terse.RegionData.TimeDilation = timeDilation;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = CreatePrimImprovedBlock(localID, position, rotation, velocity, rotationalvelocity, 0);
terse.Header.Reliable = false;
terse.Header.Zerocoded = true;
OutPacket(terse, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority);
}
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
{
AssetUploadCompletePacket newPack = new AssetUploadCompletePacket();
@ -2922,7 +2908,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updatePacket.ParcelData.AABBMin = landData.AABBMin;
updatePacket.ParcelData.Area = landData.Area;
updatePacket.ParcelData.AuctionID = landData.AuctionID;
updatePacket.ParcelData.AuthBuyerID = landData.AuthBuyerID; //unemplemented
updatePacket.ParcelData.AuthBuyerID = landData.AuthBuyerID;
updatePacket.ParcelData.Bitmap = landData.Bitmap;
@ -2950,7 +2936,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updatePacket.ParcelData.MediaURL = LLUtil.StringToPacketBytes(landData.MediaURL);
updatePacket.ParcelData.MusicURL = LLUtil.StringToPacketBytes(landData.MusicURL);
updatePacket.ParcelData.Name = Utils.StringToBytes(landData.Name);
updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented
updatePacket.ParcelData.OtherCleanTime = landData.OtherCleanTime;
updatePacket.ParcelData.OtherCount = 0; //unemplemented
updatePacket.ParcelData.OtherPrims = landData.OtherPrims;
updatePacket.ParcelData.OwnerID = landData.OwnerID;
@ -4190,10 +4176,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case PacketType.DeRezObject:
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) Pack;
handlerDeRezObject = OnDeRezObject;
if (handlerDeRezObject != null)
{
handlerDeRezObject(Pack, this);
foreach (DeRezObjectPacket.ObjectDataBlock data in
DeRezPacket.ObjectData)
{
handlerDeRezObject(this, data.ObjectLocalID,
DeRezPacket.AgentBlock.GroupID,
DeRezPacket.AgentBlock.Destination,
DeRezPacket.AgentBlock.DestinationID);
}
}
break;
case PacketType.ModifyLand:
@ -6443,6 +6437,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case PacketType.ParcelSetOtherCleanTime:
ParcelSetOtherCleanTimePacket parcelSetOtherCleanTimePacket = (ParcelSetOtherCleanTimePacket)Pack;
handlerParcelSetOtherCleanTime = OnParcelSetOtherCleanTime;
if (handlerParcelSetOtherCleanTime != null)
{
handlerParcelSetOtherCleanTime(this,
parcelSetOtherCleanTimePacket.ParcelData.LocalID,
parcelSetOtherCleanTimePacket.ParcelData.OtherCleanTime);
}
break;
default:
m_log.Warn("[CLIENT]: unhandled packet " + Pack.ToString());
break;

View File

@ -45,5 +45,6 @@ namespace OpenSim.Region.Environment.Interfaces
void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient);
void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel);
void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel);
void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime);
}
}

View File

@ -175,6 +175,15 @@ namespace OpenSim.Region.Environment.Modules.World.Land
m_landManagementModule.setSimulatorObjectMaxOverride(overrideDel);
}
}
public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
{
if (m_landManagementModule != null)
{
m_landManagementModule.setParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
}
}
#endregion
}

View File

@ -1233,5 +1233,20 @@ namespace OpenSim.Region.Environment.Modules.World.Land
else
m_log.Debug("[LAND] got no parcelinfo; not sending");
}
public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID,int otherCleanTime)
{
if (!landList.ContainsKey(localID))
return;
ILandObject landObject = landList[localID];
if (!m_scene.ExternalChecks.ExternalChecksCanEditParcel(remoteClient.AgentId, landObject))
return;
landObject.landData.OtherCleanTime = otherCleanTime;
UpdateLandObject(localID, landObject.landData);
}
}
}

View File

@ -184,7 +184,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event RequestAvatarProperties OnRequestAvatarProperties;
public event SetAlwaysRun OnSetAlwaysRun;
public event GenericCall4 OnDeRezObject;
public event DeRezObject OnDeRezObject;
public event Action<IClientAPI> OnRegionHandShakeReply;
public event GenericCall2 OnRequestWearables;
public event GenericCall2 OnCompleteMovementToRegion;
@ -330,6 +330,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event DirPopularQuery OnDirPopularQuery;
public event DirClassifiedQuery OnDirClassifiedQuery;
public event EventInfoRequest OnEventInfoRequest;
public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
public event MapItemRequest OnMapItemRequest;
@ -587,12 +588,6 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
{
}
public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
Vector3 position, Quaternion rotation, Vector3 velocity,
Vector3 rotationalvelocity)
{
}
public virtual void SendInventoryFolderDetails(UUID ownerID, UUID folderID,
List<InventoryItemBase> items,
List<InventoryFolderBase> folders,

View File

@ -38,8 +38,7 @@ namespace OpenSim.Region.Environment.Scenes
{
class DeleteToInventoryHolder
{
public DeRezObjectPacket DeRezPacket;
public EntityBase selectedEnt;
public int destination;
public IClientAPI remoteClient;
public SceneObjectGroup objectGroup;
public UUID folderID;
@ -70,20 +69,19 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary>
/// Delete the given object from the scene
/// </summary>
public void DeleteToInventory(
DeRezObjectPacket DeRezPacket, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient,
EntityBase selectedEnt, bool permissionToDelete)
public void DeleteToInventory(int destination, UUID folderID,
SceneObjectGroup objectGroup, IClientAPI remoteClient,
bool permissionToDelete)
{
m_inventoryTicker.Stop();
lock (m_inventoryDeletes)
{
DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();
dtis.DeRezPacket = DeRezPacket;
dtis.destination = destination;
dtis.folderID = folderID;
dtis.objectGroup = objectGroup;
dtis.remoteClient = remoteClient;
dtis.selectedEnt = selectedEnt;
dtis.permissionToDelete = permissionToDelete;
m_inventoryDeletes.Enqueue(dtis);
@ -121,8 +119,9 @@ namespace OpenSim.Region.Environment.Scenes
"[SCENE]: Sending deleted object to user's inventory, {0} item(s) remaining.", left);
x = m_inventoryDeletes.Dequeue();
m_scene.DeleteToInventory(
x.DeRezPacket, x.selectedEnt, x.remoteClient, x.objectGroup, x.folderID, x.permissionToDelete);
m_scene.DeleteToInventory(x.destination,
x.folderID, x.objectGroup, x.remoteClient,
x.permissionToDelete);
return true;
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenMetaverse;
namespace OpenSim.Region.Environment.Scenes
{
public struct ReturnInfo
{
public int count;
public Vector3 location;
public string objectName;
}
}

View File

@ -1517,78 +1517,90 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
/// <param name="packet"></param>
/// <param name="remoteClient"></param>
public virtual void DeRezObject(Packet packet, IClientAPI remoteClient)
public virtual void DeRezObject(IClientAPI remoteClient, uint localID,
UUID groupID, byte destination, UUID destinationID)
{
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
SceneObjectPart part = GetSceneObjectPart(localID);
if (part == null)
return;
UUID folderID = UUID.Zero;
if (part.ParentGroup == null || part.ParentGroup.RootPart == null)
return;
foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
// Can't delete child prims
if (part != part.ParentGroup.RootPart)
return;
SceneObjectGroup grp = part.ParentGroup;
bool permissionToTake = false;
bool permissionToDelete = false;
if (destination == 1) // Take Copy
{
// m_log.DebugFormat(
// "[AGENT INVENTORY]: Received request to derez {0} into folder {1}",
// Data.ObjectLocalID, DeRezPacket.AgentBlock.DestinationID);
permissionToTake =
ExternalChecks.ExternalChecksCanTakeCopyObject(
grp.UUID,
remoteClient.AgentId);
}
else if (destination == 5) // God take copy
{
permissionToTake =
ExternalChecks.ExternalChecksCanBeGodLike(
remoteClient.AgentId);
}
else if (destination == 4) // Take
{
permissionToTake =
ExternalChecks.ExternalChecksCanTakeObject(
grp.UUID,
remoteClient.AgentId);
EntityBase selectedEnt = null;
//m_log.Info("[CLIENT]: LocalID:" + Data.ObjectLocalID.ToString());
//If they can take, they can delete!
permissionToDelete = permissionToTake;
}
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
else if (destination == 6) //Delete
{
permissionToTake =
ExternalChecks.ExternalChecksCanDeleteObject(
grp.UUID,
remoteClient.AgentId);
permissionToDelete =
ExternalChecks.ExternalChecksCanDeleteObject(
grp.UUID,
remoteClient.AgentId);
}
else if (destination == 9) //Return
{
if (remoteClient != null)
{
if (ent.LocalId == Data.ObjectLocalID)
{
selectedEnt = ent;
break;
}
permissionToTake =
ExternalChecks.ExternalChecksCanDeleteObject(
grp.UUID,
remoteClient.AgentId);
permissionToDelete =
ExternalChecks.ExternalChecksCanDeleteObject(
grp.UUID,
remoteClient.AgentId);
}
if (selectedEnt != null)
else // Auto return passes through here with null agent
{
bool permissionToTake = false;
bool permissionToDelete = false;
if (DeRezPacket.AgentBlock.Destination == 1)// Take Copy
{
permissionToTake = ExternalChecks.ExternalChecksCanTakeCopyObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
permissionToDelete = false; //Just taking copy!
}
else if (DeRezPacket.AgentBlock.Destination == 5) //God take copy
{
permissionToTake = ExternalChecks.ExternalChecksCanBeGodLike(remoteClient.AgentId);
permissionToDelete = false; //Just taking copy!
}
else if (DeRezPacket.AgentBlock.Destination == 4) //Take
{
// Take
permissionToTake = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
permissionToDelete = permissionToTake; //If they can take, they can delete!
}
else if (DeRezPacket.AgentBlock.Destination == 6) //Delete
{
permissionToTake = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
}
else if (DeRezPacket.AgentBlock.Destination == 9) //Return
{
permissionToTake = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
}
SceneObjectGroup objectGroup = (SceneObjectGroup)selectedEnt;
if (permissionToTake)
{
m_asyncSceneObjectDeleter.DeleteToInventory(
DeRezPacket, folderID, objectGroup, remoteClient, selectedEnt, permissionToDelete);
}
else if (permissionToDelete)
{
DeleteSceneObject(objectGroup);
}
permissionToTake = true;
permissionToDelete = true;
}
}
if (permissionToTake)
{
m_asyncSceneObjectDeleter.DeleteToInventory(
destination, destinationID, grp, remoteClient,
permissionToDelete);
}
else if (permissionToDelete)
{
DeleteSceneObject(grp);
}
}
/// <summary>
@ -1600,51 +1612,50 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="objectGroup"></param>
/// <param name="folderID"></param>
/// <param name="permissionToDelete"></param>
public void DeleteToInventory(DeRezObjectPacket DeRezPacket, EntityBase selectedEnt, IClientAPI remoteClient,
SceneObjectGroup objectGroup, UUID folderID, bool permissionToDelete)
public void DeleteToInventory(int destination, UUID folderID,
SceneObjectGroup objectGroup, IClientAPI remoteClient,
bool permissionToDelete)
{
string sceneObjectXml = objectGroup.ToXmlString();
CachedUserInfo userInfo =
CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
CommsManager.UserProfileCacheService.GetUserDetails(
remoteClient.AgentId);
if (remoteClient == null)
{
userInfo = CommsManager.UserProfileCacheService.GetUserDetails(
objectGroup.RootPart.OwnerID);
}
else
{
userInfo = CommsManager.UserProfileCacheService.GetUserDetails(
remoteClient.AgentId);
}
if (userInfo != null)
{
// string searchFolder = "";
// If we're deleting someone else's item, it goes back to
// their deleted items folder
// If we're returning someone's item, it goes back to the
// owner's Lost And Found folder.
// if (DeRezPacket.AgentBlock.Destination == 6)
// searchFolder = "Trash";
// else if (DeRezPacket.AgentBlock.Destination == 9)
// searchFolder = "Lost And Found";
// If we're deleting someone else's item, it goes back to their deleted items folder
// If we're returning someone's item, it goes back to the owner's Lost And Found folder.
if (DeRezPacket.AgentBlock.DestinationID == UUID.Zero || (DeRezPacket.AgentBlock.Destination == 6 && objectGroup.OwnerID != remoteClient.AgentId))
if (folderID == UUID.Zero || (destination == 6 &&
objectGroup.OwnerID != remoteClient.AgentId))
{
List<InventoryFolderBase> subrootfolders = userInfo.RootFolder.RequestListOfFolders();
foreach (InventoryFolderBase flder in subrootfolders)
{
if (flder.Name == "Lost And Found")
{
folderID = flder.ID;
break;
}
}
InventoryFolderBase folder =
userInfo.FindFolderForType(
(int)AssetType.LostAndFoundFolder);
if (folderID == UUID.Zero)
{
if (folder != null)
folderID = folder.ID;
else
folderID = userInfo.RootFolder.ID;
}
//currently following code not used (or don't know of any case of destination being zero
}
else
{
folderID = DeRezPacket.AgentBlock.DestinationID;
}
AssetBase asset = CreateAsset(
((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId),
((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId),
objectGroup.GetPartName(objectGroup.RootPart.LocalId),
objectGroup.GetPartDescription(objectGroup.RootPart.LocalId),
(sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml));
AssetCache.AddAsset(asset);
@ -1652,7 +1663,8 @@ namespace OpenSim.Region.Environment.Scenes
InventoryItemBase item = new InventoryItemBase();
item.Creator = objectGroup.RootPart.CreatorID;
if (DeRezPacket.AgentBlock.Destination == 1 || DeRezPacket.AgentBlock.Destination == 4)// Take / Copy
if (destination == 1 ||
destination == 4)// Take / Copy
item.Owner = remoteClient.AgentId;
else // Delete / Return
item.Owner = objectGroup.OwnerID;
@ -1720,7 +1732,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (!grp.HasGroupChanged)
{
m_log.InfoFormat("[ATTACHMENT] Detaching {0} which is unchanged", grp.UUID.ToString());
m_log.InfoFormat("[ATTACHMENT] Save request for {0} which is unchanged", grp.UUID.ToString());
return;
}
m_log.InfoFormat("[ATTACHMENT] Updating asset for attachment {0}, attachpoint {1}", grp.UUID.ToString(), grp.GetAttachmentPoint());

View File

@ -96,6 +96,8 @@ namespace OpenSim.Region.Environment.Scenes
private int m_incrementsof15seconds = 0;
private volatile bool m_backingup = false;
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
protected string m_simulatorVersion = "OpenSimulator Server";
protected ModuleLoader m_moduleLoader;
@ -929,8 +931,54 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns>
public void Backup()
{
m_returns.Clear();
EventManager.TriggerOnBackup(m_storageManager.DataStore);
m_backingup = false;
foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
{
UUID transaction = UUID.Random();
GridInstantMessage msg = new GridInstantMessage();
msg.fromAgentID = new Guid(UUID.Zero.ToString()); // From server
msg.fromAgentSession = new Guid(transaction.ToString());
msg.toAgentID = new Guid(ret.Key.ToString());
msg.imSessionID = new Guid(transaction.ToString());
msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
msg.fromAgentName = "Server";
msg.dialog = (byte)19; // Object msg
msg.fromGroup = false;
msg.offline = (byte)1;
msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID;
msg.Position = Vector3.Zero;
msg.RegionID = RegionInfo.RegionID.Guid;
msg.binaryBucket = new byte[0];
if (ret.Value.count > 1)
msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to parcel auto return", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName);
else
msg.message = string.Format("Your object {0} was returned from {1} in region {2} due to parcel auto return", ret.Value.objectName, ret.Value.location.ToString(), RegionInfo.RegionName);
TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
}
}
public void AddReturn(UUID agentID, string objectName, Vector3 location)
{
if (m_returns.ContainsKey(agentID))
{
ReturnInfo info = m_returns[agentID];
info.count++;
m_returns[agentID] = info;
}
else
{
ReturnInfo info = new ReturnInfo();
info.count = 1;
info.objectName = objectName;
info.location = location;
m_returns[agentID] = info;
}
}
#endregion
@ -2254,6 +2302,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnUndo += m_innerScene.HandleUndo;
client.OnObjectGroupRequest += m_innerScene.HandleObjectGroupUpdate;
client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel;
client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime;
client.OnObjectSaleInfo += ObjectSaleInfo;
client.OnScriptReset += ProcessScriptReset;
client.OnGetScriptRunning += GetScriptRunning;

View File

@ -99,6 +99,8 @@ namespace OpenSim.Region.Environment.Scenes
private Vector3 lastPhysGroupPos;
private Quaternion lastPhysGroupRot;
private bool m_isBackedUp = false;
/// <summary>
/// The constituent parts of this group
/// </summary>
@ -120,7 +122,11 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public override string Name
{
get { return RootPart.Name; }
get {
if (RootPart == null)
return "";
return RootPart.Name;
}
set { RootPart.Name = value; }
}
@ -544,7 +550,9 @@ namespace OpenSim.Region.Environment.Scenes
//m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID);
m_scene.EventManager.OnBackup += ProcessBackup;
if (!m_isBackedUp)
m_scene.EventManager.OnBackup += ProcessBackup;
m_isBackedUp = true;
}
}
@ -786,6 +794,7 @@ namespace OpenSim.Region.Environment.Scenes
SetAttachmentPoint((byte)0);
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim);
HasGroupChanged = true;
RootPart.Rezzed = DateTime.Now;
AttachToBackup();
m_scene.EventManager.TriggerParcelPrimCountTainted();
m_rootPart.ScheduleFullUpdate();
@ -1000,6 +1009,8 @@ namespace OpenSim.Region.Environment.Scenes
// that they don't happen, otherwise the deleted objects will reappear
m_isDeleted = true;
DetachFromBackup();
foreach (SceneObjectPart part in m_parts.Values)
{
List<ScenePresence> avatars = Scene.GetScenePresences();
@ -1149,6 +1160,28 @@ namespace OpenSim.Region.Environment.Scenes
// any exception propogate upwards.
try
{
ILandObject parcel = m_scene.LandChannel.GetLandObject(
m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y);
if (parcel.landData.OtherCleanTime != 0)
{
if (parcel.landData.OwnerID != OwnerID &&
(parcel.landData.GroupID != GroupID ||
parcel.landData.GroupID == UUID.Zero))
{
if ((DateTime.Now - RootPart.Rezzed).TotalMinutes >
parcel.landData.OtherCleanTime)
{
m_log.InfoFormat("[SCENE] Returning object {0} due to parcel auto return", RootPart.UUID.ToString());
m_scene.AddReturn(OwnerID, Name, AbsolutePosition);
m_scene.DeRezObject(null, RootPart.LocalId,
RootPart.GroupID, 9, UUID.Zero);
return;
}
}
}
if (HasGroupChanged)
{
// don't backup while it's selected or you're asking for changes mid stream.
@ -1226,35 +1259,6 @@ namespace OpenSim.Region.Environment.Scenes
}
}
/// <summary>
/// Send a terse update to the client for the given part
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="part"></param>
internal void SendPartTerseUpdate(IClientAPI remoteClient, SceneObjectPart part)
{
SceneObjectPart rootPart = m_rootPart;
// TODO: that could by caused by some race condition with attachments on sim-crossing
if (rootPart == null) return;
if (rootPart.UUID == part.UUID)
{
if (rootPart.IsAttachment)
{
part.SendTerseUpdateToClient(remoteClient, rootPart.AttachedPos);
}
else
{
part.SendTerseUpdateToClient(remoteClient, AbsolutePosition);
}
}
else
{
part.SendTerseUpdateToClient(remoteClient);
}
}
#endregion
#region Copying
@ -1920,6 +1924,8 @@ namespace OpenSim.Region.Environment.Scenes
if (sendEvents)
linkPart.TriggerScriptChangedEvent(Changed.LINK);
linkPart.Rezzed = RootPart.Rezzed;
HasGroupChanged = true;
ScheduleGroupForFullUpdate();
}
@ -1937,7 +1943,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="objectGroup"></param>
public void DetachFromBackup()
{
m_scene.EventManager.OnBackup -= ProcessBackup;
if (m_isBackedUp)
m_scene.EventManager.OnBackup -= ProcessBackup;
m_isBackedUp = false;
}
private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation)

View File

@ -212,6 +212,7 @@ namespace OpenSim.Region.Environment.Scenes
// It's not necessary to persist this
m_TextureAnimation = new byte[0];
m_particleSystem = new byte[0];
Rezzed = DateTime.Now;
}
public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, UUID ownerID, uint localID,
@ -237,6 +238,7 @@ namespace OpenSim.Region.Environment.Scenes
m_regionHandle = regionHandle;
m_parentGroup = parent;
Rezzed = DateTime.Now;
_creationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
_ownerID = ownerID;
_creatorID = _ownerID;
@ -311,6 +313,8 @@ namespace OpenSim.Region.Environment.Scenes
RotationOffset = rotation;
ObjectFlags = flags;
Rezzed = DateTime.Now;
m_TextureAnimation = new byte[0];
m_particleSystem = new byte[0];
// Since we don't store script state, this is only a 'temporary' objectflag now
@ -339,6 +343,7 @@ namespace OpenSim.Region.Environment.Scenes
*/
//System.Console.WriteLine("SceneObjectPart Deserialize END");
Rezzed = DateTime.Now;
}
#endregion Constructors
@ -362,6 +367,7 @@ namespace OpenSim.Region.Environment.Scenes
private uint _nextOwnerMask = (uint)PermissionMask.All;
private PrimFlags _flags = 0;
private DateTime m_expires;
private DateTime m_rezzed;
public UUID CreatorID {
get
@ -459,6 +465,13 @@ namespace OpenSim.Region.Environment.Scenes
set { m_expires = value; }
}
[XmlIgnore]
public DateTime Rezzed
{
get { return m_rezzed; }
set { m_rezzed = value; }
}
/// <summary>
/// The position of the entire group that this prim belongs to.
/// </summary>
@ -1270,6 +1283,7 @@ if (m_shape != null) {
dupe._objectSaleType = _objectSaleType;
dupe._salePrice = _salePrice;
dupe._category = _category;
dupe.m_rezzed = m_rezzed;
dupe.TaskInventory = (TaskInventoryDictionary)dupe.TaskInventory.Clone();
@ -2226,10 +2240,10 @@ if (m_shape != null) {
/// Send a terse update to the client.
/// </summary>
/// <param name="remoteClient"></param>
public void SendTerseUpdate(IClientAPI remoteClient)
{
m_parentGroup.SendPartTerseUpdate(remoteClient, this);
}
// public void SendTerseUpdate(IClientAPI remoteClient)
// {
// SendTerseUpdateToClient(remoteClient);
// }
/// <summary>
///
@ -2239,54 +2253,14 @@ if (m_shape != null) {
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
for (int i = 0; i < avatars.Count; i++)
{
m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this);
SendTerseUpdateToClient(avatars[i].ControllingClient);
}
}
public void SendTerseUpdateToClient(IClientAPI remoteClient)
{
Vector3 lPos;
lPos = OffsetPosition;
Quaternion mRot = RotationOffset;
// TODO: I have no idea why we are making this check. This should be sorted out
if ((ObjectFlags & (uint) PrimFlags.Physics) == 0)
{
remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, RotationalVelocity, Shape.State, FromAssetID);
}
else
{
remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity,
RotationalVelocity);
//System.Console.WriteLine("LID: " + LocalID + " RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString());
}
}
public void SendTerseUpdateToClient(IClientAPI remoteClient, Vector3 lPos)
{
Quaternion mRot = RotationOffset;
//bool isattachment = IsAttachment;
//if (LocalId != ParentGroup.RootPart.LocalId)
//isattachment = ParentGroup.RootPart.IsAttachment;
if (IsAttachment)
{
//m_log.Debug(AttachmentPoint.ToString());
remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, RotationalVelocity, (byte)((AttachmentPoint % 16) * 16 + (AttachmentPoint / 16)),FromAssetID);
}
else
{
if ((ObjectFlags & (uint)PrimFlags.Physics) == 0)
{
remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity, RotationalVelocity, Shape.State, FromAssetID);
}
else
{
remoteClient.SendPrimTerseUpdate(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, lPos, mRot, Velocity,
RotationalVelocity);
//System.Console.WriteLine("LID: " + LocalID + "RVel:" + RotationalVelocity.ToString() + " TD: " + ((ushort)(m_parentGroup.Scene.TimeDilation * 500000f)).ToString() + ":" + m_parentGroup.Scene.TimeDilation.ToString());
}
}
}
// public void SendTerseUpdateToClient(IClientAPI remoteClient, Vector3 lPos)
// {
// SendTerseUpdateToClient(remoteclient);
// }
public void SetAttachmentPoint(uint AttachmentPoint)
{
@ -3257,6 +3231,15 @@ if (m_shape != null) {
PhysActor.Shape = m_shape;
}
// This is what makes vehicle trailers work
// A script in a child prim re-issues
// llSetPrimitiveParams(PRIM_TYPE) every few seconds. That
// prevents autoreturn. This is not well known. It also works
// in SL.
//
if (ParentGroup.RootPart != this)
ParentGroup.RootPart.Rezzed = DateTime.Now;
ParentGroup.HasGroupChanged = true;
ScheduleFullUpdate();
}
@ -3427,5 +3410,42 @@ if (m_shape != null) {
}
#endregion Public Methods
private byte GetAttachPointEncoded()
{
return (byte)((AttachmentPoint % 16) * 16 + (AttachmentPoint / 16));
}
public void SendTerseUpdateToClient(IClientAPI remoteClient)
{
if (ParentGroup == null || ParentGroup.RootPart == null)
return;
Vector3 lPos = OffsetPosition;
byte state = Shape.State;
if (IsAttachment)
{
if (ParentGroup.RootPart != this)
return;
lPos = ParentGroup.RootPart.AttachedPos;
state = GetAttachPointEncoded();
}
else
{
if (ParentGroup.RootPart == this)
lPos = AbsolutePosition;
}
remoteClient.SendPrimTerseUpdate(m_regionHandle,
(ushort)(m_parentGroup.GetTimeDilation() *
(float)ushort.MaxValue), LocalId, lPos,
RotationOffset, Velocity,
RotationalVelocity, state, FromAssetID);
}
}
}

View File

@ -640,7 +640,7 @@ namespace OpenSim.Region.Environment.Scenes
// "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}",
// part.Name, part.UUID, part.TimeStampTerse);
part.SendTerseUpdate(ControllingClient);
part.SendTerseUpdateToClient(ControllingClient);
update.LastTerseUpdateTime = part.TimeStampTerse;
updateCount++;

View File

@ -79,7 +79,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event RequestAvatarProperties OnRequestAvatarProperties;
public event SetAlwaysRun OnSetAlwaysRun;
public event GenericCall4 OnDeRezObject;
public event DeRezObject OnDeRezObject;
public event Action<IClientAPI> OnRegionHandShakeReply;
public event GenericCall2 OnRequestWearables;
public event GenericCall2 OnCompleteMovementToRegion;
@ -225,6 +225,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event DirPopularQuery OnDirPopularQuery;
public event DirClassifiedQuery OnDirClassifiedQuery;
public event EventInfoRequest OnEventInfoRequest;
public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
public event MapItemRequest OnMapItemRequest;
@ -499,12 +500,6 @@ namespace OpenSim.Region.Examples.SimpleModule
{
}
public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
Vector3 position, Quaternion rotation, Vector3 velocity,
Vector3 rotationalvelocity)
{
}
public virtual void SendInventoryFolderDetails(UUID ownerID, UUID folderID,
List<InventoryItemBase> items,
List<InventoryFolderBase> folders,