aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2013-03-29 02:15:47 +0000
committerMelanie2013-03-29 02:15:47 +0000
commit05810e48b013f4ca67beae68b2b7fb8030bd9c3b (patch)
tree1df064176b61b95d18dd6d8faf46676f6f684162
parentMerge commit '2b142f2f9e888d5cb7317cc51c12ac7152c54459' into careminster (diff)
parentStop attempts to update/add existing attachments in user inventory when telep... (diff)
downloadopensim-SC_OLD-05810e48b013f4ca67beae68b2b7fb8030bd9c3b.zip
opensim-SC_OLD-05810e48b013f4ca67beae68b2b7fb8030bd9c3b.tar.gz
opensim-SC_OLD-05810e48b013f4ca67beae68b2b7fb8030bd9c3b.tar.bz2
opensim-SC_OLD-05810e48b013f4ca67beae68b2b7fb8030bd9c3b.tar.xz
Merge commit 'c92654fb43f303da8e1623f9fff8a404aad72374' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs29
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs10
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs2
4 files changed, 23 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 207c900..9d7b44b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -367,12 +367,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
367 sp.ClearAttachments(); 367 sp.ClearAttachments();
368 } 368 }
369 369
370 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp, bool append) 370 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool addToInventory, bool append)
371 { 371 {
372 if (!Enabled) 372 if (!Enabled)
373 return false; 373 return false;
374 374
375 return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, temp, false, append); 375 return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, addToInventory, false, append);
376 } 376 }
377 377
378 /// <summary> 378 /// <summary>
@@ -383,9 +383,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
383 /// <param name='group'>The object to attach.</param> 383 /// <param name='group'>The object to attach.</param>
384 /// <param name='attachmentPt'></param> 384 /// <param name='attachmentPt'></param>
385 /// <param name='silent'></param> 385 /// <param name='silent'></param>
386 /// <param name='temp'></param> 386 /// <param name='addToInventory'>If true then add object to user inventory.</param>
387 /// <param name='resumeScripts'>If true then scripts are resumed on the attached object.</param> 387 /// <param name='resumeScripts'>If true then scripts are resumed on the attached object.</param>
388 private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp, bool resumeScripts, bool append) 388 private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool addToInventory, bool resumeScripts, bool append)
389 { 389 {
390// m_log.DebugFormat( 390// m_log.DebugFormat(
391// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", 391// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
@@ -474,8 +474,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
474 group.AttachmentPoint = attachmentPt; 474 group.AttachmentPoint = attachmentPt;
475 group.AbsolutePosition = attachPos; 475 group.AbsolutePosition = attachPos;
476 476
477 if (sp.PresenceType != PresenceType.Npc) 477 if (addToInventory && sp.PresenceType != PresenceType.Npc)
478 UpdateUserInventoryWithAttachment(sp, group, attachmentPt, temp, append); 478 UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append);
479 479
480 AttachToAgent(sp, group, attachmentPt, attachPos, silent); 480 AttachToAgent(sp, group, attachmentPt, attachPos, silent);
481 481
@@ -494,17 +494,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
494 return true; 494 return true;
495 } 495 }
496 496
497 private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append) 497 private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool append)
498 { 498 {
499 // Add the new attachment to inventory if we don't already have it. 499 // Add the new attachment to inventory if we don't already have it.
500 if (!temp) 500 UUID newAttachmentItemID = group.FromItemID;
501 { 501 if (newAttachmentItemID == UUID.Zero)
502 UUID newAttachmentItemID = group.FromItemID; 502 newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
503 if (newAttachmentItemID == UUID.Zero)
504 newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
505 503
506 ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append); 504 ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append);
507 }
508 } 505 }
509 506
510 public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt) 507 public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
@@ -1010,7 +1007,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1010 objatt.ResetOwnerChangeFlag(); 1007 objatt.ResetOwnerChangeFlag();
1011 } 1008 }
1012 1009
1013 AttachObjectInternal(sp, objatt, attachmentPt, false, true, false, true, append); 1010 AttachObjectInternal(sp, objatt, attachmentPt, false, true, true, true, append);
1014 } 1011 }
1015 catch (Exception e) 1012 catch (Exception e)
1016 { 1013 {
@@ -1152,7 +1149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1152 AttachmentPt &= 0x7f; 1149 AttachmentPt &= 0x7f;
1153 1150
1154 // Calls attach with a Zero position 1151 // Calls attach with a Zero position
1155 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true, false, append)) 1152 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, false, false, append))
1156 { 1153 {
1157 if (DebugLevel > 0) 1154 if (DebugLevel > 0)
1158 m_log.Debug( 1155 m_log.Debug(
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index a8fe045..cfe5538 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -197,7 +197,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
197 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); 197 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
198 198
199 m_numberOfAttachEventsFired = 0; 199 m_numberOfAttachEventsFired = 0;
200 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false, false); 200 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false, false);
201 201
202 // Check status on scene presence 202 // Check status on scene presence
203 Assert.That(sp.HasAttachments(), Is.True); 203 Assert.That(sp.HasAttachments(), Is.True);
@@ -244,7 +244,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
244 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "att1", sp.UUID); 244 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "att1", sp.UUID);
245 245
246 m_numberOfAttachEventsFired = 0; 246 m_numberOfAttachEventsFired = 0;
247 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Default, false, false, false, false); 247 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Default, false, true, false, false);
248 248
249 // Check status on scene presence 249 // Check status on scene presence
250 Assert.That(sp.HasAttachments(), Is.True); 250 Assert.That(sp.HasAttachments(), Is.True);
@@ -277,7 +277,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
277 277
278 // Test wearing a different attachment from the ground. 278 // Test wearing a different attachment from the ground.
279 { 279 {
280 scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, false, false, false); 280 scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, true, false, false);
281 281
282 // Check status on scene presence 282 // Check status on scene presence
283 Assert.That(sp.HasAttachments(), Is.True); 283 Assert.That(sp.HasAttachments(), Is.True);
@@ -310,7 +310,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
310 310
311 // Test rewearing an already worn attachment from ground. Nothing should happen. 311 // Test rewearing an already worn attachment from ground. Nothing should happen.
312 { 312 {
313 scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, false, false, false); 313 scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, true, false, false);
314 314
315 // Check status on scene presence 315 // Check status on scene presence
316 Assert.That(sp.HasAttachments(), Is.True); 316 Assert.That(sp.HasAttachments(), Is.True);
@@ -368,7 +368,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
368 sp2.AbsolutePosition = new Vector3(0, 0, 0); 368 sp2.AbsolutePosition = new Vector3(0, 0, 0);
369 sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero); 369 sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero);
370 370
371 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false, false); 371 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false, false);
372 372
373 Assert.That(sp.HasAttachments(), Is.False); 373 Assert.That(sp.HasAttachments(), Is.False);
374 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); 374 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index a6cbf8d..3c1247f 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -81,14 +81,16 @@ namespace OpenSim.Region.Framework.Interfaces
81 void DeleteAttachmentsFromScene(IScenePresence sp, bool silent); 81 void DeleteAttachmentsFromScene(IScenePresence sp, bool silent);
82 82
83 /// <summary> 83 /// <summary>
84 /// Attach an object to an avatar 84 /// Attach an object to an avatar.
85 /// </summary> 85 /// </summary>
86 /// <param name="sp"></param> 86 /// <param name="sp"></param>
87 /// <param name="grp"></param> 87 /// <param name="grp"></param>
88 /// <param name="AttachmentPt"></param> 88 /// <param name="AttachmentPt"></param>
89 /// <param name="silent"></param> 89 /// <param name="silent"></param>
90 /// <param name="addToInventory">If true then add object to user inventory</param>
91 /// <param name="append">Append to attachment point rather than replace.</param>
90 /// <returns>true if the object was successfully attached, false otherwise</returns> 92 /// <returns>true if the object was successfully attached, false otherwise</returns>
91 bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent, bool useAttachmentInfo, bool temp, bool append); 93 bool AttachObject(IScenePresence sp, SceneObjectGroup grp, uint AttachmentPt, bool silent, bool useAttachmentInfo, bool addToInventory, bool append);
92 94
93 /// <summary> 95 /// <summary>
94 /// Rez an attachment from user inventory and change inventory status to match. 96 /// Rez an attachment from user inventory and change inventory status to match.
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
index 8740f87..d56e39d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
@@ -184,7 +184,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
184 hostPart.ParentGroup.RootPart.ScheduleFullUpdate(); 184 hostPart.ParentGroup.RootPart.ScheduleFullUpdate();
185 } 185 }
186 186
187 return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, true, true, true) ? 1 : 0; 187 return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, true, true) ? 1 : 0;
188 } 188 }
189 } 189 }
190} 190}