diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 268 |
1 files changed, 230 insertions, 38 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3dd0f3a..5428e5d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -102,6 +102,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
102 | protected ModuleLoader m_moduleLoader; | 102 | protected ModuleLoader m_moduleLoader; |
103 | protected AgentCircuitManager m_authenticateHandler; | 103 | protected AgentCircuitManager m_authenticateHandler; |
104 | protected SceneCommunicationService m_sceneGridService; | 104 | protected SceneCommunicationService m_sceneGridService; |
105 | protected ISnmpModule m_snmpService = null; | ||
105 | 106 | ||
106 | protected ISimulationDataService m_SimulationDataService; | 107 | protected ISimulationDataService m_SimulationDataService; |
107 | protected IEstateDataService m_EstateDataService; | 108 | protected IEstateDataService m_EstateDataService; |
@@ -163,6 +164,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
163 | private int landMS; | 164 | private int landMS; |
164 | private int lastCompletedFrame; | 165 | private int lastCompletedFrame; |
165 | 166 | ||
167 | public bool CombineRegions = false; | ||
166 | private bool m_physics_enabled = true; | 168 | private bool m_physics_enabled = true; |
167 | private bool m_scripts_enabled = true; | 169 | private bool m_scripts_enabled = true; |
168 | private string m_defaultScriptEngine; | 170 | private string m_defaultScriptEngine; |
@@ -174,6 +176,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
174 | private bool m_firstHeartbeat = true; | 176 | private bool m_firstHeartbeat = true; |
175 | 177 | ||
176 | private object m_deleting_scene_object = new object(); | 178 | private object m_deleting_scene_object = new object(); |
179 | private object m_cleaningAttachments = new object(); | ||
177 | 180 | ||
178 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 181 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
179 | private bool m_reprioritizationEnabled = true; | 182 | private bool m_reprioritizationEnabled = true; |
@@ -217,6 +220,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
217 | get { return m_sceneGridService; } | 220 | get { return m_sceneGridService; } |
218 | } | 221 | } |
219 | 222 | ||
223 | public ISnmpModule SnmpService | ||
224 | { | ||
225 | get | ||
226 | { | ||
227 | if (m_snmpService == null) | ||
228 | { | ||
229 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
230 | } | ||
231 | |||
232 | return m_snmpService; | ||
233 | } | ||
234 | } | ||
235 | |||
220 | public ISimulationDataService SimulationDataService | 236 | public ISimulationDataService SimulationDataService |
221 | { | 237 | { |
222 | get | 238 | get |
@@ -561,6 +577,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
561 | #region Region Settings | 577 | #region Region Settings |
562 | 578 | ||
563 | // Load region settings | 579 | // Load region settings |
580 | m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID); | ||
581 | |||
564 | m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); | 582 | m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); |
565 | if (estateDataService != null) | 583 | if (estateDataService != null) |
566 | m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); | 584 | m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); |
@@ -620,9 +638,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
620 | //Animation states | 638 | //Animation states |
621 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 639 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
622 | // TODO: Change default to true once the feature is supported | 640 | // TODO: Change default to true once the feature is supported |
623 | m_usePreJump = startupConfig.GetBoolean("enableprejump", false); | 641 | m_usePreJump = startupConfig.GetBoolean("enableprejump", true); |
624 | |||
625 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 642 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
643 | |||
644 | m_log.DebugFormat("[SCENE]: prejump is {0}", m_usePreJump ? "ON" : "OFF"); | ||
626 | if (RegionInfo.NonphysPrimMax > 0) | 645 | if (RegionInfo.NonphysPrimMax > 0) |
627 | { | 646 | { |
628 | m_maxNonphys = RegionInfo.NonphysPrimMax; | 647 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
@@ -654,6 +673,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
654 | m_persistAfter *= 10000000; | 673 | m_persistAfter *= 10000000; |
655 | 674 | ||
656 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 675 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
676 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
657 | 677 | ||
658 | IConfig packetConfig = m_config.Configs["PacketPool"]; | 678 | IConfig packetConfig = m_config.Configs["PacketPool"]; |
659 | if (packetConfig != null) | 679 | if (packetConfig != null) |
@@ -663,6 +683,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
663 | } | 683 | } |
664 | 684 | ||
665 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 685 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
686 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
666 | 687 | ||
667 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 688 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); |
668 | if (m_generateMaptiles) | 689 | if (m_generateMaptiles) |
@@ -687,9 +708,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
687 | } | 708 | } |
688 | } | 709 | } |
689 | } | 710 | } |
690 | catch | 711 | catch (Exception e) |
691 | { | 712 | { |
692 | m_log.Warn("[SCENE]: Failed to load StartupConfig"); | 713 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); |
693 | } | 714 | } |
694 | 715 | ||
695 | #endregion Region Config | 716 | #endregion Region Config |
@@ -926,6 +947,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
926 | /// <param name="seconds">float indicating duration before restart.</param> | 947 | /// <param name="seconds">float indicating duration before restart.</param> |
927 | public virtual void Restart(float seconds) | 948 | public virtual void Restart(float seconds) |
928 | { | 949 | { |
950 | Restart(seconds, true); | ||
951 | } | ||
952 | |||
953 | /// <summary> | ||
954 | /// Given float seconds, this will restart the region. showDialog will optionally alert the users. | ||
955 | /// </summary> | ||
956 | /// <param name="seconds">float indicating duration before restart.</param> | ||
957 | public virtual void Restart(float seconds, bool showDialog) | ||
958 | { | ||
929 | // notifications are done in 15 second increments | 959 | // notifications are done in 15 second increments |
930 | // so .. if the number of seconds is less then 15 seconds, it's not really a restart request | 960 | // so .. if the number of seconds is less then 15 seconds, it's not really a restart request |
931 | // It's a 'Cancel restart' request. | 961 | // It's a 'Cancel restart' request. |
@@ -946,8 +976,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
946 | m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); | 976 | m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); |
947 | m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); | 977 | m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); |
948 | m_restartTimer.Start(); | 978 | m_restartTimer.Start(); |
949 | m_dialogModule.SendNotificationToUsersInRegion( | 979 | if (showDialog) |
980 | { | ||
981 | m_dialogModule.SendNotificationToUsersInRegion( | ||
950 | UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0))); | 982 | UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0))); |
983 | } | ||
951 | } | 984 | } |
952 | } | 985 | } |
953 | 986 | ||
@@ -1143,6 +1176,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1143 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1176 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1144 | if (HeartbeatThread != null) | 1177 | if (HeartbeatThread != null) |
1145 | { | 1178 | { |
1179 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1146 | HeartbeatThread.Abort(); | 1180 | HeartbeatThread.Abort(); |
1147 | HeartbeatThread = null; | 1181 | HeartbeatThread = null; |
1148 | } | 1182 | } |
@@ -1814,14 +1848,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1814 | /// <returns></returns> | 1848 | /// <returns></returns> |
1815 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 1849 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
1816 | { | 1850 | { |
1851 | |||
1852 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
1853 | Vector3 wpos = Vector3.Zero; | ||
1854 | // Check for water surface intersection from above | ||
1855 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
1856 | { | ||
1857 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
1858 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
1859 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
1860 | wpos.Z = wheight; | ||
1861 | } | ||
1862 | |||
1817 | Vector3 pos = Vector3.Zero; | 1863 | Vector3 pos = Vector3.Zero; |
1818 | if (RayEndIsIntersection == (byte)1) | 1864 | if (RayEndIsIntersection == (byte)1) |
1819 | { | 1865 | { |
1820 | pos = RayEnd; | 1866 | pos = RayEnd; |
1821 | return pos; | ||
1822 | } | 1867 | } |
1823 | 1868 | else if (RayTargetID != UUID.Zero) | |
1824 | if (RayTargetID != UUID.Zero) | ||
1825 | { | 1869 | { |
1826 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 1870 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
1827 | 1871 | ||
@@ -1843,7 +1887,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1843 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 1887 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
1844 | 1888 | ||
1845 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1889 | // Un-comment out the following line to Get Raytrace results printed to the console. |
1846 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 1890 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
1847 | float ScaleOffset = 0.5f; | 1891 | float ScaleOffset = 0.5f; |
1848 | 1892 | ||
1849 | // If we hit something | 1893 | // If we hit something |
@@ -1866,13 +1910,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1866 | //pos.Z -= 0.25F; | 1910 | //pos.Z -= 0.25F; |
1867 | 1911 | ||
1868 | } | 1912 | } |
1869 | |||
1870 | return pos; | ||
1871 | } | 1913 | } |
1872 | else | 1914 | else |
1873 | { | 1915 | { |
1874 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 1916 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
1875 | |||
1876 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 1917 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
1877 | 1918 | ||
1878 | // Un-comment the following line to print the raytrace results to the console. | 1919 | // Un-comment the following line to print the raytrace results to the console. |
@@ -1881,13 +1922,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1881 | if (ei.HitTF) | 1922 | if (ei.HitTF) |
1882 | { | 1923 | { |
1883 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 1924 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
1884 | } else | 1925 | } |
1926 | else | ||
1885 | { | 1927 | { |
1886 | // fall back to our stupid functionality | 1928 | // fall back to our stupid functionality |
1887 | pos = RayEnd; | 1929 | pos = RayEnd; |
1888 | } | 1930 | } |
1889 | |||
1890 | return pos; | ||
1891 | } | 1931 | } |
1892 | } | 1932 | } |
1893 | else | 1933 | else |
@@ -1898,8 +1938,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1898 | //increase height so its above the ground. | 1938 | //increase height so its above the ground. |
1899 | //should be getting the normal of the ground at the rez point and using that? | 1939 | //should be getting the normal of the ground at the rez point and using that? |
1900 | pos.Z += scale.Z / 2f; | 1940 | pos.Z += scale.Z / 2f; |
1901 | return pos; | 1941 | // return pos; |
1902 | } | 1942 | } |
1943 | |||
1944 | // check against posible water intercept | ||
1945 | if (wpos.Z > pos.Z) pos = wpos; | ||
1946 | return pos; | ||
1903 | } | 1947 | } |
1904 | 1948 | ||
1905 | 1949 | ||
@@ -1979,7 +2023,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1979 | public bool AddRestoredSceneObject( | 2023 | public bool AddRestoredSceneObject( |
1980 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 2024 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
1981 | { | 2025 | { |
1982 | return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); | 2026 | bool result = m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); |
2027 | if (result) | ||
2028 | sceneObject.IsDeleted = false; | ||
2029 | return result; | ||
1983 | } | 2030 | } |
1984 | 2031 | ||
1985 | /// <summary> | 2032 | /// <summary> |
@@ -2056,6 +2103,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2056 | /// </summary> | 2103 | /// </summary> |
2057 | public void DeleteAllSceneObjects() | 2104 | public void DeleteAllSceneObjects() |
2058 | { | 2105 | { |
2106 | DeleteAllSceneObjects(false); | ||
2107 | } | ||
2108 | |||
2109 | /// <summary> | ||
2110 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2111 | /// </summary> | ||
2112 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2113 | { | ||
2114 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2059 | lock (Entities) | 2115 | lock (Entities) |
2060 | { | 2116 | { |
2061 | EntityBase[] entities = Entities.GetEntities(); | 2117 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2064,11 +2120,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2064 | if (e is SceneObjectGroup) | 2120 | if (e is SceneObjectGroup) |
2065 | { | 2121 | { |
2066 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2122 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2067 | if (!sog.IsAttachment) | 2123 | if (sog != null && !sog.IsAttachment) |
2068 | DeleteSceneObject((SceneObjectGroup)e, false); | 2124 | { |
2125 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2126 | { | ||
2127 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2128 | } | ||
2129 | else | ||
2130 | { | ||
2131 | toReturn.Add((SceneObjectGroup)e); | ||
2132 | } | ||
2133 | } | ||
2069 | } | 2134 | } |
2070 | } | 2135 | } |
2071 | } | 2136 | } |
2137 | if (toReturn.Count > 0) | ||
2138 | { | ||
2139 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2140 | } | ||
2072 | } | 2141 | } |
2073 | 2142 | ||
2074 | /// <summary> | 2143 | /// <summary> |
@@ -2117,6 +2186,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2117 | } | 2186 | } |
2118 | 2187 | ||
2119 | group.DeleteGroupFromScene(silent); | 2188 | group.DeleteGroupFromScene(silent); |
2189 | if (!silent) | ||
2190 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2120 | 2191 | ||
2121 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2192 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2122 | } | 2193 | } |
@@ -2446,6 +2517,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2446 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2517 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2447 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2518 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2448 | { | 2519 | { |
2520 | if (sceneObject.OwnerID == UUID.Zero) | ||
2521 | { | ||
2522 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2523 | return false; | ||
2524 | } | ||
2525 | |||
2449 | // If the user is banned, we won't let any of their objects | 2526 | // If the user is banned, we won't let any of their objects |
2450 | // enter. Period. | 2527 | // enter. Period. |
2451 | // | 2528 | // |
@@ -2493,15 +2570,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2493 | 2570 | ||
2494 | if (AttachmentsModule != null) | 2571 | if (AttachmentsModule != null) |
2495 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); | 2572 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); |
2573 | |||
2574 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was found, attaching", sceneObject.UUID); | ||
2496 | } | 2575 | } |
2497 | else | 2576 | else |
2498 | { | 2577 | { |
2578 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2499 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2579 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2500 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2580 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2501 | } | 2581 | } |
2582 | if (sceneObject.OwnerID == UUID.Zero) | ||
2583 | { | ||
2584 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2585 | return false; | ||
2586 | } | ||
2502 | } | 2587 | } |
2503 | else | 2588 | else |
2504 | { | 2589 | { |
2590 | if (sceneObject.OwnerID == UUID.Zero) | ||
2591 | { | ||
2592 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2593 | return false; | ||
2594 | } | ||
2505 | AddRestoredSceneObject(sceneObject, true, false); | 2595 | AddRestoredSceneObject(sceneObject, true, false); |
2506 | 2596 | ||
2507 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | 2597 | if (!Permissions.CanObjectEntry(sceneObject.UUID, |
@@ -2774,6 +2864,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2774 | client.OnFetchInventory += HandleFetchInventory; | 2864 | client.OnFetchInventory += HandleFetchInventory; |
2775 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 2865 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
2776 | client.OnCopyInventoryItem += CopyInventoryItem; | 2866 | client.OnCopyInventoryItem += CopyInventoryItem; |
2867 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
2777 | client.OnMoveInventoryItem += MoveInventoryItem; | 2868 | client.OnMoveInventoryItem += MoveInventoryItem; |
2778 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 2869 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
2779 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 2870 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -2952,15 +3043,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2952 | /// </summary> | 3043 | /// </summary> |
2953 | /// <param name="agentId">The avatar's Unique ID</param> | 3044 | /// <param name="agentId">The avatar's Unique ID</param> |
2954 | /// <param name="client">The IClientAPI for the client</param> | 3045 | /// <param name="client">The IClientAPI for the client</param> |
2955 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3046 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
2956 | { | 3047 | { |
2957 | if (m_teleportModule != null) | 3048 | if (m_teleportModule != null) |
2958 | m_teleportModule.TeleportHome(agentId, client); | 3049 | return m_teleportModule.TeleportHome(agentId, client); |
2959 | else | 3050 | else |
2960 | { | 3051 | { |
2961 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3052 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
2962 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3053 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
2963 | } | 3054 | } |
3055 | return false; | ||
2964 | } | 3056 | } |
2965 | 3057 | ||
2966 | /// <summary> | 3058 | /// <summary> |
@@ -3059,6 +3151,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3059 | /// <param name="flags"></param> | 3151 | /// <param name="flags"></param> |
3060 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3152 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3061 | { | 3153 | { |
3154 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3155 | ScenePresence presence; | ||
3156 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3157 | { | ||
3158 | if (presence.Appearance != null) | ||
3159 | { | ||
3160 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3161 | } | ||
3162 | } | ||
3163 | |||
3062 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3164 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3063 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3165 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3064 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3166 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3153,7 +3255,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3153 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3255 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3154 | 3256 | ||
3155 | } | 3257 | } |
3258 | m_log.Debug("[Scene] Beginning ClientClosed"); | ||
3156 | m_eventManager.TriggerClientClosed(agentID, this); | 3259 | m_eventManager.TriggerClientClosed(agentID, this); |
3260 | m_log.Debug("[Scene] Finished ClientClosed"); | ||
3157 | } | 3261 | } |
3158 | catch (NullReferenceException) | 3262 | catch (NullReferenceException) |
3159 | { | 3263 | { |
@@ -3161,12 +3265,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3161 | // Avatar is already disposed :/ | 3265 | // Avatar is already disposed :/ |
3162 | } | 3266 | } |
3163 | 3267 | ||
3268 | m_log.Debug("[Scene] Beginning OnRemovePresence"); | ||
3164 | m_eventManager.TriggerOnRemovePresence(agentID); | 3269 | m_eventManager.TriggerOnRemovePresence(agentID); |
3270 | m_log.Debug("[Scene] Finished OnRemovePresence"); | ||
3271 | |||
3165 | ForEachClient( | 3272 | ForEachClient( |
3166 | delegate(IClientAPI client) | 3273 | delegate(IClientAPI client) |
3167 | { | 3274 | { |
3168 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway | 3275 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway |
3169 | try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); } | 3276 | try { client.SendKillObject(avatar.RegionHandle, new List<uint>() { avatar.LocalId}); } |
3170 | catch (NullReferenceException) { } | 3277 | catch (NullReferenceException) { } |
3171 | }); | 3278 | }); |
3172 | 3279 | ||
@@ -3177,8 +3284,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3177 | } | 3284 | } |
3178 | 3285 | ||
3179 | // Remove the avatar from the scene | 3286 | // Remove the avatar from the scene |
3287 | m_log.Debug("[Scene] Begin RemoveScenePresence"); | ||
3180 | m_sceneGraph.RemoveScenePresence(agentID); | 3288 | m_sceneGraph.RemoveScenePresence(agentID); |
3289 | m_log.Debug("[Scene] Finished RemoveScenePresence. Removing the client manager"); | ||
3181 | m_clientManager.Remove(agentID); | 3290 | m_clientManager.Remove(agentID); |
3291 | m_log.Debug("[Scene] Removed the client manager. Firing avatar.close"); | ||
3182 | 3292 | ||
3183 | try | 3293 | try |
3184 | { | 3294 | { |
@@ -3192,8 +3302,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3192 | { | 3302 | { |
3193 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); | 3303 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); |
3194 | } | 3304 | } |
3195 | 3305 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); | |
3196 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3306 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3307 | CleanDroppedAttachments(); | ||
3308 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3197 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3309 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
3198 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 3310 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
3199 | } | 3311 | } |
@@ -3224,18 +3336,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
3224 | 3336 | ||
3225 | #region Entities | 3337 | #region Entities |
3226 | 3338 | ||
3227 | public void SendKillObject(uint localID) | 3339 | public void SendKillObject(List<uint> localIDs) |
3228 | { | 3340 | { |
3229 | SceneObjectPart part = GetSceneObjectPart(localID); | 3341 | List<uint> deleteIDs = new List<uint>(); |
3230 | if (part != null) // It is a prim | 3342 | |
3343 | foreach (uint localID in localIDs) | ||
3231 | { | 3344 | { |
3232 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid | 3345 | SceneObjectPart part = GetSceneObjectPart(localID); |
3346 | if (part != null) // It is a prim | ||
3233 | { | 3347 | { |
3234 | if (part.ParentGroup.RootPart != part) // Child part | 3348 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid |
3235 | return; | 3349 | { |
3350 | if (part.ParentGroup.RootPart != part) // Child part | ||
3351 | continue; | ||
3352 | } | ||
3236 | } | 3353 | } |
3354 | deleteIDs.Add(localID); | ||
3237 | } | 3355 | } |
3238 | ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); | 3356 | ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, deleteIDs); }); |
3239 | } | 3357 | } |
3240 | 3358 | ||
3241 | #endregion | 3359 | #endregion |
@@ -3253,7 +3371,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3253 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | 3371 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; |
3254 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; | 3372 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; |
3255 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; | 3373 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; |
3256 | m_sceneGridService.KiPrimitive += SendKillObject; | ||
3257 | m_sceneGridService.OnGetLandData += GetLandData; | 3374 | m_sceneGridService.OnGetLandData += GetLandData; |
3258 | } | 3375 | } |
3259 | 3376 | ||
@@ -3262,7 +3379,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3262 | /// </summary> | 3379 | /// </summary> |
3263 | public void UnRegisterRegionWithComms() | 3380 | public void UnRegisterRegionWithComms() |
3264 | { | 3381 | { |
3265 | m_sceneGridService.KiPrimitive -= SendKillObject; | ||
3266 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; | 3382 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; |
3267 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; | 3383 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; |
3268 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | 3384 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; |
@@ -3333,6 +3449,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3333 | { | 3449 | { |
3334 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3450 | if (land != null && !TestLandRestrictions(agent, land, out reason)) |
3335 | { | 3451 | { |
3452 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3336 | return false; | 3453 | return false; |
3337 | } | 3454 | } |
3338 | } | 3455 | } |
@@ -3390,6 +3507,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3390 | 3507 | ||
3391 | if (vialogin) | 3508 | if (vialogin) |
3392 | { | 3509 | { |
3510 | CleanDroppedAttachments(); | ||
3511 | |||
3393 | if (TestBorderCross(agent.startpos, Cardinals.E)) | 3512 | if (TestBorderCross(agent.startpos, Cardinals.E)) |
3394 | { | 3513 | { |
3395 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); | 3514 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); |
@@ -3446,6 +3565,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3446 | } | 3565 | } |
3447 | } | 3566 | } |
3448 | // Honor parcel landing type and position. | 3567 | // Honor parcel landing type and position. |
3568 | /* | ||
3569 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3449 | if (land != null) | 3570 | if (land != null) |
3450 | { | 3571 | { |
3451 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3572 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3453,6 +3574,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3453 | agent.startpos = land.LandData.UserLocation; | 3574 | agent.startpos = land.LandData.UserLocation; |
3454 | } | 3575 | } |
3455 | } | 3576 | } |
3577 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3456 | } | 3578 | } |
3457 | 3579 | ||
3458 | return true; | 3580 | return true; |
@@ -3738,6 +3860,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3738 | 3860 | ||
3739 | // We have to wait until the viewer contacts this region after receiving EAC. | 3861 | // We have to wait until the viewer contacts this region after receiving EAC. |
3740 | // That calls AddNewClient, which finally creates the ScenePresence | 3862 | // That calls AddNewClient, which finally creates the ScenePresence |
3863 | int num = m_sceneGraph.GetNumberOfScenePresences(); | ||
3864 | |||
3865 | if (num >= RegionInfo.RegionSettings.AgentLimit) | ||
3866 | { | ||
3867 | if (!Permissions.IsAdministrator(cAgentData.AgentID)) | ||
3868 | return false; | ||
3869 | } | ||
3870 | |||
3741 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); | 3871 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); |
3742 | if (childAgentUpdate != null) | 3872 | if (childAgentUpdate != null) |
3743 | { | 3873 | { |
@@ -3803,12 +3933,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3803 | return false; | 3933 | return false; |
3804 | } | 3934 | } |
3805 | 3935 | ||
3936 | public bool IncomingCloseAgent(UUID agentID) | ||
3937 | { | ||
3938 | return IncomingCloseAgent(agentID, false); | ||
3939 | } | ||
3940 | |||
3941 | public bool IncomingCloseChildAgent(UUID agentID) | ||
3942 | { | ||
3943 | return IncomingCloseAgent(agentID, true); | ||
3944 | } | ||
3945 | |||
3806 | /// <summary> | 3946 | /// <summary> |
3807 | /// Tell a single agent to disconnect from the region. | 3947 | /// Tell a single agent to disconnect from the region. |
3808 | /// </summary> | 3948 | /// </summary> |
3809 | /// <param name="regionHandle"></param> | ||
3810 | /// <param name="agentID"></param> | 3949 | /// <param name="agentID"></param> |
3811 | public bool IncomingCloseAgent(UUID agentID) | 3950 | /// <param name="childOnly"></param> |
3951 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) | ||
3812 | { | 3952 | { |
3813 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 3953 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
3814 | 3954 | ||
@@ -3820,7 +3960,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3820 | { | 3960 | { |
3821 | m_sceneGraph.removeUserCount(false); | 3961 | m_sceneGraph.removeUserCount(false); |
3822 | } | 3962 | } |
3823 | else | 3963 | else if (!childOnly) |
3824 | { | 3964 | { |
3825 | m_sceneGraph.removeUserCount(true); | 3965 | m_sceneGraph.removeUserCount(true); |
3826 | } | 3966 | } |
@@ -3836,9 +3976,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3836 | } | 3976 | } |
3837 | else | 3977 | else |
3838 | presence.ControllingClient.SendShutdownConnectionNotice(); | 3978 | presence.ControllingClient.SendShutdownConnectionNotice(); |
3979 | presence.ControllingClient.Close(false); | ||
3980 | } | ||
3981 | else if (!childOnly) | ||
3982 | { | ||
3983 | presence.ControllingClient.Close(true); | ||
3839 | } | 3984 | } |
3840 | |||
3841 | presence.ControllingClient.Close(); | ||
3842 | return true; | 3985 | return true; |
3843 | } | 3986 | } |
3844 | 3987 | ||
@@ -4460,7 +4603,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4460 | // | 4603 | // |
4461 | int health=1; // Start at 1, means we're up | 4604 | int health=1; // Start at 1, means we're up |
4462 | 4605 | ||
4463 | if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) | 4606 | if (m_firstHeartbeat || ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)) |
4464 | health+=1; | 4607 | health+=1; |
4465 | else | 4608 | else |
4466 | return health; | 4609 | return health; |
@@ -4924,8 +5067,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4924 | { | 5067 | { |
4925 | float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; | 5068 | float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; |
4926 | 5069 | ||
5070 | Vector3 vec = g.AbsolutePosition; | ||
5071 | |||
4927 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); | 5072 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); |
4928 | 5073 | ||
5074 | ominX += vec.X; | ||
5075 | omaxX += vec.X; | ||
5076 | ominY += vec.Y; | ||
5077 | omaxY += vec.Y; | ||
5078 | ominZ += vec.Z; | ||
5079 | omaxZ += vec.Z; | ||
5080 | |||
4929 | if (minX > ominX) | 5081 | if (minX > ominX) |
4930 | minX = ominX; | 5082 | minX = ominX; |
4931 | if (minY > ominY) | 5083 | if (minY > ominY) |
@@ -4966,5 +5118,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
4966 | throw new Exception(error); | 5118 | throw new Exception(error); |
4967 | } | 5119 | } |
4968 | } | 5120 | } |
5121 | |||
5122 | public void CleanDroppedAttachments() | ||
5123 | { | ||
5124 | List<SceneObjectGroup> objectsToDelete = | ||
5125 | new List<SceneObjectGroup>(); | ||
5126 | |||
5127 | lock (m_cleaningAttachments) | ||
5128 | { | ||
5129 | ForEachSOG(delegate (SceneObjectGroup grp) | ||
5130 | { | ||
5131 | if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5132 | { | ||
5133 | UUID agentID = grp.OwnerID; | ||
5134 | if (agentID == UUID.Zero) | ||
5135 | { | ||
5136 | objectsToDelete.Add(grp); | ||
5137 | return; | ||
5138 | } | ||
5139 | |||
5140 | ScenePresence sp = GetScenePresence(agentID); | ||
5141 | if (sp == null) | ||
5142 | { | ||
5143 | objectsToDelete.Add(grp); | ||
5144 | return; | ||
5145 | } | ||
5146 | } | ||
5147 | }); | ||
5148 | } | ||
5149 | |||
5150 | if (objectsToDelete.Count > 0) | ||
5151 | { | ||
5152 | m_log.DebugFormat("[SCENE]: Starting delete of {0} dropped attachments", objectsToDelete.Count); | ||
5153 | foreach (SceneObjectGroup grp in objectsToDelete) | ||
5154 | { | ||
5155 | m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5156 | DeleteSceneObject(grp, true); | ||
5157 | } | ||
5158 | m_log.Debug("[SCENE]: Finished dropped attachment deletion"); | ||
5159 | } | ||
5160 | } | ||
4969 | } | 5161 | } |
4970 | } | 5162 | } |