aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
diff options
context:
space:
mode:
authorMelanie2012-06-04 21:05:56 +0200
committerMelanie2012-06-04 21:05:56 +0200
commit28e5abd9176aeba3b5004d07748ae88cccbcd57a (patch)
tree77df0dc831f32e55059c5f7f582ed7e66bc35284 /OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
parentWhen regions are set to shut down the instance, always send notifications to (diff)
downloadopensim-SC-28e5abd9176aeba3b5004d07748ae88cccbcd57a.zip
opensim-SC-28e5abd9176aeba3b5004d07748ae88cccbcd57a.tar.gz
opensim-SC-28e5abd9176aeba3b5004d07748ae88cccbcd57a.tar.bz2
opensim-SC-28e5abd9176aeba3b5004d07748ae88cccbcd57a.tar.xz
Fix llAttachToAvatar and "Attach" viewer option to preserve saved attach positions.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs26
1 files changed, 22 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index d7c7283..fd7cad2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
227 sp.ClearAttachments(); 227 sp.ClearAttachments();
228 } 228 }
229 229
230 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent) 230 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData)
231 { 231 {
232 lock (sp.AttachmentsSyncLock) 232 lock (sp.AttachmentsSyncLock)
233 { 233 {
@@ -273,9 +273,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
273 attachPos = Vector3.Zero; 273 attachPos = Vector3.Zero;
274 } 274 }
275 275
276 if (useAttachData)
277 {
278 group.RootPart.RotationOffset = group.RootPart.AttachRotation;
279 attachPos = group.RootPart.AttachOffset;
280 if (attachmentPt == 0)
281 {
282 attachmentPt = group.RootPart.AttachPoint;
283 if (attachmentPt == 0)
284 {
285 attachmentPt = (uint)AttachmentPoint.LeftHand;
286 attachPos = Vector3.Zero;
287 }
288 }
289 else if (group.RootPart.AttachPoint != attachmentPt)
290 {
291 attachPos = Vector3.Zero;
292 }
293 }
276 group.AttachmentPoint = attachmentPt; 294 group.AttachmentPoint = attachmentPt;
277 group.AbsolutePosition = attachPos; 295 group.AbsolutePosition = attachPos;
278 296
279 // We also don't want to do any of the inventory operations for an NPC. 297 // We also don't want to do any of the inventory operations for an NPC.
280 if (sp.PresenceType != PresenceType.Npc) 298 if (sp.PresenceType != PresenceType.Npc)
281 { 299 {
@@ -792,7 +810,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
792 // This will throw if the attachment fails 810 // This will throw if the attachment fails
793 try 811 try
794 { 812 {
795 AttachObject(sp, objatt, attachmentPt, false); 813 AttachObject(sp, objatt, attachmentPt, false, false);
796 } 814 }
797 catch (Exception e) 815 catch (Exception e)
798 { 816 {
@@ -947,7 +965,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
947 AttachmentPt &= 0x7f; 965 AttachmentPt &= 0x7f;
948 966
949 // Calls attach with a Zero position 967 // Calls attach with a Zero position
950 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) 968 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true))
951 { 969 {
952 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); 970 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId);
953 971