aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2011-10-11 23:32:16 +0100
committerMelanie2011-10-11 23:32:16 +0100
commita9af618842e3b70620bd0115405c366dd593efb0 (patch)
tree05de920104ca054c9ce62d0c27a1272610d2fcae /OpenSim/Region
parentMerge commit 'c7d0d71666a92b201d639511d062a7c22726b3c9' into bigmerge (diff)
parentRemoved redundant code in AttachmentsModule and simplified interfaces which c... (diff)
downloadopensim-SC_OLD-a9af618842e3b70620bd0115405c366dd593efb0.zip
opensim-SC_OLD-a9af618842e3b70620bd0115405c366dd593efb0.tar.gz
opensim-SC_OLD-a9af618842e3b70620bd0115405c366dd593efb0.tar.bz2
opensim-SC_OLD-a9af618842e3b70620bd0115405c366dd593efb0.tar.xz
Merge commit '460946ad62b682c7a942751f192ca9e96b662f0e' into bigmerge
Conflicts: OpenSim/Region/Framework/Scenes/Scene.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs158
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs10
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs35
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs8
6 files changed, 86 insertions, 135 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index b58a1af..6eba249 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -153,7 +153,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
153 if (sp.PresenceType == PresenceType.Npc) 153 if (sp.PresenceType == PresenceType.Npc)
154 RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null); 154 RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null);
155 else 155 else
156 RezSingleAttachmentFromInventory(sp.ControllingClient, attach.ItemID, p); 156 RezSingleAttachmentFromInventory(sp, attach.ItemID, p);
157 } 157 }
158 catch (Exception e) 158 catch (Exception e)
159 { 159 {
@@ -205,7 +205,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
205 /// <param name="objectLocalID"></param> 205 /// <param name="objectLocalID"></param>
206 /// <param name="AttachmentPt"></param> 206 /// <param name="AttachmentPt"></param>
207 /// <param name="silent"></param> 207 /// <param name="silent"></param>
208 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) 208 private void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
209 { 209 {
210// m_log.DebugFormat( 210// m_log.DebugFormat(
211// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", 211// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})",
@@ -266,25 +266,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
266 m_log.ErrorFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}{1}", e.Message, e.StackTrace); 266 m_log.ErrorFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}{1}", e.Message, e.StackTrace);
267 } 267 }
268 } 268 }
269
270 public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent)
271 {
272 if (!Enabled)
273 return false;
274
275 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
276
277 if (sp == null)
278 {
279 m_log.ErrorFormat(
280 "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1}", remoteClient.Name, remoteClient.AgentId);
281 return false;
282 }
283
284 return AttachObject(sp, group, AttachmentPt, silent);
285 }
286 269
287 private bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent) 270 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent)
288 { 271 {
289 lock (sp.AttachmentsSyncLock) 272 lock (sp.AttachmentsSyncLock)
290 { 273 {
@@ -364,29 +347,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
364 } 347 }
365 348
366 return true; 349 return true;
350 }
351
352 private void RezMultipleAttachmentsFromInventory(IClientAPI remoteClient, List<KeyValuePair<UUID, uint>> rezlist)
353 {
354 if (!Enabled)
355 return;
356
357 ScenePresence sp;
358 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out sp))
359 RezMultipleAttachmentsFromInventory(sp, rezlist);
360 else
361 m_log.ErrorFormat(
362 "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezMultipleAttachmentsFromInventory()",
363 remoteClient.Name, remoteClient.AgentId);
364 return;
367 } 365 }
368 366
369 public void RezMultipleAttachmentsFromInventory( 367 public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist)
370 IClientAPI remoteClient,
371 List<KeyValuePair<UUID, uint>> rezlist)
372 { 368 {
373 if (!Enabled) 369 if (!Enabled)
374 return; 370 return;
375 371
376 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); 372// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name);
377
378 if (sp == null)
379 {
380 m_log.ErrorFormat(
381 "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezMultipleAttachmentsFromInventory()",
382 remoteClient.Name, remoteClient.AgentId);
383 return;
384 }
385
386 lock (sp.AttachmentsSyncLock) 373 lock (sp.AttachmentsSyncLock)
387 { 374 {
388// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name);
389
390 foreach (KeyValuePair<UUID, uint> rez in rezlist) 375 foreach (KeyValuePair<UUID, uint> rez in rezlist)
391 { 376 {
392 RezSingleAttachmentFromInventory(sp, rez.Key, rez.Value); 377 RezSingleAttachmentFromInventory(sp, rez.Key, rez.Value);
@@ -394,7 +379,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
394 } 379 }
395 } 380 }
396 381
397 public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 382 private ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
398 { 383 {
399 return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null); 384 return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true, null);
400 } 385 }
@@ -418,7 +403,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
418 return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt); 403 return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt);
419 } 404 }
420 405
421 public ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt) 406 public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
422 { 407 {
423 if (!Enabled) 408 if (!Enabled)
424 return null; 409 return null;
@@ -628,23 +613,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
628 DetachSingleAttachmentToInv(itemID, presence); 613 DetachSingleAttachmentToInv(itemID, presence);
629 } 614 }
630 } 615 }
616 }
617
618 private void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient)
619 {
620 if (!Enabled)
621 return;
622
623 ScenePresence sp;
624 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out sp))
625 DetachSingleAttachmentToGround(sp, soLocalId);
631 } 626 }
632 627
633 public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient) 628 public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId)
634 { 629 {
635 if (!Enabled) 630 if (!Enabled)
636 return; 631 return;
637 632
638// m_log.DebugFormat( 633// m_log.DebugFormat(
639// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", 634// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}",
640// remoteClient.Name, soLocalId); 635// sp.UUID, soLocalId);
641 636
642 SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId); 637 SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId);
643 638
644 if (so == null) 639 if (so == null)
645 return; 640 return;
646 641
647 if (so.AttachedAvatar != remoteClient.AgentId) 642 if (so.AttachedAvatar != sp.UUID)
648 return; 643 return;
649 644
650 UUID inventoryID = so.GetFromItemID(); 645 UUID inventoryID = so.GetFromItemID();
@@ -653,57 +648,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
653// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}", 648// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}",
654// so.Name, so.LocalId, inventoryID); 649// so.Name, so.LocalId, inventoryID);
655 650
656 ScenePresence presence; 651 lock (sp.AttachmentsSyncLock)
657 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
658 { 652 {
659 lock (presence.AttachmentsSyncLock) 653 if (!m_scene.Permissions.CanRezObject(
660 { 654 so.PrimCount, sp.UUID, sp.AbsolutePosition))
661 if (!m_scene.Permissions.CanRezObject( 655 return;
662 so.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) 656
663 return; 657 bool changed = sp.Appearance.DetachAttachment(inventoryID);
664 658 if (changed && m_scene.AvatarFactory != null)
665 bool changed = presence.Appearance.DetachAttachment(inventoryID); 659 m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
666 if (changed && m_scene.AvatarFactory != null) 660
667 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); 661 sp.RemoveAttachment(so);
668 662
669 presence.RemoveAttachment(so); 663 SceneObjectPart rootPart = so.RootPart;
670 DetachSceneObjectToGround(so, presence); 664 rootPart.FromItemID = UUID.Zero;
671 665 so.AbsolutePosition = sp.AbsolutePosition;
672 List<UUID> uuids = new List<UUID>(); 666 so.AttachedAvatar = UUID.Zero;
673 uuids.Add(inventoryID); 667 rootPart.SetParentLocalId(0);
674 m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids); 668 so.ClearPartAttachmentData();
675 remoteClient.SendRemoveInventoryItem(inventoryID); 669 rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
676 } 670 so.HasGroupChanged = true;
677 671 rootPart.Rezzed = DateTime.Now;
678 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); 672 rootPart.RemFlag(PrimFlags.TemporaryOnRez);
673 so.AttachToBackup();
674 m_scene.EventManager.TriggerParcelPrimCountTainted();
675 rootPart.ScheduleFullUpdate();
676 rootPart.ClearUndoState();
677
678 List<UUID> uuids = new List<UUID>();
679 uuids.Add(inventoryID);
680 m_scene.InventoryService.DeleteItems(sp.UUID, uuids);
681 sp.ControllingClient.SendRemoveInventoryItem(inventoryID);
679 } 682 }
680 }
681 683
682 /// <summary> 684 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero);
683 /// Detach the given scene object to the ground.
684 /// </summary>
685 /// <remarks>
686 /// The caller has to take care of all the other work in updating avatar appearance, inventory, etc.
687 /// </remarks>
688 /// <param name="so">The scene object to detach.</param>
689 /// <param name="sp">The scene presence from which the scene object is being detached.</param>
690 private void DetachSceneObjectToGround(SceneObjectGroup so, ScenePresence sp)
691 {
692 SceneObjectPart rootPart = so.RootPart;
693
694 rootPart.FromItemID = UUID.Zero;
695 so.AbsolutePosition = sp.AbsolutePosition;
696 so.AttachedAvatar = UUID.Zero;
697 rootPart.SetParentLocalId(0);
698 so.ClearPartAttachmentData();
699 rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
700 so.HasGroupChanged = true;
701 rootPart.Rezzed = DateTime.Now;
702 rootPart.RemFlag(PrimFlags.TemporaryOnRez);
703 so.AttachToBackup();
704 m_scene.EventManager.TriggerParcelPrimCountTainted();
705 rootPart.ScheduleFullUpdate();
706 rootPart.ClearUndoState();
707 } 685 }
708 686
709 // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. 687 // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards.
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index ff3358f..832c6eb 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.ControllingClient, so, (uint)AttachmentPoint.Chest, false); 109 m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, 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);
@@ -140,7 +140,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
140 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); 140 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
141 141
142 m_attMod.RezSingleAttachmentFromInventory( 142 m_attMod.RezSingleAttachmentFromInventory(
143 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); 143 m_presence, attItemId, (uint)AttachmentPoint.Chest);
144 144
145 // Check scene presence status 145 // Check scene presence status
146 Assert.That(m_presence.HasAttachments(), Is.True); 146 Assert.That(m_presence.HasAttachments(), Is.True);
@@ -174,8 +174,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
174 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); 174 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
175 175
176 ISceneEntity so = m_attMod.RezSingleAttachmentFromInventory( 176 ISceneEntity so = m_attMod.RezSingleAttachmentFromInventory(
177 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); 177 m_presence, attItemId, (uint)AttachmentPoint.Chest);
178 m_attMod.DetachSingleAttachmentToGround(so.LocalId, m_presence.ControllingClient); 178 m_attMod.DetachSingleAttachmentToGround(m_presence, so.LocalId);
179 179
180 // Check scene presence status 180 // Check scene presence status
181 Assert.That(m_presence.HasAttachments(), Is.False); 181 Assert.That(m_presence.HasAttachments(), Is.False);
@@ -208,7 +208,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
208 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); 208 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
209 209
210 m_attMod.RezSingleAttachmentFromInventory( 210 m_attMod.RezSingleAttachmentFromInventory(
211 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); 211 m_presence, attItemId, (uint)AttachmentPoint.Chest);
212 m_attMod.DetachSingleAttachmentToInv(attItemId, m_presence.ControllingClient); 212 m_attMod.DetachSingleAttachmentToInv(attItemId, m_presence.ControllingClient);
213 213
214 // Check status on scene presence 214 // Check status on scene presence
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index d7f0a96..e2a3fa7 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -59,17 +59,6 @@ namespace OpenSim.Region.Framework.Interfaces
59 void DeleteAttachmentsFromScene(IScenePresence sp, bool silent); 59 void DeleteAttachmentsFromScene(IScenePresence sp, bool silent);
60 60
61 /// <summary> 61 /// <summary>
62 /// Attach an object to an avatar from the world.
63 /// </summary>
64 /// <param name="controllingClient"></param>
65 /// <param name="localID"></param>
66 /// <param name="attachPoint"></param>
67 /// <param name="rot"></param>
68 /// <param name="silent"></param>
69 void AttachObject(
70 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent);
71
72 /// <summary>
73 /// Attach an object to an avatar 62 /// Attach an object to an avatar
74 /// </summary> 63 /// </summary>
75 /// <param name="remoteClient"></param> 64 /// <param name="remoteClient"></param>
@@ -77,17 +66,7 @@ namespace OpenSim.Region.Framework.Interfaces
77 /// <param name="AttachmentPt"></param> 66 /// <param name="AttachmentPt"></param>
78 /// <param name="silent"></param> 67 /// <param name="silent"></param>
79 /// <returns>true if the object was successfully attached, false otherwise</returns> 68 /// <returns>true if the object was successfully attached, false otherwise</returns>
80 bool AttachObject( 69 bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent);
81 IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent);
82
83 /// <summary>
84 /// Rez an attachment from user inventory and change inventory status to match.
85 /// </summary>
86 /// <param name="remoteClient"></param>
87 /// <param name="itemID"></param>
88 /// <param name="AttachmentPt"></param>
89 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
90 ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
91 70
92 /// <summary> 71 /// <summary>
93 /// Rez an attachment from user inventory and change inventory status to match. 72 /// Rez an attachment from user inventory and change inventory status to match.
@@ -96,7 +75,7 @@ namespace OpenSim.Region.Framework.Interfaces
96 /// <param name="itemID"></param> 75 /// <param name="itemID"></param>
97 /// <param name="AttachmentPt"></param> 76 /// <param name="AttachmentPt"></param>
98 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> 77 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
99 ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt); 78 ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt);
100 79
101 // Same as above, but also load script states from a separate doc 80 // Same as above, but also load script states from a separate doc
102 ISceneEntity RezSingleAttachmentFromInventory( 81 ISceneEntity RezSingleAttachmentFromInventory(
@@ -105,12 +84,10 @@ namespace OpenSim.Region.Framework.Interfaces
105 /// <summary> 84 /// <summary>
106 /// Rez multiple attachments from a user's inventory 85 /// Rez multiple attachments from a user's inventory
107 /// </summary> 86 /// </summary>
108 /// <param name="remoteClient"></param> 87 /// <param name="sp"></param>
109 /// <param name="header"></param> 88 /// <param name="header"></param>
110 /// <param name="objects"></param> 89 /// <param name="objects"></param>
111 void RezMultipleAttachmentsFromInventory( 90 void RezMultipleAttachmentsFromInventory(IScenePresence sp,List<KeyValuePair<UUID, uint>> rezlist);
112 IClientAPI remoteClient,
113 List<KeyValuePair<UUID, uint>> rezlist);
114 91
115 /// <summary> 92 /// <summary>
116 /// Detach an object from the avatar. 93 /// Detach an object from the avatar.
@@ -126,9 +103,9 @@ namespace OpenSim.Region.Framework.Interfaces
126 /// <summary> 103 /// <summary>
127 /// Detach the given item to the ground. 104 /// Detach the given item to the ground.
128 /// </summary> 105 /// </summary>
106 /// <param name="sp"></param>
129 /// <param name="objectLocalID"></param> 107 /// <param name="objectLocalID"></param>
130 /// <param name="remoteClient"></param> 108 void DetachSingleAttachmentToGround(IScenePresence sp, uint objectLocalID);
131 void DetachSingleAttachmentToGround(uint objectLocalID, IClientAPI remoteClient);
132 109
133 /// <summary> 110 /// <summary>
134 /// Detach the given item so that it remains in the user's inventory. 111 /// Detach the given item so that it remains in the user's inventory.
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9c4757c..b288c8a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2528,9 +2528,7 @@ namespace OpenSim.Region.Framework.Scenes
2528 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2528 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2529 2529
2530 if (AttachmentsModule != null) 2530 if (AttachmentsModule != null)
2531 AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); 2531 AttachmentsModule.AttachObject(sp, grp, 0, false);
2532
2533 m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was found, attaching", sceneObject.UUID);
2534 } 2532 }
2535 else 2533 else
2536 { 2534 {
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 1a0d0c7..49c06bc 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -132,11 +132,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
132 UUID attAssetId = TestHelpers.ParseTail(0x3); 132 UUID attAssetId = TestHelpers.ParseTail(0x3);
133 string attName = "att"; 133 string attName = "att";
134 134
135 UserInventoryHelpers.CreateInventoryItem( 135 UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
136 scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
137 136
138 am.RezSingleAttachmentFromInventory( 137 am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
139 sp.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
140 138
141 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); 139 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
142 UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, sp.Appearance); 140 UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, sp.Appearance);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b968bdc..fb595fe 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3265,10 +3265,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3265 SceneObjectGroup grp = m_host.ParentGroup; 3265 SceneObjectGroup grp = m_host.ParentGroup;
3266 3266
3267 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 3267 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
3268 if (presence.Scene.AttachmentsModule != null) 3268
3269 { 3269 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3270 presence.Scene.AttachmentsModule.AttachObject(presence.ControllingClient, grp, (uint)attachment, false); 3270 if (attachmentsModule != null)
3271 } 3271 attachmentsModule.AttachObject(presence, grp, (uint)attachment, false);
3272 } 3272 }
3273 } 3273 }
3274 3274