diff options
Diffstat (limited to '')
5 files changed, 27 insertions, 9 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 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index bfe5e4a..7119ad2 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).ParentGroup; | 107 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).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); |
@@ -317,4 +317,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
317 | // Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); | 317 | // Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); |
318 | // } | 318 | // } |
319 | } | 319 | } |
320 | } \ No newline at end of file | 320 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 69ce967..0516cb1 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
65 | /// <param name="AttachmentPt"></param> | 65 | /// <param name="AttachmentPt"></param> |
66 | /// <param name="silent"></param> | 66 | /// <param name="silent"></param> |
67 | /// <returns>true if the object was successfully attached, false otherwise</returns> | 67 | /// <returns>true if the object was successfully attached, false otherwise</returns> |
68 | bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent); | 68 | bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent, bool useAttachmentInfo); |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
71 | /// Rez an attachment from user inventory and change inventory status to match. | 71 | /// Rez an attachment from user inventory and change inventory status to match. |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a9a4cda..6a120c1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2692,7 +2692,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2692 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2692 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2693 | 2693 | ||
2694 | if (AttachmentsModule != null) | 2694 | if (AttachmentsModule != null) |
2695 | AttachmentsModule.AttachObject(sp, grp, 0, false); | 2695 | AttachmentsModule.AttachObject(sp, grp, 0, false, false); |
2696 | } | 2696 | } |
2697 | else | 2697 | else |
2698 | { | 2698 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ec0966b..ec44da0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3344,7 +3344,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3344 | 3344 | ||
3345 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | 3345 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
3346 | if (attachmentsModule != null) | 3346 | if (attachmentsModule != null) |
3347 | attachmentsModule.AttachObject(presence, grp, (uint)attachment, false); | 3347 | attachmentsModule.AttachObject(presence, grp, (uint)attachment, false, true); |
3348 | } | 3348 | } |
3349 | } | 3349 | } |
3350 | 3350 | ||