diff options
author | Justin Clark-Casey (justincc) | 2011-08-26 22:02:23 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-26 22:02:23 +0100 |
commit | 002313bf132e7eca3d33fdd0c695152146d469b4 (patch) | |
tree | f61d039d789fb09f0336c6172b6d01642f2889a4 /OpenSim/Region/CoreModules | |
parent | Downgrade warning about not saving unchanged attachment to debug instead, and... (diff) | |
download | opensim-SC_OLD-002313bf132e7eca3d33fdd0c695152146d469b4.zip opensim-SC_OLD-002313bf132e7eca3d33fdd0c695152146d469b4.tar.gz opensim-SC_OLD-002313bf132e7eca3d33fdd0c695152146d469b4.tar.bz2 opensim-SC_OLD-002313bf132e7eca3d33fdd0c695152146d469b4.tar.xz |
refactor: move sog.DetachToInventoryPrep() into AttachmentsModule.DetachSingleAttachmentToInv()
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 2 |
2 files changed, 19 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2c49ba8..732e3e3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -502,17 +502,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
502 | if (group.GetFromItemID() == itemID) | 502 | if (group.GetFromItemID() == itemID) |
503 | { | 503 | { |
504 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 504 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
505 | group.DetachToInventoryPrep(); | 505 | sp.RemoveAttachment(group); |
506 | // m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | ||
507 | 506 | ||
508 | // If an item contains scripts, it's always changed. | 507 | // Prepare sog for storage |
509 | // This ensures script state is saved on detach | 508 | group.ForEachPart( |
510 | foreach (SceneObjectPart p in group.Parts) | 509 | delegate(SceneObjectPart part) |
511 | if (p.Inventory.ContainsScripts()) | 510 | { |
512 | group.HasGroupChanged = true; | 511 | part.AttachedAvatar = UUID.Zero; |
512 | |||
513 | // If there are any scripts, | ||
514 | // then always trigger a new object and state persistence in UpdateKnownItem() | ||
515 | if (part.Inventory.ContainsScripts()) | ||
516 | group.HasGroupChanged = true; | ||
517 | } | ||
518 | ); | ||
519 | |||
520 | group.RootPart.SetParentLocalId(0); | ||
521 | group.RootPart.IsAttachment = false; | ||
522 | group.AbsolutePosition = group.RootPart.AttachedPos; | ||
513 | 523 | ||
514 | UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID); | 524 | UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID); |
515 | m_scene.DeleteSceneObject(group, false); | 525 | m_scene.DeleteSceneObject(group, false); |
526 | |||
516 | return; | 527 | return; |
517 | } | 528 | } |
518 | } | 529 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 859f6ff..afcf05a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
147 | } | 147 | } |
148 | 148 | ||
149 | [Test] | 149 | [Test] |
150 | public void TestRemoveAttachment() | 150 | public void TestDetachAttachmentToInventory() |
151 | { | 151 | { |
152 | TestHelpers.InMethod(); | 152 | TestHelpers.InMethod(); |
153 | // log4net.Config.XmlConfigurator.Configure(); | 153 | // log4net.Config.XmlConfigurator.Configure(); |