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 1f4d022..ec97d25 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>
@@ -2416,6 +2482,12 @@ namespace OpenSim.Region.Framework.Scenes
2416 /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> 2482 /// <returns>True if the SceneObjectGroup was added, False if it was not</returns>
2417 public bool AddSceneObject(SceneObjectGroup sceneObject) 2483 public bool AddSceneObject(SceneObjectGroup sceneObject)
2418 { 2484 {
2485 if (sceneObject.OwnerID == UUID.Zero)
2486 {
2487 m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID);
2488 return false;
2489 }
2490
2419 // If the user is banned, we won't let any of their objects 2491 // If the user is banned, we won't let any of their objects
2420 // enter. Period. 2492 // enter. Period.
2421 // 2493 //
@@ -2465,15 +2537,28 @@ namespace OpenSim.Region.Framework.Scenes
2465 2537
2466 if (AttachmentsModule != null) 2538 if (AttachmentsModule != null)
2467 AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); 2539 AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false);
2540
2541 m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was found, attaching", sceneObject.UUID);
2468 } 2542 }
2469 else 2543 else
2470 { 2544 {
2545 m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID);
2471 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2546 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2472 RootPrim.AddFlag(PrimFlags.TemporaryOnRez); 2547 RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
2473 } 2548 }
2549 if (sceneObject.OwnerID == UUID.Zero)
2550 {
2551 m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID);
2552 return false;
2553 }
2474 } 2554 }
2475 else 2555 else
2476 { 2556 {
2557 if (sceneObject.OwnerID == UUID.Zero)
2558 {
2559 m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID);
2560 return false;
2561 }
2477 AddRestoredSceneObject(sceneObject, true, false); 2562 AddRestoredSceneObject(sceneObject, true, false);
2478 2563
2479 if (!Permissions.CanObjectEntry(sceneObject.UUID, 2564 if (!Permissions.CanObjectEntry(sceneObject.UUID,
@@ -2744,6 +2829,7 @@ namespace OpenSim.Region.Framework.Scenes
2744 client.OnFetchInventory += HandleFetchInventory; 2829 client.OnFetchInventory += HandleFetchInventory;
2745 client.OnUpdateInventoryItem += UpdateInventoryItemAsset; 2830 client.OnUpdateInventoryItem += UpdateInventoryItemAsset;
2746 client.OnCopyInventoryItem += CopyInventoryItem; 2831 client.OnCopyInventoryItem += CopyInventoryItem;
2832 client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy;
2747 client.OnMoveInventoryItem += MoveInventoryItem; 2833 client.OnMoveInventoryItem += MoveInventoryItem;
2748 client.OnRemoveInventoryItem += RemoveInventoryItem; 2834 client.OnRemoveInventoryItem += RemoveInventoryItem;
2749 client.OnRemoveInventoryFolder += RemoveInventoryFolder; 2835 client.OnRemoveInventoryFolder += RemoveInventoryFolder;
@@ -3029,6 +3115,16 @@ namespace OpenSim.Region.Framework.Scenes
3029 /// <param name="flags"></param> 3115 /// <param name="flags"></param>
3030 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 3116 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3031 { 3117 {
3118 //Add half the avatar's height so that the user doesn't fall through prims
3119 ScenePresence presence;
3120 if (TryGetScenePresence(remoteClient.AgentId, out presence))
3121 {
3122 if (presence.Appearance != null)
3123 {
3124 position.Z = position.Z + (presence.Appearance.AvatarHeight / 2);
3125 }
3126 }
3127
3032 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) 3128 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3033 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 3129 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3034 m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); 3130 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
@@ -3123,7 +3219,9 @@ namespace OpenSim.Region.Framework.Scenes
3123 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); 3219 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
3124 3220
3125 } 3221 }
3222 m_log.Debug("[Scene] Beginning ClientClosed");
3126 m_eventManager.TriggerClientClosed(agentID, this); 3223 m_eventManager.TriggerClientClosed(agentID, this);
3224 m_log.Debug("[Scene] Finished ClientClosed");
3127 } 3225 }
3128 catch (NullReferenceException) 3226 catch (NullReferenceException)
3129 { 3227 {
@@ -3131,7 +3229,10 @@ namespace OpenSim.Region.Framework.Scenes
3131 // Avatar is already disposed :/ 3229 // Avatar is already disposed :/
3132 } 3230 }
3133 3231
3232 m_log.Debug("[Scene] Beginning OnRemovePresence");
3134 m_eventManager.TriggerOnRemovePresence(agentID); 3233 m_eventManager.TriggerOnRemovePresence(agentID);
3234 m_log.Debug("[Scene] Finished OnRemovePresence");
3235
3135 ForEachClient( 3236 ForEachClient(
3136 delegate(IClientAPI client) 3237 delegate(IClientAPI client)
3137 { 3238 {
@@ -3147,8 +3248,11 @@ namespace OpenSim.Region.Framework.Scenes
3147 } 3248 }
3148 3249
3149 // Remove the avatar from the scene 3250 // Remove the avatar from the scene
3251 m_log.Debug("[Scene] Begin RemoveScenePresence");
3150 m_sceneGraph.RemoveScenePresence(agentID); 3252 m_sceneGraph.RemoveScenePresence(agentID);
3253 m_log.Debug("[Scene] Finished RemoveScenePresence. Removing the client manager");
3151 m_clientManager.Remove(agentID); 3254 m_clientManager.Remove(agentID);
3255 m_log.Debug("[Scene] Removed the client manager. Firing avatar.close");
3152 3256
3153 try 3257 try
3154 { 3258 {
@@ -3162,8 +3266,10 @@ namespace OpenSim.Region.Framework.Scenes
3162 { 3266 {
3163 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); 3267 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString());
3164 } 3268 }
3165 3269 m_log.Debug("[Scene] Done. Firing RemoveCircuit");
3166 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); 3270 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
3271 CleanDroppedAttachments();
3272 m_log.Debug("[Scene] The avatar has left the building");
3167 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 3273 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
3168 //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); 3274 //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
3169 } 3275 }
@@ -3303,6 +3409,7 @@ namespace OpenSim.Region.Framework.Scenes
3303 { 3409 {
3304 if (land != null && !TestLandRestrictions(agent, land, out reason)) 3410 if (land != null && !TestLandRestrictions(agent, land, out reason))
3305 { 3411 {
3412 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString());
3306 return false; 3413 return false;
3307 } 3414 }
3308 } 3415 }
@@ -3360,6 +3467,8 @@ namespace OpenSim.Region.Framework.Scenes
3360 3467
3361 if (vialogin) 3468 if (vialogin)
3362 { 3469 {
3470 CleanDroppedAttachments();
3471
3363 if (TestBorderCross(agent.startpos, Cardinals.E)) 3472 if (TestBorderCross(agent.startpos, Cardinals.E))
3364 { 3473 {
3365 Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); 3474 Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E);
@@ -3416,6 +3525,8 @@ namespace OpenSim.Region.Framework.Scenes
3416 } 3525 }
3417 } 3526 }
3418 // Honor parcel landing type and position. 3527 // Honor parcel landing type and position.
3528 /*
3529 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3419 if (land != null) 3530 if (land != null)
3420 { 3531 {
3421 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) 3532 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
@@ -3423,6 +3534,7 @@ namespace OpenSim.Region.Framework.Scenes
3423 agent.startpos = land.LandData.UserLocation; 3534 agent.startpos = land.LandData.UserLocation;
3424 } 3535 }
3425 } 3536 }
3537 */// This is now handled properly in ScenePresence.MakeRootAgent
3426 } 3538 }
3427 3539
3428 return true; 3540 return true;
@@ -3785,12 +3897,22 @@ namespace OpenSim.Region.Framework.Scenes
3785 return false; 3897 return false;
3786 } 3898 }
3787 3899
3900 public bool IncomingCloseAgent(UUID agentID)
3901 {
3902 return IncomingCloseAgent(agentID, false);
3903 }
3904
3905 public bool IncomingCloseChildAgent(UUID agentID)
3906 {
3907 return IncomingCloseAgent(agentID, true);
3908 }
3909
3788 /// <summary> 3910 /// <summary>
3789 /// Tell a single agent to disconnect from the region. 3911 /// Tell a single agent to disconnect from the region.
3790 /// </summary> 3912 /// </summary>
3791 /// <param name="regionHandle"></param>
3792 /// <param name="agentID"></param> 3913 /// <param name="agentID"></param>
3793 public bool IncomingCloseAgent(UUID agentID) 3914 /// <param name="childOnly"></param>
3915 public bool IncomingCloseAgent(UUID agentID, bool childOnly)
3794 { 3916 {
3795 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 3917 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
3796 3918
@@ -3802,7 +3924,7 @@ namespace OpenSim.Region.Framework.Scenes
3802 { 3924 {
3803 m_sceneGraph.removeUserCount(false); 3925 m_sceneGraph.removeUserCount(false);
3804 } 3926 }
3805 else 3927 else if (!childOnly)
3806 { 3928 {
3807 m_sceneGraph.removeUserCount(true); 3929 m_sceneGraph.removeUserCount(true);
3808 } 3930 }
@@ -3818,9 +3940,12 @@ namespace OpenSim.Region.Framework.Scenes
3818 } 3940 }
3819 else 3941 else
3820 presence.ControllingClient.SendShutdownConnectionNotice(); 3942 presence.ControllingClient.SendShutdownConnectionNotice();
3943 presence.ControllingClient.Close(false);
3944 }
3945 else if (!childOnly)
3946 {
3947 presence.ControllingClient.Close(true);
3821 } 3948 }
3822
3823 presence.ControllingClient.Close();
3824 return true; 3949 return true;
3825 } 3950 }
3826 3951
@@ -4942,5 +5067,45 @@ namespace OpenSim.Region.Framework.Scenes
4942 throw new Exception(error); 5067 throw new Exception(error);
4943 } 5068 }
4944 } 5069 }
5070
5071 public void CleanDroppedAttachments()
5072 {
5073 List<SceneObjectGroup> objectsToDelete =
5074 new List<SceneObjectGroup>();
5075
5076 lock (m_cleaningAttachments)
5077 {
5078 ForEachSOG(delegate (SceneObjectGroup grp)
5079 {
5080 if (grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp)))
5081 {
5082 UUID agentID = grp.OwnerID;
5083 if (agentID == UUID.Zero)
5084 {
5085 objectsToDelete.Add(grp);
5086 return;
5087 }
5088
5089 ScenePresence sp = GetScenePresence(agentID);
5090 if (sp == null)
5091 {
5092 objectsToDelete.Add(grp);
5093 return;
5094 }
5095 }
5096 });
5097 }
5098
5099 if (objectsToDelete.Count > 0)
5100 {
5101 m_log.DebugFormat("[SCENE]: Starting delete of {0} dropped attachments", objectsToDelete.Count);
5102 foreach (SceneObjectGroup grp in objectsToDelete)
5103 {
5104 m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID);
5105 DeleteSceneObject(grp, true);
5106 }
5107 m_log.Debug("[SCENE]: Finished dropped attachment deletion");
5108 }
5109 }
4945 } 5110 }
4946} 5111}