aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs35
1 files changed, 25 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index a854c11..c274a5b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -101,7 +101,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
101 /// <param name="silent"></param> 101 /// <param name="silent"></param>
102 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) 102 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
103 { 103 {
104// m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); 104// m_log.DebugFormat(
105// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})",
106// objectLocalID, remoteClient.Name, AttachmentPt, silent);
105 107
106 try 108 try
107 { 109 {
@@ -163,8 +165,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
163 return AttachObject(sp, group, AttachmentPt, silent); 165 return AttachObject(sp, group, AttachmentPt, silent);
164 } 166 }
165 167
166 public bool AttachObject(ScenePresence sp, SceneObjectGroup group, uint AttachmentPt, bool silent) 168 private bool AttachObject(ScenePresence sp, SceneObjectGroup group, uint AttachmentPt, bool silent)
167 { 169 {
170// m_log.DebugFormat(
171// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
172// group.Name, group.LocalId, sp.Name, AttachmentPt, silent);
173
174 if (sp.GetAttachments(AttachmentPt).Contains(group))
175 {
176// m_log.WarnFormat(
177// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
178// group.Name, group.LocalId, sp.Name, AttachmentPt);
179
180 return false;
181 }
182
168 Vector3 attachPos = group.AbsolutePosition; 183 Vector3 attachPos = group.AbsolutePosition;
169 184
170 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should 185 // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
@@ -211,14 +226,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
211 if (itemID != UUID.Zero) 226 if (itemID != UUID.Zero)
212 DetachSingleAttachmentToInv(itemID, sp); 227 DetachSingleAttachmentToInv(itemID, sp);
213 228
214 if (group.GetFromItemID() == UUID.Zero) 229 itemID = group.GetFromItemID();
215 { 230 if (itemID == UUID.Zero)
216 m_scene.attachObjectAssetStore(sp.ControllingClient, group, sp.UUID, out itemID); 231 m_scene.attachObjectAssetStore(sp.ControllingClient, group, sp.UUID, out itemID);
217 }
218 else
219 {
220 itemID = group.GetFromItemID();
221 }
222 232
223 ShowAttachInUserInventory(sp, AttachmentPt, itemID, group); 233 ShowAttachInUserInventory(sp, AttachmentPt, itemID, group);
224 234
@@ -548,7 +558,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
548 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", 558 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
549 grp.UUID, grp.GetAttachmentPoint()); 559 grp.UUID, grp.GetAttachmentPoint());
550 560
551 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); 561 // If we're being called from a script, then trying to serialize that same script's state will not complete
562 // in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if
563 // the client/server crashes rather than logging out normally, the attachment's scripts will resume
564 // without state on relog. Arguably, this is what we want anyway.
565 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false);
566
552 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 567 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
553 item = m_scene.InventoryService.GetItem(item); 568 item = m_scene.InventoryService.GetItem(item);
554 569