diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 231 |
1 files changed, 199 insertions, 32 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 56ac2c2..400f4c0 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 | ||
@@ -1127,6 +1160,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1127 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1160 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1128 | if (HeartbeatThread != null) | 1161 | if (HeartbeatThread != null) |
1129 | { | 1162 | { |
1163 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1130 | HeartbeatThread.Abort(); | 1164 | HeartbeatThread.Abort(); |
1131 | HeartbeatThread = null; | 1165 | HeartbeatThread = null; |
1132 | } | 1166 | } |
@@ -1290,16 +1324,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1290 | // Check if any objects have reached their targets | 1324 | // Check if any objects have reached their targets |
1291 | CheckAtTargets(); | 1325 | CheckAtTargets(); |
1292 | 1326 | ||
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 | 1327 | // Run through all ScenePresences looking for updates |
1299 | // Presence updates and queued object updates for each presence are sent to clients | 1328 | // Presence updates and queued object updates for each presence are sent to clients |
1300 | if (m_frame % m_update_presences == 0) | 1329 | if (m_frame % m_update_presences == 0) |
1301 | m_sceneGraph.UpdatePresences(); | 1330 | m_sceneGraph.UpdatePresences(); |
1302 | 1331 | ||
1332 | // Update SceneObjectGroups that have scheduled themselves for updates | ||
1333 | // Objects queue their updates onto all scene presences | ||
1334 | if (m_frame % m_update_objects == 0) | ||
1335 | m_sceneGraph.UpdateObjectGroups(); | ||
1336 | |||
1303 | if (m_frame % m_update_coarse_locations == 0) | 1337 | if (m_frame % m_update_coarse_locations == 0) |
1304 | { | 1338 | { |
1305 | List<Vector3> coarseLocations; | 1339 | List<Vector3> coarseLocations; |
@@ -1628,6 +1662,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1628 | public void StoreWindlightProfile(RegionLightShareData wl) | 1662 | public void StoreWindlightProfile(RegionLightShareData wl) |
1629 | { | 1663 | { |
1630 | m_regInfo.WindlightSettings = wl; | 1664 | m_regInfo.WindlightSettings = wl; |
1665 | wl.Save(); | ||
1631 | m_storageManager.DataStore.StoreRegionWindlightSettings(wl); | 1666 | m_storageManager.DataStore.StoreRegionWindlightSettings(wl); |
1632 | m_eventManager.TriggerOnSaveNewWindlightProfile(); | 1667 | m_eventManager.TriggerOnSaveNewWindlightProfile(); |
1633 | } | 1668 | } |
@@ -1789,14 +1824,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1789 | /// <returns></returns> | 1824 | /// <returns></returns> |
1790 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 1825 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
1791 | { | 1826 | { |
1827 | |||
1828 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
1829 | Vector3 wpos = Vector3.Zero; | ||
1830 | // Check for water surface intersection from above | ||
1831 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
1832 | { | ||
1833 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
1834 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
1835 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
1836 | wpos.Z = wheight; | ||
1837 | } | ||
1838 | |||
1792 | Vector3 pos = Vector3.Zero; | 1839 | Vector3 pos = Vector3.Zero; |
1793 | if (RayEndIsIntersection == (byte)1) | 1840 | if (RayEndIsIntersection == (byte)1) |
1794 | { | 1841 | { |
1795 | pos = RayEnd; | 1842 | pos = RayEnd; |
1796 | return pos; | ||
1797 | } | 1843 | } |
1798 | 1844 | else if (RayTargetID != UUID.Zero) | |
1799 | if (RayTargetID != UUID.Zero) | ||
1800 | { | 1845 | { |
1801 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 1846 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
1802 | 1847 | ||
@@ -1818,7 +1863,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1818 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 1863 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
1819 | 1864 | ||
1820 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1865 | // 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()); | 1866 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
1822 | float ScaleOffset = 0.5f; | 1867 | float ScaleOffset = 0.5f; |
1823 | 1868 | ||
1824 | // If we hit something | 1869 | // If we hit something |
@@ -1841,13 +1886,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1841 | //pos.Z -= 0.25F; | 1886 | //pos.Z -= 0.25F; |
1842 | 1887 | ||
1843 | } | 1888 | } |
1844 | |||
1845 | return pos; | ||
1846 | } | 1889 | } |
1847 | else | 1890 | else |
1848 | { | 1891 | { |
1849 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 1892 | // 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); | 1893 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
1852 | 1894 | ||
1853 | // Un-comment the following line to print the raytrace results to the console. | 1895 | // Un-comment the following line to print the raytrace results to the console. |
@@ -1856,13 +1898,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1856 | if (ei.HitTF) | 1898 | if (ei.HitTF) |
1857 | { | 1899 | { |
1858 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 1900 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
1859 | } else | 1901 | } |
1902 | else | ||
1860 | { | 1903 | { |
1861 | // fall back to our stupid functionality | 1904 | // fall back to our stupid functionality |
1862 | pos = RayEnd; | 1905 | pos = RayEnd; |
1863 | } | 1906 | } |
1864 | |||
1865 | return pos; | ||
1866 | } | 1907 | } |
1867 | } | 1908 | } |
1868 | else | 1909 | else |
@@ -1873,8 +1914,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1873 | //increase height so its above the ground. | 1914 | //increase height so its above the ground. |
1874 | //should be getting the normal of the ground at the rez point and using that? | 1915 | //should be getting the normal of the ground at the rez point and using that? |
1875 | pos.Z += scale.Z / 2f; | 1916 | pos.Z += scale.Z / 2f; |
1876 | return pos; | 1917 | // return pos; |
1877 | } | 1918 | } |
1919 | |||
1920 | // check against posible water intercept | ||
1921 | if (wpos.Z > pos.Z) pos = wpos; | ||
1922 | return pos; | ||
1878 | } | 1923 | } |
1879 | 1924 | ||
1880 | 1925 | ||
@@ -2031,6 +2076,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2031 | /// </summary> | 2076 | /// </summary> |
2032 | public void DeleteAllSceneObjects() | 2077 | public void DeleteAllSceneObjects() |
2033 | { | 2078 | { |
2079 | DeleteAllSceneObjects(false); | ||
2080 | } | ||
2081 | |||
2082 | /// <summary> | ||
2083 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2084 | /// </summary> | ||
2085 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2086 | { | ||
2087 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2034 | lock (Entities) | 2088 | lock (Entities) |
2035 | { | 2089 | { |
2036 | ICollection<EntityBase> entities = new List<EntityBase>(Entities); | 2090 | ICollection<EntityBase> entities = new List<EntityBase>(Entities); |
@@ -2040,11 +2094,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2040 | if (e is SceneObjectGroup) | 2094 | if (e is SceneObjectGroup) |
2041 | { | 2095 | { |
2042 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2096 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2043 | if (!sog.IsAttachment) | 2097 | if (sog != null && !sog.IsAttachment) |
2044 | DeleteSceneObject((SceneObjectGroup)e, false); | 2098 | { |
2099 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2100 | { | ||
2101 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2102 | } | ||
2103 | else | ||
2104 | { | ||
2105 | toReturn.Add((SceneObjectGroup)e); | ||
2106 | } | ||
2107 | } | ||
2045 | } | 2108 | } |
2046 | } | 2109 | } |
2047 | } | 2110 | } |
2111 | if (toReturn.Count > 0) | ||
2112 | { | ||
2113 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2114 | } | ||
2048 | } | 2115 | } |
2049 | 2116 | ||
2050 | /// <summary> | 2117 | /// <summary> |
@@ -2417,6 +2484,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2417 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2484 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2418 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2485 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2419 | { | 2486 | { |
2487 | if (sceneObject.OwnerID == UUID.Zero) | ||
2488 | { | ||
2489 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2490 | return false; | ||
2491 | } | ||
2492 | |||
2420 | // If the user is banned, we won't let any of their objects | 2493 | // If the user is banned, we won't let any of their objects |
2421 | // enter. Period. | 2494 | // enter. Period. |
2422 | // | 2495 | // |
@@ -2466,15 +2539,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2466 | 2539 | ||
2467 | if (AttachmentsModule != null) | 2540 | if (AttachmentsModule != null) |
2468 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); | 2541 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); |
2542 | |||
2543 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was found, attaching", sceneObject.UUID); | ||
2469 | } | 2544 | } |
2470 | else | 2545 | else |
2471 | { | 2546 | { |
2547 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2472 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2548 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2473 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2549 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2474 | } | 2550 | } |
2551 | if (sceneObject.OwnerID == UUID.Zero) | ||
2552 | { | ||
2553 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2554 | return false; | ||
2555 | } | ||
2475 | } | 2556 | } |
2476 | else | 2557 | else |
2477 | { | 2558 | { |
2559 | if (sceneObject.OwnerID == UUID.Zero) | ||
2560 | { | ||
2561 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2562 | return false; | ||
2563 | } | ||
2478 | AddRestoredSceneObject(sceneObject, true, false); | 2564 | AddRestoredSceneObject(sceneObject, true, false); |
2479 | 2565 | ||
2480 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | 2566 | if (!Permissions.CanObjectEntry(sceneObject.UUID, |
@@ -2745,6 +2831,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2745 | client.OnFetchInventory += HandleFetchInventory; | 2831 | client.OnFetchInventory += HandleFetchInventory; |
2746 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 2832 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
2747 | client.OnCopyInventoryItem += CopyInventoryItem; | 2833 | client.OnCopyInventoryItem += CopyInventoryItem; |
2834 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
2748 | client.OnMoveInventoryItem += MoveInventoryItem; | 2835 | client.OnMoveInventoryItem += MoveInventoryItem; |
2749 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 2836 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
2750 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 2837 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -2923,15 +3010,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2923 | /// </summary> | 3010 | /// </summary> |
2924 | /// <param name="agentId">The avatar's Unique ID</param> | 3011 | /// <param name="agentId">The avatar's Unique ID</param> |
2925 | /// <param name="client">The IClientAPI for the client</param> | 3012 | /// <param name="client">The IClientAPI for the client</param> |
2926 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3013 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
2927 | { | 3014 | { |
2928 | if (m_teleportModule != null) | 3015 | if (m_teleportModule != null) |
2929 | m_teleportModule.TeleportHome(agentId, client); | 3016 | return m_teleportModule.TeleportHome(agentId, client); |
2930 | else | 3017 | else |
2931 | { | 3018 | { |
2932 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3019 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
2933 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3020 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
2934 | } | 3021 | } |
3022 | return false; | ||
2935 | } | 3023 | } |
2936 | 3024 | ||
2937 | /// <summary> | 3025 | /// <summary> |
@@ -3030,6 +3118,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3030 | /// <param name="flags"></param> | 3118 | /// <param name="flags"></param> |
3031 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3119 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3032 | { | 3120 | { |
3121 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3122 | ScenePresence presence; | ||
3123 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3124 | { | ||
3125 | if (presence.Appearance != null) | ||
3126 | { | ||
3127 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3128 | } | ||
3129 | } | ||
3130 | |||
3033 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3131 | 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. | 3132 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3035 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3133 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3124,7 +3222,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3124 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3222 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3125 | 3223 | ||
3126 | } | 3224 | } |
3225 | m_log.Debug("[Scene] Beginning ClientClosed"); | ||
3127 | m_eventManager.TriggerClientClosed(agentID, this); | 3226 | m_eventManager.TriggerClientClosed(agentID, this); |
3227 | m_log.Debug("[Scene] Finished ClientClosed"); | ||
3128 | } | 3228 | } |
3129 | catch (NullReferenceException) | 3229 | catch (NullReferenceException) |
3130 | { | 3230 | { |
@@ -3132,7 +3232,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3132 | // Avatar is already disposed :/ | 3232 | // Avatar is already disposed :/ |
3133 | } | 3233 | } |
3134 | 3234 | ||
3235 | m_log.Debug("[Scene] Beginning OnRemovePresence"); | ||
3135 | m_eventManager.TriggerOnRemovePresence(agentID); | 3236 | m_eventManager.TriggerOnRemovePresence(agentID); |
3237 | m_log.Debug("[Scene] Finished OnRemovePresence"); | ||
3238 | |||
3136 | ForEachClient( | 3239 | ForEachClient( |
3137 | delegate(IClientAPI client) | 3240 | delegate(IClientAPI client) |
3138 | { | 3241 | { |
@@ -3148,8 +3251,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3148 | } | 3251 | } |
3149 | 3252 | ||
3150 | // Remove the avatar from the scene | 3253 | // Remove the avatar from the scene |
3254 | m_log.Debug("[Scene] Begin RemoveScenePresence"); | ||
3151 | m_sceneGraph.RemoveScenePresence(agentID); | 3255 | m_sceneGraph.RemoveScenePresence(agentID); |
3256 | m_log.Debug("[Scene] Finished RemoveScenePresence. Removing the client manager"); | ||
3152 | m_clientManager.Remove(agentID); | 3257 | m_clientManager.Remove(agentID); |
3258 | m_log.Debug("[Scene] Removed the client manager. Firing avatar.close"); | ||
3153 | 3259 | ||
3154 | try | 3260 | try |
3155 | { | 3261 | { |
@@ -3163,8 +3269,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3163 | { | 3269 | { |
3164 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); | 3270 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); |
3165 | } | 3271 | } |
3166 | 3272 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); | |
3167 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3273 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3274 | CleanDroppedAttachments(); | ||
3275 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3168 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3276 | //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)); | 3277 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
3170 | } | 3278 | } |
@@ -3304,6 +3412,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3304 | { | 3412 | { |
3305 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3413 | if (land != null && !TestLandRestrictions(agent, land, out reason)) |
3306 | { | 3414 | { |
3415 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3307 | return false; | 3416 | return false; |
3308 | } | 3417 | } |
3309 | } | 3418 | } |
@@ -3361,6 +3470,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3361 | 3470 | ||
3362 | if (vialogin) | 3471 | if (vialogin) |
3363 | { | 3472 | { |
3473 | CleanDroppedAttachments(); | ||
3474 | |||
3364 | if (TestBorderCross(agent.startpos, Cardinals.E)) | 3475 | if (TestBorderCross(agent.startpos, Cardinals.E)) |
3365 | { | 3476 | { |
3366 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); | 3477 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); |
@@ -3417,6 +3528,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3417 | } | 3528 | } |
3418 | } | 3529 | } |
3419 | // Honor parcel landing type and position. | 3530 | // Honor parcel landing type and position. |
3531 | /* | ||
3532 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3420 | if (land != null) | 3533 | if (land != null) |
3421 | { | 3534 | { |
3422 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3535 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3424,6 +3537,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3424 | agent.startpos = land.LandData.UserLocation; | 3537 | agent.startpos = land.LandData.UserLocation; |
3425 | } | 3538 | } |
3426 | } | 3539 | } |
3540 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3427 | } | 3541 | } |
3428 | 3542 | ||
3429 | return true; | 3543 | return true; |
@@ -3774,12 +3888,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3774 | return false; | 3888 | return false; |
3775 | } | 3889 | } |
3776 | 3890 | ||
3891 | public bool IncomingCloseAgent(UUID agentID) | ||
3892 | { | ||
3893 | return IncomingCloseAgent(agentID, false); | ||
3894 | } | ||
3895 | |||
3896 | public bool IncomingCloseChildAgent(UUID agentID) | ||
3897 | { | ||
3898 | return IncomingCloseAgent(agentID, true); | ||
3899 | } | ||
3900 | |||
3777 | /// <summary> | 3901 | /// <summary> |
3778 | /// Tell a single agent to disconnect from the region. | 3902 | /// Tell a single agent to disconnect from the region. |
3779 | /// </summary> | 3903 | /// </summary> |
3780 | /// <param name="regionHandle"></param> | ||
3781 | /// <param name="agentID"></param> | 3904 | /// <param name="agentID"></param> |
3782 | public bool IncomingCloseAgent(UUID agentID) | 3905 | /// <param name="childOnly"></param> |
3906 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) | ||
3783 | { | 3907 | { |
3784 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 3908 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
3785 | 3909 | ||
@@ -3791,7 +3915,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3791 | { | 3915 | { |
3792 | m_sceneGraph.removeUserCount(false); | 3916 | m_sceneGraph.removeUserCount(false); |
3793 | } | 3917 | } |
3794 | else | 3918 | else if (!childOnly) |
3795 | { | 3919 | { |
3796 | m_sceneGraph.removeUserCount(true); | 3920 | m_sceneGraph.removeUserCount(true); |
3797 | } | 3921 | } |
@@ -3807,9 +3931,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3807 | } | 3931 | } |
3808 | else | 3932 | else |
3809 | presence.ControllingClient.SendShutdownConnectionNotice(); | 3933 | presence.ControllingClient.SendShutdownConnectionNotice(); |
3934 | presence.ControllingClient.Close(false); | ||
3935 | } | ||
3936 | else if (!childOnly) | ||
3937 | { | ||
3938 | presence.ControllingClient.Close(true); | ||
3810 | } | 3939 | } |
3811 | |||
3812 | presence.ControllingClient.Close(); | ||
3813 | return true; | 3940 | return true; |
3814 | } | 3941 | } |
3815 | 3942 | ||
@@ -4429,7 +4556,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4429 | // | 4556 | // |
4430 | int health=1; // Start at 1, means we're up | 4557 | int health=1; // Start at 1, means we're up |
4431 | 4558 | ||
4432 | if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) | 4559 | if (m_firstHeartbeat || ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)) |
4433 | health+=1; | 4560 | health+=1; |
4434 | else | 4561 | else |
4435 | return health; | 4562 | return health; |
@@ -4931,5 +5058,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
4931 | throw new Exception(error); | 5058 | throw new Exception(error); |
4932 | } | 5059 | } |
4933 | } | 5060 | } |
5061 | |||
5062 | public void CleanDroppedAttachments() | ||
5063 | { | ||
5064 | List<SceneObjectGroup> objectsToDelete = | ||
5065 | new List<SceneObjectGroup>(); | ||
5066 | |||
5067 | lock (m_cleaningAttachments) | ||
5068 | { | ||
5069 | ForEachSOG(delegate (SceneObjectGroup grp) | ||
5070 | { | ||
5071 | if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5072 | { | ||
5073 | UUID agentID = grp.OwnerID; | ||
5074 | if (agentID == UUID.Zero) | ||
5075 | { | ||
5076 | objectsToDelete.Add(grp); | ||
5077 | return; | ||
5078 | } | ||
5079 | |||
5080 | ScenePresence sp = GetScenePresence(agentID); | ||
5081 | if (sp == null) | ||
5082 | { | ||
5083 | objectsToDelete.Add(grp); | ||
5084 | return; | ||
5085 | } | ||
5086 | } | ||
5087 | }); | ||
5088 | } | ||
5089 | |||
5090 | if (objectsToDelete.Count > 0) | ||
5091 | { | ||
5092 | m_log.DebugFormat("[SCENE]: Starting delete of {0} dropped attachments", objectsToDelete.Count); | ||
5093 | foreach (SceneObjectGroup grp in objectsToDelete) | ||
5094 | { | ||
5095 | m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5096 | DeleteSceneObject(grp, true); | ||
5097 | } | ||
5098 | m_log.Debug("[SCENE]: Finished dropped attachment deletion"); | ||
5099 | } | ||
5100 | } | ||
4934 | } | 5101 | } |
4935 | } | 5102 | } |