aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs61
1 files changed, 32 insertions, 29 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 7963e53..c24cc17 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -208,7 +208,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
208 sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); 208 sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
209 sp.Teleport(position); 209 sp.Teleport(position);
210 210
211 foreach (SceneObjectGroup grp in sp.Attachments) 211 foreach (SceneObjectGroup grp in sp.GetAttachments())
212 sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT); 212 sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT);
213 } 213 }
214 else // Another region possibly in another simulator 214 else // Another region possibly in another simulator
@@ -559,11 +559,11 @@ 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.Attachments) 562 foreach (SceneObjectGroup sop in sp.GetAttachments())
563 { 563 {
564 sop.Scene.DeleteSceneObject(sop, true); 564 sop.Scene.DeleteSceneObject(sop, true);
565 } 565 }
566 sp.Attachments.Clear(); 566 sp.ClearAttachments();
567 } 567 }
568 568
569 protected void KillEntity(Scene scene, uint localID) 569 protected void KillEntity(Scene scene, uint localID)
@@ -1764,34 +1764,33 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1764 1764
1765 protected bool CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent) 1765 protected bool CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent)
1766 { 1766 {
1767 List<SceneObjectGroup> m_attachments = sp.Attachments; 1767 List<SceneObjectGroup> m_attachments = sp.GetAttachments();
1768 lock (m_attachments) 1768
1769 // Validate
1770 foreach (SceneObjectGroup gobj in m_attachments)
1769 { 1771 {
1770 // Validate 1772 if (gobj == null || gobj.IsDeleted)
1771 foreach (SceneObjectGroup gobj in m_attachments) 1773 return false;
1772 { 1774 }
1773 if (gobj == null || gobj.IsDeleted)
1774 return false;
1775 }
1776 1775
1777 foreach (SceneObjectGroup gobj in m_attachments) 1776 foreach (SceneObjectGroup gobj in m_attachments)
1777 {
1778 // If the prim group is null then something must have happened to it!
1779 if (gobj != null && gobj.RootPart != null)
1778 { 1780 {
1779 // If the prim group is null then something must have happened to it! 1781 // Set the parent localID to 0 so it transfers over properly.
1780 if (gobj != null && gobj.RootPart != null) 1782 gobj.RootPart.SetParentLocalId(0);
1781 { 1783 gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
1782 // Set the parent localID to 0 so it transfers over properly. 1784 gobj.IsAttachment = false;
1783 gobj.RootPart.SetParentLocalId(0); 1785 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
1784 gobj.AbsolutePosition = gobj.RootPart.AttachedPos; 1786 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
1785 gobj.IsAttachment = false; 1787 CrossPrimGroupIntoNewRegion(destination, gobj, silent);
1786 //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
1787 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
1788 CrossPrimGroupIntoNewRegion(destination, gobj, silent);
1789 }
1790 } 1788 }
1791 m_attachments.Clear();
1792
1793 return true;
1794 } 1789 }
1790
1791 sp.ClearAttachments();
1792
1793 return true;
1795 } 1794 }
1796 1795
1797 #endregion 1796 #endregion
@@ -1840,7 +1839,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1840 int i = 0; 1839 int i = 0;
1841 if (sp.InTransitScriptStates.Count > 0) 1840 if (sp.InTransitScriptStates.Count > 0)
1842 { 1841 {
1843 sp.Attachments.ForEach(delegate(SceneObjectGroup sog) 1842 List<SceneObjectGroup> attachments = sp.GetAttachments();
1843
1844 foreach (SceneObjectGroup sog in attachments)
1844 { 1845 {
1845 if (i < sp.InTransitScriptStates.Count) 1846 if (i < sp.InTransitScriptStates.Count)
1846 { 1847 {
@@ -1849,8 +1850,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1849 sog.ResumeScripts(); 1850 sog.ResumeScripts();
1850 } 1851 }
1851 else 1852 else
1852 m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: InTransitScriptStates.Count={0} smaller than Attachments.Count={1}", sp.InTransitScriptStates.Count, sp.Attachments.Count); 1853 m_log.ErrorFormat(
1853 }); 1854 "[ENTITY TRANSFER MODULE]: InTransitScriptStates.Count={0} smaller than Attachments.Count={1}",
1855 sp.InTransitScriptStates.Count, attachments.Count);
1856 }
1854 1857
1855 sp.InTransitScriptStates.Clear(); 1858 sp.InTransitScriptStates.Clear();
1856 } 1859 }