From efe3f3eb2a0a31b1da474974c7d8193c2b28e13f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 18 Oct 2008 05:51:36 +0000 Subject: 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. --- OpenSim/Data/MySQL/MySQLRegionData.cs | 6 + OpenSim/Data/MySQL/Resources/020_RegionStore.sql | 7 + OpenSim/Data/SQLite/Resources/013_RegionStore.sql | 6 + OpenSim/Data/SQLite/SQLiteRegionData.cs | 7 + .../Communications/Cache/CachedUserInfo.cs | 2 +- OpenSim/Framework/IClientAPI.cs | 8 +- OpenSim/Framework/LandData.cs | 22 +++ .../Region/ClientStack/LindenUDP/LLClientView.cs | 46 ++--- .../Region/Environment/Interfaces/ILandChannel.cs | 1 + .../Environment/Modules/World/Land/LandChannel.cs | 9 + .../Modules/World/Land/LandManagementModule.cs | 15 ++ .../Environment/Modules/World/NPC/NPCAvatar.cs | 9 +- .../Scenes/AsyncSceneObjectGroupDeleter.cs | 17 +- OpenSim/Region/Environment/Scenes/ReturnInfo.cs | 38 ++++ .../Region/Environment/Scenes/Scene.Inventory.cs | 202 +++++++++++---------- OpenSim/Region/Environment/Scenes/Scene.cs | 49 +++++ .../Region/Environment/Scenes/SceneObjectGroup.cs | 72 ++++---- .../Region/Environment/Scenes/SceneObjectPart.cs | 118 +++++++----- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 +- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 9 +- 20 files changed, 419 insertions(+), 226 deletions(-) create mode 100644 OpenSim/Data/MySQL/Resources/020_RegionStore.sql create mode 100644 OpenSim/Data/SQLite/Resources/013_RegionStore.sql create mode 100644 OpenSim/Region/Environment/Scenes/ReturnInfo.cs (limited to 'OpenSim') diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index ae048fe..ab7e92d 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -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; } /// diff --git a/OpenSim/Data/MySQL/Resources/020_RegionStore.sql b/OpenSim/Data/MySQL/Resources/020_RegionStore.sql new file mode 100644 index 0000000..814ef48 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/020_RegionStore.sql @@ -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; + diff --git a/OpenSim/Data/SQLite/Resources/013_RegionStore.sql b/OpenSim/Data/SQLite/Resources/013_RegionStore.sql new file mode 100644 index 0000000..11529cd --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/013_RegionStore.sql @@ -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; diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index c87d2e3..812367d 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -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; } /// diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 6371105..d242cb3 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -715,7 +715,7 @@ namespace OpenSim.Framework.Communications.Cache } } - private InventoryFolderImpl FindFolderForType(int type) + public InventoryFolderImpl FindFolderForType(int type) { if (RootFolder == null) return null; diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index db6025d..0bb790c 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -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 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 items, List folders, bool fetchFolders, bool fetchItems); diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 4e66721..7d29d10 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -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) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2d6508a..412f969 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -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 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; diff --git a/OpenSim/Region/Environment/Interfaces/ILandChannel.cs b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs index 98998f7..7da4d3c 100644 --- a/OpenSim/Region/Environment/Interfaces/ILandChannel.cs +++ b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs @@ -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); } } diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs index 8747bd4..892d1ae 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs @@ -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 } diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs index 0ecfdd3..d595185 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs @@ -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); + } } } diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index e5e6a79..52a2792 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -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 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 items, List folders, diff --git a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs index 21fa71b..bd81a6d 100644 --- a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs @@ -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 /// /// Delete the given object from the scene /// - 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; } diff --git a/OpenSim/Region/Environment/Scenes/ReturnInfo.cs b/OpenSim/Region/Environment/Scenes/ReturnInfo.cs new file mode 100644 index 0000000..68c563d --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/ReturnInfo.cs @@ -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; + } +} diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 226f39a..b91eb83 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -1517,78 +1517,90 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - 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) - { -// m_log.DebugFormat( -// "[AGENT INVENTORY]: Received request to derez {0} into folder {1}", -// Data.ObjectLocalID, DeRezPacket.AgentBlock.DestinationID); + // Can't delete child prims + if (part != part.ParentGroup.RootPart) + return; + + SceneObjectGroup grp = part.ParentGroup; + + bool permissionToTake = false; + bool permissionToDelete = false; - EntityBase selectedEnt = null; - //m_log.Info("[CLIENT]: LocalID:" + Data.ObjectLocalID.ToString()); + if (destination == 1) // Take Copy + { + 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); - List EntityList = GetEntities(); + //If they can take, they can delete! + permissionToDelete = permissionToTake; + } - 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); + } } /// @@ -1600,51 +1612,50 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - 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); - if (userInfo != null) - { -// string searchFolder = ""; + CommsManager.UserProfileCacheService.GetUserDetails( + remoteClient.AgentId); -// if (DeRezPacket.AgentBlock.Destination == 6) -// searchFolder = "Trash"; -// else if (DeRezPacket.AgentBlock.Destination == 9) -// searchFolder = "Lost And Found"; + if (remoteClient == null) + { + userInfo = CommsManager.UserProfileCacheService.GetUserDetails( + objectGroup.RootPart.OwnerID); + } + else + { + userInfo = CommsManager.UserProfileCacheService.GetUserDetails( + remoteClient.AgentId); + } - // 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 (userInfo != null) + { + // 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 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()); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 299d0da..139281d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -96,6 +96,8 @@ namespace OpenSim.Region.Environment.Scenes private int m_incrementsof15seconds = 0; private volatile bool m_backingup = false; + private Dictionary m_returns = new Dictionary(); + protected string m_simulatorVersion = "OpenSimulator Server"; protected ModuleLoader m_moduleLoader; @@ -929,8 +931,54 @@ namespace OpenSim.Region.Environment.Scenes /// public void Backup() { + m_returns.Clear(); + EventManager.TriggerOnBackup(m_storageManager.DataStore); m_backingup = false; + + foreach (KeyValuePair 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; diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 8c5afab..60cf061 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -99,6 +99,8 @@ namespace OpenSim.Region.Environment.Scenes private Vector3 lastPhysGroupPos; private Quaternion lastPhysGroupRot; + private bool m_isBackedUp = false; + /// /// The constituent parts of this group /// @@ -120,7 +122,11 @@ namespace OpenSim.Region.Environment.Scenes /// 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 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 } } - /// - /// Send a terse update to the client for the given part - /// - /// - /// - 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 /// 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) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index bf6025e..6c76d54 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -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; } + } + /// /// The position of the entire group that this prim belongs to. /// @@ -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. /// /// - public void SendTerseUpdate(IClientAPI remoteClient) - { - m_parentGroup.SendPartTerseUpdate(remoteClient, this); - } +// public void SendTerseUpdate(IClientAPI remoteClient) +// { +// SendTerseUpdateToClient(remoteClient); +// } /// /// @@ -2239,54 +2253,14 @@ if (m_shape != null) { List avatars = m_parentGroup.Scene.GetScenePresences(); for (int i = 0; i < avatars.Count; i++) { - m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); - } - } - - 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()); + SendTerseUpdateToClient(avatars[i].ControllingClient); } } - 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); + } } } + + + diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 0fe2bdb..4517d11 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -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++; diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index cc49072..af60323 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -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 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 items, List folders, -- cgit v1.1