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 82e7d76..6b71426 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; |
@@ -1632,6 +1666,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1632 | public void StoreWindlightProfile(RegionLightShareData wl) | 1666 | public void StoreWindlightProfile(RegionLightShareData wl) |
1633 | { | 1667 | { |
1634 | m_regInfo.WindlightSettings = wl; | 1668 | m_regInfo.WindlightSettings = wl; |
1669 | wl.Save(); | ||
1635 | m_storageManager.DataStore.StoreRegionWindlightSettings(wl); | 1670 | m_storageManager.DataStore.StoreRegionWindlightSettings(wl); |
1636 | m_eventManager.TriggerOnSaveNewWindlightProfile(); | 1671 | m_eventManager.TriggerOnSaveNewWindlightProfile(); |
1637 | } | 1672 | } |
@@ -1793,14 +1828,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1793 | /// <returns></returns> | 1828 | /// <returns></returns> |
1794 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 1829 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
1795 | { | 1830 | { |
1831 | |||
1832 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
1833 | Vector3 wpos = Vector3.Zero; | ||
1834 | // Check for water surface intersection from above | ||
1835 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
1836 | { | ||
1837 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
1838 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
1839 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
1840 | wpos.Z = wheight; | ||
1841 | } | ||
1842 | |||
1796 | Vector3 pos = Vector3.Zero; | 1843 | Vector3 pos = Vector3.Zero; |
1797 | if (RayEndIsIntersection == (byte)1) | 1844 | if (RayEndIsIntersection == (byte)1) |
1798 | { | 1845 | { |
1799 | pos = RayEnd; | 1846 | pos = RayEnd; |
1800 | return pos; | ||
1801 | } | 1847 | } |
1802 | 1848 | else if (RayTargetID != UUID.Zero) | |
1803 | if (RayTargetID != UUID.Zero) | ||
1804 | { | 1849 | { |
1805 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 1850 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
1806 | 1851 | ||
@@ -1822,7 +1867,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1822 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 1867 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
1823 | 1868 | ||
1824 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1869 | // Un-comment out the following line to Get Raytrace results printed to the console. |
1825 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 1870 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
1826 | float ScaleOffset = 0.5f; | 1871 | float ScaleOffset = 0.5f; |
1827 | 1872 | ||
1828 | // If we hit something | 1873 | // If we hit something |
@@ -1845,13 +1890,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1845 | //pos.Z -= 0.25F; | 1890 | //pos.Z -= 0.25F; |
1846 | 1891 | ||
1847 | } | 1892 | } |
1848 | |||
1849 | return pos; | ||
1850 | } | 1893 | } |
1851 | else | 1894 | else |
1852 | { | 1895 | { |
1853 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 1896 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
1854 | |||
1855 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 1897 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
1856 | 1898 | ||
1857 | // Un-comment the following line to print the raytrace results to the console. | 1899 | // Un-comment the following line to print the raytrace results to the console. |
@@ -1860,13 +1902,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1860 | if (ei.HitTF) | 1902 | if (ei.HitTF) |
1861 | { | 1903 | { |
1862 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 1904 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
1863 | } else | 1905 | } |
1906 | else | ||
1864 | { | 1907 | { |
1865 | // fall back to our stupid functionality | 1908 | // fall back to our stupid functionality |
1866 | pos = RayEnd; | 1909 | pos = RayEnd; |
1867 | } | 1910 | } |
1868 | |||
1869 | return pos; | ||
1870 | } | 1911 | } |
1871 | } | 1912 | } |
1872 | else | 1913 | else |
@@ -1877,8 +1918,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1877 | //increase height so its above the ground. | 1918 | //increase height so its above the ground. |
1878 | //should be getting the normal of the ground at the rez point and using that? | 1919 | //should be getting the normal of the ground at the rez point and using that? |
1879 | pos.Z += scale.Z / 2f; | 1920 | pos.Z += scale.Z / 2f; |
1880 | return pos; | 1921 | // return pos; |
1881 | } | 1922 | } |
1923 | |||
1924 | // check against posible water intercept | ||
1925 | if (wpos.Z > pos.Z) pos = wpos; | ||
1926 | return pos; | ||
1882 | } | 1927 | } |
1883 | 1928 | ||
1884 | 1929 | ||
@@ -2035,6 +2080,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2035 | /// </summary> | 2080 | /// </summary> |
2036 | public void DeleteAllSceneObjects() | 2081 | public void DeleteAllSceneObjects() |
2037 | { | 2082 | { |
2083 | DeleteAllSceneObjects(false); | ||
2084 | } | ||
2085 | |||
2086 | /// <summary> | ||
2087 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2088 | /// </summary> | ||
2089 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2090 | { | ||
2091 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2038 | lock (Entities) | 2092 | lock (Entities) |
2039 | { | 2093 | { |
2040 | ICollection<EntityBase> entities = new List<EntityBase>(Entities); | 2094 | ICollection<EntityBase> entities = new List<EntityBase>(Entities); |
@@ -2044,11 +2098,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2044 | if (e is SceneObjectGroup) | 2098 | if (e is SceneObjectGroup) |
2045 | { | 2099 | { |
2046 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2100 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2047 | if (!sog.IsAttachment) | 2101 | if (sog != null && !sog.IsAttachment) |
2048 | DeleteSceneObject((SceneObjectGroup)e, false); | 2102 | { |
2103 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2104 | { | ||
2105 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2106 | } | ||
2107 | else | ||
2108 | { | ||
2109 | toReturn.Add((SceneObjectGroup)e); | ||
2110 | } | ||
2111 | } | ||
2049 | } | 2112 | } |
2050 | } | 2113 | } |
2051 | } | 2114 | } |
2115 | if (toReturn.Count > 0) | ||
2116 | { | ||
2117 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2118 | } | ||
2052 | } | 2119 | } |
2053 | 2120 | ||
2054 | /// <summary> | 2121 | /// <summary> |
@@ -2428,6 +2495,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2428 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2495 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2429 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2496 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2430 | { | 2497 | { |
2498 | if (sceneObject.OwnerID == UUID.Zero) | ||
2499 | { | ||
2500 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2501 | return false; | ||
2502 | } | ||
2503 | |||
2431 | // If the user is banned, we won't let any of their objects | 2504 | // If the user is banned, we won't let any of their objects |
2432 | // enter. Period. | 2505 | // enter. Period. |
2433 | // | 2506 | // |
@@ -2477,15 +2550,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2477 | 2550 | ||
2478 | if (AttachmentsModule != null) | 2551 | if (AttachmentsModule != null) |
2479 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); | 2552 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); |
2553 | |||
2554 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was found, attaching", sceneObject.UUID); | ||
2480 | } | 2555 | } |
2481 | else | 2556 | else |
2482 | { | 2557 | { |
2558 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2483 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2559 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2484 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2560 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2485 | } | 2561 | } |
2562 | if (sceneObject.OwnerID == UUID.Zero) | ||
2563 | { | ||
2564 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2565 | return false; | ||
2566 | } | ||
2486 | } | 2567 | } |
2487 | else | 2568 | else |
2488 | { | 2569 | { |
2570 | if (sceneObject.OwnerID == UUID.Zero) | ||
2571 | { | ||
2572 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2573 | return false; | ||
2574 | } | ||
2489 | AddRestoredSceneObject(sceneObject, true, false); | 2575 | AddRestoredSceneObject(sceneObject, true, false); |
2490 | 2576 | ||
2491 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | 2577 | if (!Permissions.CanObjectEntry(sceneObject.UUID, |
@@ -2758,6 +2844,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2758 | client.OnFetchInventory += HandleFetchInventory; | 2844 | client.OnFetchInventory += HandleFetchInventory; |
2759 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 2845 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
2760 | client.OnCopyInventoryItem += CopyInventoryItem; | 2846 | client.OnCopyInventoryItem += CopyInventoryItem; |
2847 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
2761 | client.OnMoveInventoryItem += MoveInventoryItem; | 2848 | client.OnMoveInventoryItem += MoveInventoryItem; |
2762 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 2849 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
2763 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 2850 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -2936,15 +3023,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2936 | /// </summary> | 3023 | /// </summary> |
2937 | /// <param name="agentId">The avatar's Unique ID</param> | 3024 | /// <param name="agentId">The avatar's Unique ID</param> |
2938 | /// <param name="client">The IClientAPI for the client</param> | 3025 | /// <param name="client">The IClientAPI for the client</param> |
2939 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3026 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
2940 | { | 3027 | { |
2941 | if (m_teleportModule != null) | 3028 | if (m_teleportModule != null) |
2942 | m_teleportModule.TeleportHome(agentId, client); | 3029 | return m_teleportModule.TeleportHome(agentId, client); |
2943 | else | 3030 | else |
2944 | { | 3031 | { |
2945 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3032 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
2946 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3033 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
2947 | } | 3034 | } |
3035 | return false; | ||
2948 | } | 3036 | } |
2949 | 3037 | ||
2950 | /// <summary> | 3038 | /// <summary> |
@@ -3043,6 +3131,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3043 | /// <param name="flags"></param> | 3131 | /// <param name="flags"></param> |
3044 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3132 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3045 | { | 3133 | { |
3134 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3135 | ScenePresence presence; | ||
3136 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3137 | { | ||
3138 | if (presence.Appearance != null) | ||
3139 | { | ||
3140 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3141 | } | ||
3142 | } | ||
3143 | |||
3046 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3144 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3047 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3145 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3048 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3146 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3137,7 +3235,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3137 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3235 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3138 | 3236 | ||
3139 | } | 3237 | } |
3238 | m_log.Debug("[Scene] Beginning ClientClosed"); | ||
3140 | m_eventManager.TriggerClientClosed(agentID, this); | 3239 | m_eventManager.TriggerClientClosed(agentID, this); |
3240 | m_log.Debug("[Scene] Finished ClientClosed"); | ||
3141 | } | 3241 | } |
3142 | catch (NullReferenceException) | 3242 | catch (NullReferenceException) |
3143 | { | 3243 | { |
@@ -3145,7 +3245,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3145 | // Avatar is already disposed :/ | 3245 | // Avatar is already disposed :/ |
3146 | } | 3246 | } |
3147 | 3247 | ||
3248 | m_log.Debug("[Scene] Beginning OnRemovePresence"); | ||
3148 | m_eventManager.TriggerOnRemovePresence(agentID); | 3249 | m_eventManager.TriggerOnRemovePresence(agentID); |
3250 | m_log.Debug("[Scene] Finished OnRemovePresence"); | ||
3251 | |||
3149 | ForEachClient( | 3252 | ForEachClient( |
3150 | delegate(IClientAPI client) | 3253 | delegate(IClientAPI client) |
3151 | { | 3254 | { |
@@ -3161,8 +3264,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3161 | } | 3264 | } |
3162 | 3265 | ||
3163 | // Remove the avatar from the scene | 3266 | // Remove the avatar from the scene |
3267 | m_log.Debug("[Scene] Begin RemoveScenePresence"); | ||
3164 | m_sceneGraph.RemoveScenePresence(agentID); | 3268 | m_sceneGraph.RemoveScenePresence(agentID); |
3269 | m_log.Debug("[Scene] Finished RemoveScenePresence. Removing the client manager"); | ||
3165 | m_clientManager.Remove(agentID); | 3270 | m_clientManager.Remove(agentID); |
3271 | m_log.Debug("[Scene] Removed the client manager. Firing avatar.close"); | ||
3166 | 3272 | ||
3167 | try | 3273 | try |
3168 | { | 3274 | { |
@@ -3176,8 +3282,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3176 | { | 3282 | { |
3177 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); | 3283 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); |
3178 | } | 3284 | } |
3179 | 3285 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); | |
3180 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3286 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3287 | CleanDroppedAttachments(); | ||
3288 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3181 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3289 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
3182 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 3290 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
3183 | } | 3291 | } |
@@ -3317,6 +3425,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3317 | { | 3425 | { |
3318 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3426 | if (land != null && !TestLandRestrictions(agent, land, out reason)) |
3319 | { | 3427 | { |
3428 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3320 | return false; | 3429 | return false; |
3321 | } | 3430 | } |
3322 | } | 3431 | } |
@@ -3374,6 +3483,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3374 | 3483 | ||
3375 | if (vialogin) | 3484 | if (vialogin) |
3376 | { | 3485 | { |
3486 | CleanDroppedAttachments(); | ||
3487 | |||
3377 | if (TestBorderCross(agent.startpos, Cardinals.E)) | 3488 | if (TestBorderCross(agent.startpos, Cardinals.E)) |
3378 | { | 3489 | { |
3379 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); | 3490 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); |
@@ -3430,6 +3541,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3430 | } | 3541 | } |
3431 | } | 3542 | } |
3432 | // Honor parcel landing type and position. | 3543 | // Honor parcel landing type and position. |
3544 | /* | ||
3545 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3433 | if (land != null) | 3546 | if (land != null) |
3434 | { | 3547 | { |
3435 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3548 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3437,6 +3550,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3437 | agent.startpos = land.LandData.UserLocation; | 3550 | agent.startpos = land.LandData.UserLocation; |
3438 | } | 3551 | } |
3439 | } | 3552 | } |
3553 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3440 | } | 3554 | } |
3441 | 3555 | ||
3442 | return true; | 3556 | return true; |
@@ -3787,12 +3901,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3787 | return false; | 3901 | return false; |
3788 | } | 3902 | } |
3789 | 3903 | ||
3904 | public bool IncomingCloseAgent(UUID agentID) | ||
3905 | { | ||
3906 | return IncomingCloseAgent(agentID, false); | ||
3907 | } | ||
3908 | |||
3909 | public bool IncomingCloseChildAgent(UUID agentID) | ||
3910 | { | ||
3911 | return IncomingCloseAgent(agentID, true); | ||
3912 | } | ||
3913 | |||
3790 | /// <summary> | 3914 | /// <summary> |
3791 | /// Tell a single agent to disconnect from the region. | 3915 | /// Tell a single agent to disconnect from the region. |
3792 | /// </summary> | 3916 | /// </summary> |
3793 | /// <param name="regionHandle"></param> | ||
3794 | /// <param name="agentID"></param> | 3917 | /// <param name="agentID"></param> |
3795 | public bool IncomingCloseAgent(UUID agentID) | 3918 | /// <param name="childOnly"></param> |
3919 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) | ||
3796 | { | 3920 | { |
3797 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 3921 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
3798 | 3922 | ||
@@ -3804,7 +3928,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3804 | { | 3928 | { |
3805 | m_sceneGraph.removeUserCount(false); | 3929 | m_sceneGraph.removeUserCount(false); |
3806 | } | 3930 | } |
3807 | else | 3931 | else if (!childOnly) |
3808 | { | 3932 | { |
3809 | m_sceneGraph.removeUserCount(true); | 3933 | m_sceneGraph.removeUserCount(true); |
3810 | } | 3934 | } |
@@ -3820,9 +3944,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3820 | } | 3944 | } |
3821 | else | 3945 | else |
3822 | presence.ControllingClient.SendShutdownConnectionNotice(); | 3946 | presence.ControllingClient.SendShutdownConnectionNotice(); |
3947 | presence.ControllingClient.Close(false); | ||
3948 | } | ||
3949 | else if (!childOnly) | ||
3950 | { | ||
3951 | presence.ControllingClient.Close(true); | ||
3823 | } | 3952 | } |
3824 | |||
3825 | presence.ControllingClient.Close(); | ||
3826 | return true; | 3953 | return true; |
3827 | } | 3954 | } |
3828 | 3955 | ||
@@ -4442,7 +4569,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4442 | // | 4569 | // |
4443 | int health=1; // Start at 1, means we're up | 4570 | int health=1; // Start at 1, means we're up |
4444 | 4571 | ||
4445 | if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) | 4572 | if (m_firstHeartbeat || ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)) |
4446 | health+=1; | 4573 | health+=1; |
4447 | else | 4574 | else |
4448 | return health; | 4575 | return health; |
@@ -4944,5 +5071,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
4944 | throw new Exception(error); | 5071 | throw new Exception(error); |
4945 | } | 5072 | } |
4946 | } | 5073 | } |
5074 | |||
5075 | public void CleanDroppedAttachments() | ||
5076 | { | ||
5077 | List<SceneObjectGroup> objectsToDelete = | ||
5078 | new List<SceneObjectGroup>(); | ||
5079 | |||
5080 | lock (m_cleaningAttachments) | ||
5081 | { | ||
5082 | ForEachSOG(delegate (SceneObjectGroup grp) | ||
5083 | { | ||
5084 | if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5085 | { | ||
5086 | UUID agentID = grp.OwnerID; | ||
5087 | if (agentID == UUID.Zero) | ||
5088 | { | ||
5089 | objectsToDelete.Add(grp); | ||
5090 | return; | ||
5091 | } | ||
5092 | |||
5093 | ScenePresence sp = GetScenePresence(agentID); | ||
5094 | if (sp == null) | ||
5095 | { | ||
5096 | objectsToDelete.Add(grp); | ||
5097 | return; | ||
5098 | } | ||
5099 | } | ||
5100 | }); | ||
5101 | } | ||
5102 | |||
5103 | if (objectsToDelete.Count > 0) | ||
5104 | { | ||
5105 | m_log.DebugFormat("[SCENE]: Starting delete of {0} dropped attachments", objectsToDelete.Count); | ||
5106 | foreach (SceneObjectGroup grp in objectsToDelete) | ||
5107 | { | ||
5108 | m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5109 | DeleteSceneObject(grp, true); | ||
5110 | } | ||
5111 | m_log.Debug("[SCENE]: Finished dropped attachment deletion"); | ||
5112 | } | ||
5113 | } | ||
4947 | } | 5114 | } |
4948 | } | 5115 | } |