aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2010-06-09 12:51:24 -0700
committerDiva Canto2010-06-09 12:51:24 -0700
commite80cb815df1a7e1f9e6effdcab438e0ce14f99eb (patch)
tree920224a5526173917f269f8e2000ac90faa8555a
parentReverting that last permissions check upon drop. Looks like all dropped attac... (diff)
downloadopensim-SC_OLD-e80cb815df1a7e1f9e6effdcab438e0ce14f99eb.zip
opensim-SC_OLD-e80cb815df1a7e1f9e6effdcab438e0ce14f99eb.tar.gz
opensim-SC_OLD-e80cb815df1a7e1f9e6effdcab438e0ce14f99eb.tar.bz2
opensim-SC_OLD-e80cb815df1a7e1f9e6effdcab438e0ce14f99eb.tar.xz
Bug fix on attachments: attach->drop->attach works now.
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs50
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs1
2 files changed, 30 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index d1792d7..6d16c52 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
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using log4net; 31using log4net;
@@ -71,31 +72,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
71 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent) 72 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent)
72 { 73 {
73 m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); 74 m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject");
74
75 // If we can't take it, we can't attach it!
76 SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID);
77 if (part == null)
78 return;
79 75
80 if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) 76 try
81 return;
82
83 // Calls attach with a Zero position
84 if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
85 { 77 {
86 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); 78 // If we can't take it, we can't attach it!
87 79 SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID);
88 // Save avatar attachment information 80 if (part == null)
89 ScenePresence presence; 81 return;
90 if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 82
83 if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
84 return;
85
86 // Calls attach with a Zero position
87 if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
91 { 88 {
92 m_log.Info( 89 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
93 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId 90
94 + ", AttachmentPoint: " + AttachmentPt); 91 // Save avatar attachment information
95 92 ScenePresence presence;
96 m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); 93 if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
94 {
95 m_log.Info(
96 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
97 + ", AttachmentPoint: " + AttachmentPt);
98
99 m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
100 }
97 } 101 }
98 } 102 }
103 catch (Exception e)
104 {
105 m_log.DebugFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}", e);
106 }
99 } 107 }
100 108
101 public bool AttachObject( 109 public bool AttachObject(
@@ -379,7 +387,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
379 uuids.Add(inventoryID); 387 uuids.Add(inventoryID);
380 m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids); 388 m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids);
381 remoteClient.SendRemoveInventoryItem(inventoryID); 389 remoteClient.SendRemoveInventoryItem(inventoryID);
382 } 390 }
383 391
384 m_scene.EventManager.TriggerOnAttach(part.ParentGroup.LocalId, itemID, UUID.Zero); 392 m_scene.EventManager.TriggerOnAttach(part.ParentGroup.LocalId, itemID, UUID.Zero);
385 } 393 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 78c2566..e23f39f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1052,6 +1052,7 @@ namespace OpenSim.Region.Framework.Scenes
1052 return; 1052 return;
1053 1053
1054 detachedpos = avatar.AbsolutePosition; 1054 detachedpos = avatar.AbsolutePosition;
1055 RootPart.FromItemID = UUID.Zero;
1055 1056
1056 AbsolutePosition = detachedpos; 1057 AbsolutePosition = detachedpos;
1057 m_rootPart.AttachedAvatar = UUID.Zero; 1058 m_rootPart.AttachedAvatar = UUID.Zero;