diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 71 |
1 files changed, 37 insertions, 34 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 90f0ca2..faccab2 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -209,7 +209,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
209 | sp.TeleportFlags = (TeleportFlags)teleportFlags; | 209 | sp.TeleportFlags = (TeleportFlags)teleportFlags; |
210 | sp.Teleport(position); | 210 | sp.Teleport(position); |
211 | 211 | ||
212 | foreach (SceneObjectGroup grp in sp.Attachments) | 212 | foreach (SceneObjectGroup grp in sp.GetAttachments()) |
213 | sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT); | 213 | sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT); |
214 | } | 214 | } |
215 | else // Another region possibly in another simulator | 215 | else // Another region possibly in another simulator |
@@ -494,7 +494,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
494 | // Now let's make it officially a child agent | 494 | // Now let's make it officially a child agent |
495 | sp.MakeChildAgent(); | 495 | sp.MakeChildAgent(); |
496 | 496 | ||
497 | sp.Scene.CleanDroppedAttachments(); | 497 | // sp.Scene.CleanDroppedAttachments(); |
498 | 498 | ||
499 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 499 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
500 | 500 | ||
@@ -560,11 +560,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
560 | 560 | ||
561 | protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) | 561 | protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) |
562 | { | 562 | { |
563 | foreach (SceneObjectGroup sop in sp.Attachments) | 563 | sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true); |
564 | { | ||
565 | sop.Scene.DeleteSceneObject(sop, true); | ||
566 | } | ||
567 | sp.Attachments.Clear(); | ||
568 | } | 564 | } |
569 | 565 | ||
570 | protected void KillEntity(Scene scene, uint localID) | 566 | protected void KillEntity(Scene scene, uint localID) |
@@ -1088,10 +1084,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1088 | #endregion | 1084 | #endregion |
1089 | 1085 | ||
1090 | #region Enable Child Agent | 1086 | #region Enable Child Agent |
1087 | |||
1091 | /// <summary> | 1088 | /// <summary> |
1092 | /// This informs a single neighbouring region about agent "avatar". | 1089 | /// This informs a single neighbouring region about agent "avatar". |
1093 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | 1090 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
1094 | /// </summary> | 1091 | /// </summary> |
1092 | /// <param name="sp"></param> | ||
1093 | /// <param name="region"></param> | ||
1095 | public void EnableChildAgent(ScenePresence sp, GridRegion region) | 1094 | public void EnableChildAgent(ScenePresence sp, GridRegion region) |
1096 | { | 1095 | { |
1097 | m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName); | 1096 | m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName); |
@@ -1153,6 +1152,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1153 | /// This informs all neighbouring regions about agent "avatar". | 1152 | /// This informs all neighbouring regions about agent "avatar". |
1154 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | 1153 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
1155 | /// </summary> | 1154 | /// </summary> |
1155 | /// <param name="sp"></param> | ||
1156 | public void EnableChildAgents(ScenePresence sp) | 1156 | public void EnableChildAgents(ScenePresence sp) |
1157 | { | 1157 | { |
1158 | List<GridRegion> neighbours = new List<GridRegion>(); | 1158 | List<GridRegion> neighbours = new List<GridRegion>(); |
@@ -1340,7 +1340,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1340 | Utils.LongToUInts(reg.RegionHandle, out x, out y); | 1340 | Utils.LongToUInts(reg.RegionHandle, out x, out y); |
1341 | x = x / Constants.RegionSize; | 1341 | x = x / Constants.RegionSize; |
1342 | y = y / Constants.RegionSize; | 1342 | y = y / Constants.RegionSize; |
1343 | m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); | 1343 | m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint + ")"); |
1344 | 1344 | ||
1345 | string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); | 1345 | string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); |
1346 | 1346 | ||
@@ -1786,34 +1786,33 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1786 | 1786 | ||
1787 | protected bool CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent) | 1787 | protected bool CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent) |
1788 | { | 1788 | { |
1789 | List<SceneObjectGroup> m_attachments = sp.Attachments; | 1789 | List<SceneObjectGroup> m_attachments = sp.GetAttachments(); |
1790 | lock (m_attachments) | 1790 | |
1791 | // Validate | ||
1792 | foreach (SceneObjectGroup gobj in m_attachments) | ||
1791 | { | 1793 | { |
1792 | // Validate | 1794 | if (gobj == null || gobj.IsDeleted) |
1793 | foreach (SceneObjectGroup gobj in m_attachments) | 1795 | return false; |
1794 | { | 1796 | } |
1795 | if (gobj == null || gobj.IsDeleted) | ||
1796 | return false; | ||
1797 | } | ||
1798 | 1797 | ||
1799 | foreach (SceneObjectGroup gobj in m_attachments) | 1798 | foreach (SceneObjectGroup gobj in m_attachments) |
1799 | { | ||
1800 | // If the prim group is null then something must have happened to it! | ||
1801 | if (gobj != null) | ||
1800 | { | 1802 | { |
1801 | // If the prim group is null then something must have happened to it! | 1803 | // Set the parent localID to 0 so it transfers over properly. |
1802 | if (gobj != null && gobj.RootPart != null) | 1804 | gobj.RootPart.SetParentLocalId(0); |
1803 | { | 1805 | gobj.AbsolutePosition = gobj.RootPart.AttachedPos; |
1804 | // Set the parent localID to 0 so it transfers over properly. | 1806 | gobj.IsAttachment = false; |
1805 | gobj.RootPart.SetParentLocalId(0); | 1807 | //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); |
1806 | gobj.AbsolutePosition = gobj.RootPart.AttachedPos; | 1808 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName); |
1807 | gobj.RootPart.IsAttachment = false; | 1809 | CrossPrimGroupIntoNewRegion(destination, gobj, silent); |
1808 | //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); | ||
1809 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName); | ||
1810 | CrossPrimGroupIntoNewRegion(destination, gobj, silent); | ||
1811 | } | ||
1812 | } | 1810 | } |
1813 | m_attachments.Clear(); | ||
1814 | |||
1815 | return true; | ||
1816 | } | 1811 | } |
1812 | |||
1813 | sp.ClearAttachments(); | ||
1814 | |||
1815 | return true; | ||
1817 | } | 1816 | } |
1818 | 1817 | ||
1819 | #endregion | 1818 | #endregion |
@@ -1862,7 +1861,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1862 | int i = 0; | 1861 | int i = 0; |
1863 | if (sp.InTransitScriptStates.Count > 0) | 1862 | if (sp.InTransitScriptStates.Count > 0) |
1864 | { | 1863 | { |
1865 | sp.Attachments.ForEach(delegate(SceneObjectGroup sog) | 1864 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
1865 | |||
1866 | foreach (SceneObjectGroup sog in attachments) | ||
1866 | { | 1867 | { |
1867 | if (i < sp.InTransitScriptStates.Count) | 1868 | if (i < sp.InTransitScriptStates.Count) |
1868 | { | 1869 | { |
@@ -1871,8 +1872,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1871 | sog.ResumeScripts(); | 1872 | sog.ResumeScripts(); |
1872 | } | 1873 | } |
1873 | else | 1874 | else |
1874 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: InTransitScriptStates.Count={0} smaller than Attachments.Count={1}", sp.InTransitScriptStates.Count, sp.Attachments.Count); | 1875 | m_log.ErrorFormat( |
1875 | }); | 1876 | "[ENTITY TRANSFER MODULE]: InTransitScriptStates.Count={0} smaller than Attachments.Count={1}", |
1877 | sp.InTransitScriptStates.Count, attachments.Count); | ||
1878 | } | ||
1876 | 1879 | ||
1877 | sp.InTransitScriptStates.Clear(); | 1880 | sp.InTransitScriptStates.Clear(); |
1878 | } | 1881 | } |