aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs4
2 files changed, 31 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index de40e59..f1deaa8 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -231,7 +231,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
231 sp.ClearAttachments(); 231 sp.ClearAttachments();
232 } 232 }
233 233
234 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent) 234 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData)
235 { 235 {
236 lock (sp.AttachmentsSyncLock) 236 lock (sp.AttachmentsSyncLock)
237 { 237 {
@@ -277,9 +277,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
277 attachPos = Vector3.Zero; 277 attachPos = Vector3.Zero;
278 } 278 }
279 279
280 if (useAttachData)
281 {
282 group.RootPart.RotationOffset = group.RootPart.AttachRotation;
283 attachPos = group.RootPart.AttachOffset;
284 if (attachmentPt == 0)
285 {
286 attachmentPt = group.RootPart.AttachPoint;
287 if (attachmentPt == 0)
288 {
289 attachmentPt = (uint)AttachmentPoint.LeftHand;
290 attachPos = Vector3.Zero;
291 }
292 }
293 else if (group.RootPart.AttachPoint != attachmentPt)
294 {
295 attachPos = Vector3.Zero;
296 }
297 }
280 group.AttachmentPoint = attachmentPt; 298 group.AttachmentPoint = attachmentPt;
281 group.AbsolutePosition = attachPos; 299 group.AbsolutePosition = attachPos;
282 300
283 // We also don't want to do any of the inventory operations for an NPC. 301 // We also don't want to do any of the inventory operations for an NPC.
284 if (sp.PresenceType != PresenceType.Npc) 302 if (sp.PresenceType != PresenceType.Npc)
285 { 303 {
@@ -774,10 +792,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
774 null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, 792 null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
775 false, false, sp.UUID, true); 793 false, false, sp.UUID, true);
776 794
777 // m_log.DebugFormat( 795// m_log.DebugFormat(
778 // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", 796// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}",
779 // objatt.Name, remoteClient.Name, AttachmentPt); 797// objatt.Name, remoteClient.Name, AttachmentPt);
780 798
781 if (objatt != null) 799 if (objatt != null)
782 { 800 {
783 // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. 801 // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller.
@@ -789,7 +807,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
789 // This will throw if the attachment fails 807 // This will throw if the attachment fails
790 try 808 try
791 { 809 {
792 AttachObject(sp, objatt, attachmentPt, false); 810 AttachObject(sp, objatt, attachmentPt, false, false);
793 } 811 }
794 catch (Exception e) 812 catch (Exception e)
795 { 813 {
@@ -802,6 +820,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
802 m_scene.DeleteSceneObject(objatt, false); 820 m_scene.DeleteSceneObject(objatt, false);
803 return null; 821 return null;
804 } 822 }
823
824 if (tainted)
825 objatt.HasGroupChanged = true;
805 826
806 if (doc != null) 827 if (doc != null)
807 { 828 {
@@ -809,9 +830,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
809 objatt.ResetOwnerChangeFlag(); 830 objatt.ResetOwnerChangeFlag();
810 } 831 }
811 832
812 if (tainted)
813 objatt.HasGroupChanged = true;
814
815 // Fire after attach, so we don't get messy perms dialogs 833 // Fire after attach, so we don't get messy perms dialogs
816 // 4 == AttachedRez 834 // 4 == AttachedRez
817 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); 835 objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4);
@@ -943,7 +961,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
943 AttachmentPt &= 0x7f; 961 AttachmentPt &= 0x7f;
944 962
945 // Calls attach with a Zero position 963 // Calls attach with a Zero position
946 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) 964 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true))
947 { 965 {
948// m_log.Debug( 966// m_log.Debug(
949// "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId 967// "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 5e89eec..acf0089 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
106 106
107 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup; 107 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup;
108 108
109 m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); 109 m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false, false);
110 110
111 // Check status on scene presence 111 // Check status on scene presence
112 Assert.That(m_presence.HasAttachments(), Is.True); 112 Assert.That(m_presence.HasAttachments(), Is.True);
@@ -326,4 +326,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
326// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); 326// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
327// } 327// }
328 } 328 }
329} \ No newline at end of file 329}