aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs9
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScenePresence.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs14
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs6
6 files changed, 37 insertions, 25 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 9e5ce8f..587f35e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -147,6 +147,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
147 } 147 }
148 } 148 }
149 } 149 }
150
151 public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent)
152 {
153 foreach (SceneObjectGroup sop in sp.GetAttachments())
154 {
155 sop.Scene.DeleteSceneObject(sop, silent);
156 }
157
158 sp.ClearAttachments();
159 }
150 160
151 /// <summary> 161 /// <summary>
152 /// Called by client 162 /// Called by client
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index c24cc17..82bdf20 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -559,11 +559,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
559 559
560 protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) 560 protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
561 { 561 {
562 foreach (SceneObjectGroup sop in sp.GetAttachments()) 562 sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true);
563 {
564 sop.Scene.DeleteSceneObject(sop, true);
565 }
566 sp.ClearAttachments();
567 } 563 }
568 564
569 protected void KillEntity(Scene scene, uint localID) 565 protected void KillEntity(Scene scene, uint localID)
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index ce795f1..dd11ded 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -48,6 +48,15 @@ namespace OpenSim.Region.Framework.Interfaces
48 void SaveChangedAttachments(IScenePresence sp); 48 void SaveChangedAttachments(IScenePresence sp);
49 49
50 /// <summary> 50 /// <summary>
51 /// Delete all the presence's attachments from the scene
52 /// </summary>
53 /// <param name="sp">
54 /// This is done when a root agent leaves/is demoted to child (for instance, on logout, teleport or region cross).
55 /// </param>
56 /// <param name="silent"></param>
57 void DeleteAttachmentsFromScene(IScenePresence sp, bool silent);
58
59 /// <summary>
51 /// Attach an object to an avatar from the world. 60 /// Attach an object to an avatar from the world.
52 /// </summary> 61 /// </summary>
53 /// <param name="controllingClient"></param> 62 /// <param name="controllingClient"></param>
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index 788b36f..91e4bf2 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -62,9 +62,22 @@ namespace OpenSim.Region.Framework.Interfaces
62 /// A copy of the list. 62 /// A copy of the list.
63 /// </returns> 63 /// </returns>
64 /// <remarks> 64 /// <remarks>
65 /// Do not change this list directly - use methods such as 65 /// Do not change this list directly - use the attachments module.
66 /// AddAttachment() and RemoveAttachment().
67 /// </remarks> 66 /// </remarks>
68 List<SceneObjectGroup> GetAttachments(); 67 List<SceneObjectGroup> GetAttachments();
68
69 /// <summary>
70 /// The scene objects attached to this avatar at a specific attachment point.
71 /// </summary>
72 /// <param name="attachmentPoint"></param>
73 /// <returns></returns>
74 List<SceneObjectGroup> GetAttachments(uint attachmentPoint);
75
76 bool HasAttachments();
77
78 // Don't use these methods directly. Instead, use the AttachmentsModule
79 void AddAttachment(SceneObjectGroup gobj);
80 void RemoveAttachment(SceneObjectGroup gobj);
81 void ClearAttachments();
69 } 82 }
70} \ No newline at end of file 83} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5e96b0a..0d284a5 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3401,19 +3401,7 @@ namespace OpenSim.Region.Framework.Scenes
3401 3401
3402 public void Close() 3402 public void Close()
3403 { 3403 {
3404 lock (m_attachments) 3404 m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false);
3405 {
3406 // Delete attachments from scene
3407 // Don't try to save, as this thread won't live long
3408 // enough to complete the save. This would cause no copy
3409 // attachments to poof!
3410 //
3411 foreach (SceneObjectGroup grp in m_attachments)
3412 {
3413 m_scene.DeleteSceneObject(grp, false);
3414 }
3415 m_attachments.Clear();
3416 }
3417 3405
3418 lock (m_knownChildRegions) 3406 lock (m_knownChildRegions)
3419 { 3407 {
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index e58dca2..2fdeeab 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -143,11 +143,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
143 if (!m_avatars.ContainsKey(agentId)) 143 if (!m_avatars.ContainsKey(agentId))
144 return false; 144 return false;
145 145
146 // FIXME: An extremely bad bit of code that reaches directly into the attachments list and manipulates it 146 scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false);
147 foreach (SceneObjectGroup att in sp.GetAttachments())
148 scene.DeleteSceneObject(att, false);
149
150 sp.ClearAttachments();
151 147
152 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); 148 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
153 sp.Appearance = npcAppearance; 149 sp.Appearance = npcAppearance;