diff options
3 files changed, 34 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 4fac01f..f63089d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using System.Xml; | 31 | using System.Xml; |
@@ -73,31 +74,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
73 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent) | 74 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent) |
74 | { | 75 | { |
75 | m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); | 76 | m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); |
76 | |||
77 | // If we can't take it, we can't attach it! | ||
78 | SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID); | ||
79 | if (part == null) | ||
80 | return; | ||
81 | 77 | ||
82 | if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) | 78 | try |
83 | return; | ||
84 | |||
85 | // Calls attach with a Zero position | ||
86 | if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) | ||
87 | { | 79 | { |
88 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); | 80 | // If we can't take it, we can't attach it! |
89 | 81 | SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID); | |
90 | // Save avatar attachment information | 82 | if (part == null) |
91 | ScenePresence presence; | 83 | return; |
92 | if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 84 | |
85 | if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) | ||
86 | return; | ||
87 | |||
88 | // Calls attach with a Zero position | ||
89 | if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) | ||
93 | { | 90 | { |
94 | m_log.Info( | 91 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); |
95 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | 92 | |
96 | + ", AttachmentPoint: " + AttachmentPt); | 93 | // Save avatar attachment information |
97 | 94 | ScenePresence presence; | |
98 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 95 | if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
96 | { | ||
97 | m_log.Info( | ||
98 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | ||
99 | + ", AttachmentPoint: " + AttachmentPt); | ||
100 | |||
101 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
102 | } | ||
99 | } | 103 | } |
100 | } | 104 | } |
105 | catch (Exception e) | ||
106 | { | ||
107 | m_log.DebugFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}", e); | ||
108 | } | ||
101 | } | 109 | } |
102 | 110 | ||
103 | public bool AttachObject( | 111 | public bool AttachObject( |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index e111867..8847043 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1755,7 +1755,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1755 | item.AssetType = asset.Type; | 1755 | item.AssetType = asset.Type; |
1756 | item.InvType = (int)InventoryType.Object; | 1756 | item.InvType = (int)InventoryType.Object; |
1757 | 1757 | ||
1758 | item.Folder = UUID.Zero; // Objects folder! | 1758 | InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); |
1759 | if (folder != null) | ||
1760 | item.Folder = folder.ID; | ||
1761 | else // oopsies | ||
1762 | item.Folder = UUID.Zero; | ||
1759 | 1763 | ||
1760 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | 1764 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) |
1761 | { | 1765 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f918291..66ad14f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1206,6 +1206,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1206 | return; | 1206 | return; |
1207 | 1207 | ||
1208 | detachedpos = avatar.AbsolutePosition; | 1208 | detachedpos = avatar.AbsolutePosition; |
1209 | RootPart.FromItemID = UUID.Zero; | ||
1209 | 1210 | ||
1210 | AbsolutePosition = detachedpos; | 1211 | AbsolutePosition = detachedpos; |
1211 | m_rootPart.AttachedAvatar = UUID.Zero; | 1212 | m_rootPart.AttachedAvatar = UUID.Zero; |