aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDan Lake2011-10-03 16:44:32 -0700
committerDan Lake2011-10-03 16:44:32 -0700
commit460946ad62b682c7a942751f192ca9e96b662f0e (patch)
tree3ea7d72402d5b61221bb2c0bcd5fb9b5e7551d5f /OpenSim/Region
parentRemove usage of Linden packet types from inside Attachments Module and interface (diff)
downloadopensim-SC_OLD-460946ad62b682c7a942751f192ca9e96b662f0e.zip
opensim-SC_OLD-460946ad62b682c7a942751f192ca9e96b662f0e.tar.gz
opensim-SC_OLD-460946ad62b682c7a942751f192ca9e96b662f0e.tar.bz2
opensim-SC_OLD-460946ad62b682c7a942751f192ca9e96b662f0e.tar.xz
Removed redundant code in AttachmentsModule and simplified interfaces which converted back and forth between ScenePresence and IClientAPI. More to be done still.
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.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs3
6 files changed, 83 insertions, 131 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 48695a4..78b9afc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
152 if (sp.PresenceType == PresenceType.Npc) 152 if (sp.PresenceType == PresenceType.Npc)
153 RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p); 153 RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p);
154 else 154 else
155 RezSingleAttachmentFromInventory(sp.ControllingClient, attach.ItemID, p); 155 RezSingleAttachmentFromInventory(sp, attach.ItemID, p);
156 } 156 }
157 catch (Exception e) 157 catch (Exception e)
158 { 158 {
@@ -204,7 +204,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
204 /// <param name="objectLocalID"></param> 204 /// <param name="objectLocalID"></param>
205 /// <param name="AttachmentPt"></param> 205 /// <param name="AttachmentPt"></param>
206 /// <param name="silent"></param> 206 /// <param name="silent"></param>
207 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) 207 private void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
208 { 208 {
209// m_log.DebugFormat( 209// m_log.DebugFormat(
210// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", 210// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})",
@@ -258,25 +258,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
258 m_log.ErrorFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}{1}", e.Message, e.StackTrace); 258 m_log.ErrorFormat("[ATTACHMENTS MODULE]: exception upon Attach Object {0}{1}", e.Message, e.StackTrace);
259 } 259 }
260 } 260 }
261
262 public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent)
263 {
264 if (!Enabled)
265 return false;
266
267 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
268
269 if (sp == null)
270 {
271 m_log.ErrorFormat(
272 "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1}", remoteClient.Name, remoteClient.AgentId);
273 return false;
274 }
275
276 return AttachObject(sp, group, AttachmentPt, silent);
277 }
278 261
279 private bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent) 262 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent)
280 { 263 {
281 lock (sp.AttachmentsSyncLock) 264 lock (sp.AttachmentsSyncLock)
282 { 265 {
@@ -356,29 +339,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
356 } 339 }
357 340
358 return true; 341 return true;
342 }
343
344 private void RezMultipleAttachmentsFromInventory(IClientAPI remoteClient, List<KeyValuePair<UUID, uint>> rezlist)
345 {
346 if (!Enabled)
347 return;
348
349 ScenePresence sp;
350 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out sp))
351 RezMultipleAttachmentsFromInventory(sp, rezlist);
352 else
353 m_log.ErrorFormat(
354 "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezMultipleAttachmentsFromInventory()",
355 remoteClient.Name, remoteClient.AgentId);
356 return;
359 } 357 }
360 358
361 public void RezMultipleAttachmentsFromInventory( 359 public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist)
362 IClientAPI remoteClient,
363 List<KeyValuePair<UUID, uint>> rezlist)
364 { 360 {
365 if (!Enabled) 361 if (!Enabled)
366 return; 362 return;
367 363
368 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); 364// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name);
369
370 if (sp == null)
371 {
372 m_log.ErrorFormat(
373 "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezMultipleAttachmentsFromInventory()",
374 remoteClient.Name, remoteClient.AgentId);
375 return;
376 }
377
378 lock (sp.AttachmentsSyncLock) 365 lock (sp.AttachmentsSyncLock)
379 { 366 {
380// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name);
381
382 foreach (KeyValuePair<UUID, uint> rez in rezlist) 367 foreach (KeyValuePair<UUID, uint> rez in rezlist)
383 { 368 {
384 RezSingleAttachmentFromInventory(sp, rez.Key, rez.Value); 369 RezSingleAttachmentFromInventory(sp, rez.Key, rez.Value);
@@ -386,7 +371,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
386 } 371 }
387 } 372 }
388 373
389 public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 374 private ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
390 { 375 {
391 if (!Enabled) 376 if (!Enabled)
392 return null; 377 return null;
@@ -408,7 +393,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
408 return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt); 393 return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt);
409 } 394 }
410 395
411 public ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt) 396 public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
412 { 397 {
413 if (!Enabled) 398 if (!Enabled)
414 return null; 399 return null;
@@ -593,23 +578,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
593 DetachSingleAttachmentToInv(itemID, presence); 578 DetachSingleAttachmentToInv(itemID, presence);
594 } 579 }
595 } 580 }
581 }
582
583 private void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient)
584 {
585 if (!Enabled)
586 return;
587
588 ScenePresence sp;
589 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out sp))
590 DetachSingleAttachmentToGround(sp, soLocalId);
596 } 591 }
597 592
598 public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient) 593 public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId)
599 { 594 {
600 if (!Enabled) 595 if (!Enabled)
601 return; 596 return;
602 597
603// m_log.DebugFormat( 598// m_log.DebugFormat(
604// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", 599// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}",
605// remoteClient.Name, soLocalId); 600// sp.UUID, soLocalId);
606 601
607 SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId); 602 SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId);
608 603
609 if (so == null) 604 if (so == null)
610 return; 605 return;
611 606
612 if (so.AttachedAvatar != remoteClient.AgentId) 607 if (so.AttachedAvatar != sp.UUID)
613 return; 608 return;
614 609
615 UUID inventoryID = so.GetFromItemID(); 610 UUID inventoryID = so.GetFromItemID();
@@ -618,57 +613,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
618// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}", 613// "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}",
619// so.Name, so.LocalId, inventoryID); 614// so.Name, so.LocalId, inventoryID);
620 615
621 ScenePresence presence; 616 lock (sp.AttachmentsSyncLock)
622 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
623 { 617 {
624 lock (presence.AttachmentsSyncLock) 618 if (!m_scene.Permissions.CanRezObject(
625 { 619 so.PrimCount, sp.UUID, sp.AbsolutePosition))
626 if (!m_scene.Permissions.CanRezObject( 620 return;
627 so.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) 621
628 return; 622 bool changed = sp.Appearance.DetachAttachment(inventoryID);
629 623 if (changed && m_scene.AvatarFactory != null)
630 bool changed = presence.Appearance.DetachAttachment(inventoryID); 624 m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
631 if (changed && m_scene.AvatarFactory != null) 625
632 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); 626 sp.RemoveAttachment(so);
633 627
634 presence.RemoveAttachment(so); 628 SceneObjectPart rootPart = so.RootPart;
635 DetachSceneObjectToGround(so, presence); 629 rootPart.FromItemID = UUID.Zero;
636 630 so.AbsolutePosition = sp.AbsolutePosition;
637 List<UUID> uuids = new List<UUID>(); 631 so.AttachedAvatar = UUID.Zero;
638 uuids.Add(inventoryID); 632 rootPart.SetParentLocalId(0);
639 m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids); 633 so.ClearPartAttachmentData();
640 remoteClient.SendRemoveInventoryItem(inventoryID); 634 rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
641 } 635 so.HasGroupChanged = true;
642 636 rootPart.Rezzed = DateTime.Now;
643 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); 637 rootPart.RemFlag(PrimFlags.TemporaryOnRez);
638 so.AttachToBackup();
639 m_scene.EventManager.TriggerParcelPrimCountTainted();
640 rootPart.ScheduleFullUpdate();
641 rootPart.ClearUndoState();
642
643 List<UUID> uuids = new List<UUID>();
644 uuids.Add(inventoryID);
645 m_scene.InventoryService.DeleteItems(sp.UUID, uuids);
646 sp.ControllingClient.SendRemoveInventoryItem(inventoryID);
644 } 647 }
645 }
646 648
647 /// <summary> 649 m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero);
648 /// Detach the given scene object to the ground.
649 /// </summary>
650 /// <remarks>
651 /// The caller has to take care of all the other work in updating avatar appearance, inventory, etc.
652 /// </remarks>
653 /// <param name="so">The scene object to detach.</param>
654 /// <param name="sp">The scene presence from which the scene object is being detached.</param>
655 private void DetachSceneObjectToGround(SceneObjectGroup so, ScenePresence sp)
656 {
657 SceneObjectPart rootPart = so.RootPart;
658
659 rootPart.FromItemID = UUID.Zero;
660 so.AbsolutePosition = sp.AbsolutePosition;
661 so.AttachedAvatar = UUID.Zero;
662 rootPart.SetParentLocalId(0);
663 so.ClearPartAttachmentData();
664 rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
665 so.HasGroupChanged = true;
666 rootPart.Rezzed = DateTime.Now;
667 rootPart.RemFlag(PrimFlags.TemporaryOnRez);
668 so.AttachToBackup();
669 m_scene.EventManager.TriggerParcelPrimCountTainted();
670 rootPart.ScheduleFullUpdate();
671 rootPart.ClearUndoState();
672 } 650 }
673 651
674 // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. 652 // 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 8d3366c..1a0423f 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -58,17 +58,6 @@ namespace OpenSim.Region.Framework.Interfaces
58 void DeleteAttachmentsFromScene(IScenePresence sp, bool silent); 58 void DeleteAttachmentsFromScene(IScenePresence sp, bool silent);
59 59
60 /// <summary> 60 /// <summary>
61 /// Attach an object to an avatar from the world.
62 /// </summary>
63 /// <param name="controllingClient"></param>
64 /// <param name="localID"></param>
65 /// <param name="attachPoint"></param>
66 /// <param name="rot"></param>
67 /// <param name="silent"></param>
68 void AttachObject(
69 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent);
70
71 /// <summary>
72 /// Attach an object to an avatar 61 /// Attach an object to an avatar
73 /// </summary> 62 /// </summary>
74 /// <param name="remoteClient"></param> 63 /// <param name="remoteClient"></param>
@@ -76,17 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
76 /// <param name="AttachmentPt"></param> 65 /// <param name="AttachmentPt"></param>
77 /// <param name="silent"></param> 66 /// <param name="silent"></param>
78 /// <returns>true if the object was successfully attached, false otherwise</returns> 67 /// <returns>true if the object was successfully attached, false otherwise</returns>
79 bool AttachObject( 68 bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent);
80 IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent);
81
82 /// <summary>
83 /// Rez an attachment from user inventory and change inventory status to match.
84 /// </summary>
85 /// <param name="remoteClient"></param>
86 /// <param name="itemID"></param>
87 /// <param name="AttachmentPt"></param>
88 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
89 ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
90 69
91 /// <summary> 70 /// <summary>
92 /// 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.
@@ -95,17 +74,15 @@ namespace OpenSim.Region.Framework.Interfaces
95 /// <param name="itemID"></param> 74 /// <param name="itemID"></param>
96 /// <param name="AttachmentPt"></param> 75 /// <param name="AttachmentPt"></param>
97 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns> 76 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
98 ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt); 77 ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt);
99 78
100 /// <summary> 79 /// <summary>
101 /// Rez multiple attachments from a user's inventory 80 /// Rez multiple attachments from a user's inventory
102 /// </summary> 81 /// </summary>
103 /// <param name="remoteClient"></param> 82 /// <param name="sp"></param>
104 /// <param name="header"></param> 83 /// <param name="header"></param>
105 /// <param name="objects"></param> 84 /// <param name="objects"></param>
106 void RezMultipleAttachmentsFromInventory( 85 void RezMultipleAttachmentsFromInventory(IScenePresence sp,List<KeyValuePair<UUID, uint>> rezlist);
107 IClientAPI remoteClient,
108 List<KeyValuePair<UUID, uint>> rezlist);
109 86
110 /// <summary> 87 /// <summary>
111 /// Detach an object from the avatar. 88 /// Detach an object from the avatar.
@@ -121,9 +98,9 @@ namespace OpenSim.Region.Framework.Interfaces
121 /// <summary> 98 /// <summary>
122 /// Detach the given item to the ground. 99 /// Detach the given item to the ground.
123 /// </summary> 100 /// </summary>
101 /// <param name="sp"></param>
124 /// <param name="objectLocalID"></param> 102 /// <param name="objectLocalID"></param>
125 /// <param name="remoteClient"></param> 103 void DetachSingleAttachmentToGround(IScenePresence sp, uint objectLocalID);
126 void DetachSingleAttachmentToGround(uint objectLocalID, IClientAPI remoteClient);
127 104
128 /// <summary> 105 /// <summary>
129 /// Detach the given item so that it remains in the user's inventory. 106 /// 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 eadec09..0e5a7d2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2451,7 +2451,7 @@ namespace OpenSim.Region.Framework.Scenes
2451 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2451 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2452 2452
2453 if (AttachmentsModule != null) 2453 if (AttachmentsModule != null)
2454 AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); 2454 AttachmentsModule.AttachObject(sp, grp, 0, false);
2455 } 2455 }
2456 else 2456 else
2457 { 2457 {
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 9a26f4b..4b2fb51 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2966,8 +2966,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2966 2966
2967 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; 2967 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
2968 if (attachmentsModule != null) 2968 if (attachmentsModule != null)
2969 attachmentsModule.AttachObject(presence.ControllingClient, 2969 attachmentsModule.AttachObject(presence, grp, (uint)attachment, false);
2970 grp, (uint)attachment, false);
2971 } 2970 }
2972 } 2971 }
2973 2972