aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs223
1 files changed, 194 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index db081cc..6a742c1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -136,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes
136 protected SceneCommunicationService m_sceneGridService; 136 protected SceneCommunicationService m_sceneGridService;
137 public bool LoginsDisabled = true; 137 public bool LoginsDisabled = true;
138 public bool LoadingPrims = false; 138 public bool LoadingPrims = false;
139 public bool CombineRegions = false;
139 140
140 public new float TimeDilation 141 public new float TimeDilation
141 { 142 {
@@ -149,6 +150,20 @@ namespace OpenSim.Region.Framework.Scenes
149 150
150 public IXfer XferManager; 151 public IXfer XferManager;
151 152
153 protected ISnmpModule m_snmpService = null;
154 public ISnmpModule SnmpService
155 {
156 get
157 {
158 if (m_snmpService == null)
159 {
160 m_snmpService = RequestModuleInterface<ISnmpModule>();
161 }
162
163 return m_snmpService;
164 }
165 }
166
152 protected IAssetService m_AssetService; 167 protected IAssetService m_AssetService;
153 protected IAuthorizationService m_AuthorizationService; 168 protected IAuthorizationService m_AuthorizationService;
154 169
@@ -383,6 +398,7 @@ namespace OpenSim.Region.Framework.Scenes
383 private bool m_firstHeartbeat = true; 398 private bool m_firstHeartbeat = true;
384 399
385 private object m_deleting_scene_object = new object(); 400 private object m_deleting_scene_object = new object();
401 private object m_cleaningAttachments = new object();
386 402
387 // the minimum time that must elapse before a changed object will be considered for persisted 403 // the minimum time that must elapse before a changed object will be considered for persisted
388 public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L; 404 public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
@@ -543,6 +559,8 @@ namespace OpenSim.Region.Framework.Scenes
543 559
544 // Load region settings 560 // Load region settings
545 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); 561 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
562 m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
563
546 if (m_storageManager.EstateDataStore != null) 564 if (m_storageManager.EstateDataStore != null)
547 { 565 {
548 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); 566 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
@@ -605,9 +623,10 @@ namespace OpenSim.Region.Framework.Scenes
605 //Animation states 623 //Animation states
606 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 624 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
607 // TODO: Change default to true once the feature is supported 625 // TODO: Change default to true once the feature is supported
608 m_usePreJump = startupConfig.GetBoolean("enableprejump", false); 626 m_usePreJump = startupConfig.GetBoolean("enableprejump", true);
609
610 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); 627 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
628
629 m_log.DebugFormat("[SCENE]: prejump is {0}", m_usePreJump ? "ON" : "OFF");
611 if (RegionInfo.NonphysPrimMax > 0) 630 if (RegionInfo.NonphysPrimMax > 0)
612 { 631 {
613 m_maxNonphys = RegionInfo.NonphysPrimMax; 632 m_maxNonphys = RegionInfo.NonphysPrimMax;
@@ -639,6 +658,7 @@ namespace OpenSim.Region.Framework.Scenes
639 m_persistAfter *= 10000000; 658 m_persistAfter *= 10000000;
640 659
641 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); 660 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
661 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
642 662
643 IConfig packetConfig = m_config.Configs["PacketPool"]; 663 IConfig packetConfig = m_config.Configs["PacketPool"];
644 if (packetConfig != null) 664 if (packetConfig != null)
@@ -648,6 +668,7 @@ namespace OpenSim.Region.Framework.Scenes
648 } 668 }
649 669
650 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); 670 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
671 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
651 672
652 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); 673 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
653 if (m_generateMaptiles) 674 if (m_generateMaptiles)
@@ -672,9 +693,9 @@ namespace OpenSim.Region.Framework.Scenes
672 } 693 }
673 } 694 }
674 } 695 }
675 catch 696 catch (Exception e)
676 { 697 {
677 m_log.Warn("[SCENE]: Failed to load StartupConfig"); 698 m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString());
678 } 699 }
679 700
680 #endregion Region Config 701 #endregion Region Config
@@ -911,6 +932,15 @@ namespace OpenSim.Region.Framework.Scenes
911 /// <param name="seconds">float indicating duration before restart.</param> 932 /// <param name="seconds">float indicating duration before restart.</param>
912 public virtual void Restart(float seconds) 933 public virtual void Restart(float seconds)
913 { 934 {
935 Restart(seconds, true);
936 }
937
938 /// <summary>
939 /// Given float seconds, this will restart the region. showDialog will optionally alert the users.
940 /// </summary>
941 /// <param name="seconds">float indicating duration before restart.</param>
942 public virtual void Restart(float seconds, bool showDialog)
943 {
914 // notifications are done in 15 second increments 944 // notifications are done in 15 second increments
915 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request 945 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request
916 // It's a 'Cancel restart' request. 946 // It's a 'Cancel restart' request.
@@ -931,8 +961,11 @@ namespace OpenSim.Region.Framework.Scenes
931 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); 961 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
932 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); 962 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
933 m_restartTimer.Start(); 963 m_restartTimer.Start();
934 m_dialogModule.SendNotificationToUsersInRegion( 964 if (showDialog)
965 {
966 m_dialogModule.SendNotificationToUsersInRegion(
935 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0))); 967 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0)));
968 }
936 } 969 }
937 } 970 }
938 971
@@ -1290,16 +1323,16 @@ namespace OpenSim.Region.Framework.Scenes
1290 // Check if any objects have reached their targets 1323 // Check if any objects have reached their targets
1291 CheckAtTargets(); 1324 CheckAtTargets();
1292 1325
1293 // Update SceneObjectGroups that have scheduled themselves for updates
1294 // Objects queue their updates onto all scene presences
1295 if (m_frame % m_update_objects == 0)
1296 m_sceneGraph.UpdateObjectGroups();
1297
1298 // Run through all ScenePresences looking for updates 1326 // Run through all ScenePresences looking for updates
1299 // Presence updates and queued object updates for each presence are sent to clients 1327 // Presence updates and queued object updates for each presence are sent to clients
1300 if (m_frame % m_update_presences == 0) 1328 if (m_frame % m_update_presences == 0)
1301 m_sceneGraph.UpdatePresences(); 1329 m_sceneGraph.UpdatePresences();
1302 1330
1331 // Update SceneObjectGroups that have scheduled themselves for updates
1332 // Objects queue their updates onto all scene presences
1333 if (m_frame % m_update_objects == 0)
1334 m_sceneGraph.UpdateObjectGroups();
1335
1303 if (m_frame % m_update_coarse_locations == 0) 1336 if (m_frame % m_update_coarse_locations == 0)
1304 { 1337 {
1305 List<Vector3> coarseLocations; 1338 List<Vector3> coarseLocations;
@@ -1628,6 +1661,7 @@ namespace OpenSim.Region.Framework.Scenes
1628 public void StoreWindlightProfile(RegionLightShareData wl) 1661 public void StoreWindlightProfile(RegionLightShareData wl)
1629 { 1662 {
1630 m_regInfo.WindlightSettings = wl; 1663 m_regInfo.WindlightSettings = wl;
1664 wl.Save();
1631 m_storageManager.DataStore.StoreRegionWindlightSettings(wl); 1665 m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
1632 m_eventManager.TriggerOnSaveNewWindlightProfile(); 1666 m_eventManager.TriggerOnSaveNewWindlightProfile();
1633 } 1667 }
@@ -1789,14 +1823,24 @@ namespace OpenSim.Region.Framework.Scenes
1789 /// <returns></returns> 1823 /// <returns></returns>
1790 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) 1824 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
1791 { 1825 {
1826
1827 float wheight = (float)RegionInfo.RegionSettings.WaterHeight;
1828 Vector3 wpos = Vector3.Zero;
1829 // Check for water surface intersection from above
1830 if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) )
1831 {
1832 float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z);
1833 wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X));
1834 wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y));
1835 wpos.Z = wheight;
1836 }
1837
1792 Vector3 pos = Vector3.Zero; 1838 Vector3 pos = Vector3.Zero;
1793 if (RayEndIsIntersection == (byte)1) 1839 if (RayEndIsIntersection == (byte)1)
1794 { 1840 {
1795 pos = RayEnd; 1841 pos = RayEnd;
1796 return pos;
1797 } 1842 }
1798 1843 else if (RayTargetID != UUID.Zero)
1799 if (RayTargetID != UUID.Zero)
1800 { 1844 {
1801 SceneObjectPart target = GetSceneObjectPart(RayTargetID); 1845 SceneObjectPart target = GetSceneObjectPart(RayTargetID);
1802 1846
@@ -1818,7 +1862,7 @@ namespace OpenSim.Region.Framework.Scenes
1818 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); 1862 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter);
1819 1863
1820 // Un-comment out the following line to Get Raytrace results printed to the console. 1864 // Un-comment out the following line to Get Raytrace results printed to the console.
1821 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); 1865 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
1822 float ScaleOffset = 0.5f; 1866 float ScaleOffset = 0.5f;
1823 1867
1824 // If we hit something 1868 // If we hit something
@@ -1841,13 +1885,10 @@ namespace OpenSim.Region.Framework.Scenes
1841 //pos.Z -= 0.25F; 1885 //pos.Z -= 0.25F;
1842 1886
1843 } 1887 }
1844
1845 return pos;
1846 } 1888 }
1847 else 1889 else
1848 { 1890 {
1849 // We don't have a target here, so we're going to raytrace all the objects in the scene. 1891 // We don't have a target here, so we're going to raytrace all the objects in the scene.
1850
1851 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); 1892 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false);
1852 1893
1853 // Un-comment the following line to print the raytrace results to the console. 1894 // Un-comment the following line to print the raytrace results to the console.
@@ -1856,13 +1897,12 @@ namespace OpenSim.Region.Framework.Scenes
1856 if (ei.HitTF) 1897 if (ei.HitTF)
1857 { 1898 {
1858 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 1899 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
1859 } else 1900 }
1901 else
1860 { 1902 {
1861 // fall back to our stupid functionality 1903 // fall back to our stupid functionality
1862 pos = RayEnd; 1904 pos = RayEnd;
1863 } 1905 }
1864
1865 return pos;
1866 } 1906 }
1867 } 1907 }
1868 else 1908 else
@@ -1873,8 +1913,12 @@ namespace OpenSim.Region.Framework.Scenes
1873 //increase height so its above the ground. 1913 //increase height so its above the ground.
1874 //should be getting the normal of the ground at the rez point and using that? 1914 //should be getting the normal of the ground at the rez point and using that?
1875 pos.Z += scale.Z / 2f; 1915 pos.Z += scale.Z / 2f;
1876 return pos; 1916// return pos;
1877 } 1917 }
1918
1919 // check against posible water intercept
1920 if (wpos.Z > pos.Z) pos = wpos;
1921 return pos;
1878 } 1922 }
1879 1923
1880 1924
@@ -2031,6 +2075,15 @@ namespace OpenSim.Region.Framework.Scenes
2031 /// </summary> 2075 /// </summary>
2032 public void DeleteAllSceneObjects() 2076 public void DeleteAllSceneObjects()
2033 { 2077 {
2078 DeleteAllSceneObjects(false);
2079 }
2080
2081 /// <summary>
2082 /// Delete every object from the scene. This does not include attachments worn by avatars.
2083 /// </summary>
2084 public void DeleteAllSceneObjects(bool exceptNoCopy)
2085 {
2086 List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
2034 lock (Entities) 2087 lock (Entities)
2035 { 2088 {
2036 ICollection<EntityBase> entities = new List<EntityBase>(Entities); 2089 ICollection<EntityBase> entities = new List<EntityBase>(Entities);
@@ -2040,11 +2093,24 @@ namespace OpenSim.Region.Framework.Scenes
2040 if (e is SceneObjectGroup) 2093 if (e is SceneObjectGroup)
2041 { 2094 {
2042 SceneObjectGroup sog = (SceneObjectGroup)e; 2095 SceneObjectGroup sog = (SceneObjectGroup)e;
2043 if (!sog.IsAttachment) 2096 if (sog != null && !sog.IsAttachment)
2044 DeleteSceneObject((SceneObjectGroup)e, false); 2097 {
2098 if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0))
2099 {
2100 DeleteSceneObject((SceneObjectGroup)e, false);
2101 }
2102 else
2103 {
2104 toReturn.Add((SceneObjectGroup)e);
2105 }
2106 }
2045 } 2107 }
2046 } 2108 }
2047 } 2109 }
2110 if (toReturn.Count > 0)
2111 {
2112 returnObjects(toReturn.ToArray(), UUID.Zero);
2113 }
2048 } 2114 }
2049 2115
2050 /// <summary> 2116 /// <summary>
@@ -2417,6 +2483,12 @@ namespace OpenSim.Region.Framework.Scenes
2417 /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> 2483 /// <returns>True if the SceneObjectGroup was added, False if it was not</returns>
2418 public bool AddSceneObject(SceneObjectGroup sceneObject) 2484 public bool AddSceneObject(SceneObjectGroup sceneObject)
2419 { 2485 {
2486 if (sceneObject.OwnerID == UUID.Zero)
2487 {
2488 m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID);
2489 return false;
2490 }
2491
2420 // If the user is banned, we won't let any of their objects 2492 // If the user is banned, we won't let any of their objects
2421 // enter. Period. 2493 // enter. Period.
2422 // 2494 //
@@ -2466,15 +2538,28 @@ namespace OpenSim.Region.Framework.Scenes
2466 2538
2467 if (AttachmentsModule != null) 2539 if (AttachmentsModule != null)
2468 AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); 2540 AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false);
2541
2542 m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was found, attaching", sceneObject.UUID);
2469 } 2543 }
2470 else 2544 else
2471 { 2545 {
2546 m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID);
2472 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2547 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2473 RootPrim.AddFlag(PrimFlags.TemporaryOnRez); 2548 RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
2474 } 2549 }
2550 if (sceneObject.OwnerID == UUID.Zero)
2551 {
2552 m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID);
2553 return false;
2554 }
2475 } 2555 }
2476 else 2556 else
2477 { 2557 {
2558 if (sceneObject.OwnerID == UUID.Zero)
2559 {
2560 m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID);
2561 return false;
2562 }
2478 AddRestoredSceneObject(sceneObject, true, false); 2563 AddRestoredSceneObject(sceneObject, true, false);
2479 2564
2480 if (!Permissions.CanObjectEntry(sceneObject.UUID, 2565 if (!Permissions.CanObjectEntry(sceneObject.UUID,
@@ -2745,6 +2830,7 @@ namespace OpenSim.Region.Framework.Scenes
2745 client.OnFetchInventory += HandleFetchInventory; 2830 client.OnFetchInventory += HandleFetchInventory;
2746 client.OnUpdateInventoryItem += UpdateInventoryItemAsset; 2831 client.OnUpdateInventoryItem += UpdateInventoryItemAsset;
2747 client.OnCopyInventoryItem += CopyInventoryItem; 2832 client.OnCopyInventoryItem += CopyInventoryItem;
2833 client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy;
2748 client.OnMoveInventoryItem += MoveInventoryItem; 2834 client.OnMoveInventoryItem += MoveInventoryItem;
2749 client.OnRemoveInventoryItem += RemoveInventoryItem; 2835 client.OnRemoveInventoryItem += RemoveInventoryItem;
2750 client.OnRemoveInventoryFolder += RemoveInventoryFolder; 2836 client.OnRemoveInventoryFolder += RemoveInventoryFolder;
@@ -3030,6 +3116,16 @@ namespace OpenSim.Region.Framework.Scenes
3030 /// <param name="flags"></param> 3116 /// <param name="flags"></param>
3031 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 3117 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3032 { 3118 {
3119 //Add half the avatar's height so that the user doesn't fall through prims
3120 ScenePresence presence;
3121 if (TryGetScenePresence(remoteClient.AgentId, out presence))
3122 {
3123 if (presence.Appearance != null)
3124 {
3125 position.Z = position.Z + (presence.Appearance.AvatarHeight / 2);
3126 }
3127 }
3128
3033 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) 3129 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3034 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 3130 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3035 m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); 3131 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
@@ -3124,7 +3220,9 @@ namespace OpenSim.Region.Framework.Scenes
3124 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); 3220 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
3125 3221
3126 } 3222 }
3223 m_log.Debug("[Scene] Beginning ClientClosed");
3127 m_eventManager.TriggerClientClosed(agentID, this); 3224 m_eventManager.TriggerClientClosed(agentID, this);
3225 m_log.Debug("[Scene] Finished ClientClosed");
3128 } 3226 }
3129 catch (NullReferenceException) 3227 catch (NullReferenceException)
3130 { 3228 {
@@ -3132,7 +3230,10 @@ namespace OpenSim.Region.Framework.Scenes
3132 // Avatar is already disposed :/ 3230 // Avatar is already disposed :/
3133 } 3231 }
3134 3232
3233 m_log.Debug("[Scene] Beginning OnRemovePresence");
3135 m_eventManager.TriggerOnRemovePresence(agentID); 3234 m_eventManager.TriggerOnRemovePresence(agentID);
3235 m_log.Debug("[Scene] Finished OnRemovePresence");
3236
3136 ForEachClient( 3237 ForEachClient(
3137 delegate(IClientAPI client) 3238 delegate(IClientAPI client)
3138 { 3239 {
@@ -3148,8 +3249,11 @@ namespace OpenSim.Region.Framework.Scenes
3148 } 3249 }
3149 3250
3150 // Remove the avatar from the scene 3251 // Remove the avatar from the scene
3252 m_log.Debug("[Scene] Begin RemoveScenePresence");
3151 m_sceneGraph.RemoveScenePresence(agentID); 3253 m_sceneGraph.RemoveScenePresence(agentID);
3254 m_log.Debug("[Scene] Finished RemoveScenePresence. Removing the client manager");
3152 m_clientManager.Remove(agentID); 3255 m_clientManager.Remove(agentID);
3256 m_log.Debug("[Scene] Removed the client manager. Firing avatar.close");
3153 3257
3154 try 3258 try
3155 { 3259 {
@@ -3163,8 +3267,10 @@ namespace OpenSim.Region.Framework.Scenes
3163 { 3267 {
3164 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); 3268 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString());
3165 } 3269 }
3166 3270 m_log.Debug("[Scene] Done. Firing RemoveCircuit");
3167 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); 3271 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
3272 CleanDroppedAttachments();
3273 m_log.Debug("[Scene] The avatar has left the building");
3168 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 3274 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
3169 //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); 3275 //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
3170 } 3276 }
@@ -3304,6 +3410,7 @@ namespace OpenSim.Region.Framework.Scenes
3304 { 3410 {
3305 if (land != null && !TestLandRestrictions(agent, land, out reason)) 3411 if (land != null && !TestLandRestrictions(agent, land, out reason))
3306 { 3412 {
3413 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString());
3307 return false; 3414 return false;
3308 } 3415 }
3309 } 3416 }
@@ -3361,6 +3468,8 @@ namespace OpenSim.Region.Framework.Scenes
3361 3468
3362 if (vialogin) 3469 if (vialogin)
3363 { 3470 {
3471 CleanDroppedAttachments();
3472
3364 if (TestBorderCross(agent.startpos, Cardinals.E)) 3473 if (TestBorderCross(agent.startpos, Cardinals.E))
3365 { 3474 {
3366 Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); 3475 Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E);
@@ -3417,6 +3526,8 @@ namespace OpenSim.Region.Framework.Scenes
3417 } 3526 }
3418 } 3527 }
3419 // Honor parcel landing type and position. 3528 // Honor parcel landing type and position.
3529 /*
3530 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3420 if (land != null) 3531 if (land != null)
3421 { 3532 {
3422 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) 3533 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
@@ -3424,6 +3535,7 @@ namespace OpenSim.Region.Framework.Scenes
3424 agent.startpos = land.LandData.UserLocation; 3535 agent.startpos = land.LandData.UserLocation;
3425 } 3536 }
3426 } 3537 }
3538 */// This is now handled properly in ScenePresence.MakeRootAgent
3427 } 3539 }
3428 3540
3429 return true; 3541 return true;
@@ -3774,12 +3886,22 @@ namespace OpenSim.Region.Framework.Scenes
3774 return false; 3886 return false;
3775 } 3887 }
3776 3888
3889 public bool IncomingCloseAgent(UUID agentID)
3890 {
3891 return IncomingCloseAgent(agentID, false);
3892 }
3893
3894 public bool IncomingCloseChildAgent(UUID agentID)
3895 {
3896 return IncomingCloseAgent(agentID, true);
3897 }
3898
3777 /// <summary> 3899 /// <summary>
3778 /// Tell a single agent to disconnect from the region. 3900 /// Tell a single agent to disconnect from the region.
3779 /// </summary> 3901 /// </summary>
3780 /// <param name="regionHandle"></param>
3781 /// <param name="agentID"></param> 3902 /// <param name="agentID"></param>
3782 public bool IncomingCloseAgent(UUID agentID) 3903 /// <param name="childOnly"></param>
3904 public bool IncomingCloseAgent(UUID agentID, bool childOnly)
3783 { 3905 {
3784 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 3906 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
3785 3907
@@ -3791,7 +3913,7 @@ namespace OpenSim.Region.Framework.Scenes
3791 { 3913 {
3792 m_sceneGraph.removeUserCount(false); 3914 m_sceneGraph.removeUserCount(false);
3793 } 3915 }
3794 else 3916 else if (!childOnly)
3795 { 3917 {
3796 m_sceneGraph.removeUserCount(true); 3918 m_sceneGraph.removeUserCount(true);
3797 } 3919 }
@@ -3807,9 +3929,12 @@ namespace OpenSim.Region.Framework.Scenes
3807 } 3929 }
3808 else 3930 else
3809 presence.ControllingClient.SendShutdownConnectionNotice(); 3931 presence.ControllingClient.SendShutdownConnectionNotice();
3932 presence.ControllingClient.Close(false);
3933 }
3934 else if (!childOnly)
3935 {
3936 presence.ControllingClient.Close(true);
3810 } 3937 }
3811
3812 presence.ControllingClient.Close();
3813 return true; 3938 return true;
3814 } 3939 }
3815 3940
@@ -4931,5 +5056,45 @@ namespace OpenSim.Region.Framework.Scenes
4931 throw new Exception(error); 5056 throw new Exception(error);
4932 } 5057 }
4933 } 5058 }
5059
5060 public void CleanDroppedAttachments()
5061 {
5062 List<SceneObjectGroup> objectsToDelete =
5063 new List<SceneObjectGroup>();
5064
5065 lock (m_cleaningAttachments)
5066 {
5067 ForEachSOG(delegate (SceneObjectGroup grp)
5068 {
5069 if (grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp)))
5070 {
5071 UUID agentID = grp.OwnerID;
5072 if (agentID == UUID.Zero)
5073 {
5074 objectsToDelete.Add(grp);
5075 return;
5076 }
5077
5078 ScenePresence sp = GetScenePresence(agentID);
5079 if (sp == null)
5080 {
5081 objectsToDelete.Add(grp);
5082 return;
5083 }
5084 }
5085 });
5086 }
5087
5088 if (objectsToDelete.Count > 0)
5089 {
5090 m_log.DebugFormat("[SCENE]: Starting delete of {0} dropped attachments", objectsToDelete.Count);
5091 foreach (SceneObjectGroup grp in objectsToDelete)
5092 {
5093 m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID);
5094 DeleteSceneObject(grp, true);
5095 }
5096 m_log.Debug("[SCENE]: Finished dropped attachment deletion");
5097 }
5098 }
4934 } 5099 }
4935} 5100}