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 3343d08..ae48c02 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; |
@@ -3349,6 +3465,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3349 | { | 3465 | { |
3350 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3466 | if (land != null && !TestLandRestrictions(agent, land, out reason)) |
3351 | { | 3467 | { |
3468 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3352 | return false; | 3469 | return false; |
3353 | } | 3470 | } |
3354 | } | 3471 | } |
@@ -3408,6 +3525,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3408 | 3525 | ||
3409 | if (vialogin) | 3526 | if (vialogin) |
3410 | { | 3527 | { |
3528 | CleanDroppedAttachments(); | ||
3529 | |||
3411 | if (TestBorderCross(agent.startpos, Cardinals.E)) | 3530 | if (TestBorderCross(agent.startpos, Cardinals.E)) |
3412 | { | 3531 | { |
3413 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); | 3532 | Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); |
@@ -3464,6 +3583,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3464 | } | 3583 | } |
3465 | } | 3584 | } |
3466 | // Honor parcel landing type and position. | 3585 | // Honor parcel landing type and position. |
3586 | /* | ||
3587 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3467 | if (land != null) | 3588 | if (land != null) |
3468 | { | 3589 | { |
3469 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3590 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3471,6 +3592,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3471 | agent.startpos = land.LandData.UserLocation; | 3592 | agent.startpos = land.LandData.UserLocation; |
3472 | } | 3593 | } |
3473 | } | 3594 | } |
3595 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3474 | } | 3596 | } |
3475 | 3597 | ||
3476 | return true; | 3598 | return true; |
@@ -3756,6 +3878,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3756 | 3878 | ||
3757 | // We have to wait until the viewer contacts this region after receiving EAC. | 3879 | // We have to wait until the viewer contacts this region after receiving EAC. |
3758 | // That calls AddNewClient, which finally creates the ScenePresence | 3880 | // That calls AddNewClient, which finally creates the ScenePresence |
3881 | int num = m_sceneGraph.GetNumberOfScenePresences(); | ||
3882 | |||
3883 | if (num >= RegionInfo.RegionSettings.AgentLimit) | ||
3884 | { | ||
3885 | if (!Permissions.IsAdministrator(cAgentData.AgentID)) | ||
3886 | return false; | ||
3887 | } | ||
3888 | |||
3759 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); | 3889 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); |
3760 | if (childAgentUpdate != null) | 3890 | if (childAgentUpdate != null) |
3761 | { | 3891 | { |
@@ -3821,12 +3951,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3821 | return false; | 3951 | return false; |
3822 | } | 3952 | } |
3823 | 3953 | ||
3954 | public bool IncomingCloseAgent(UUID agentID) | ||
3955 | { | ||
3956 | return IncomingCloseAgent(agentID, false); | ||
3957 | } | ||
3958 | |||
3959 | public bool IncomingCloseChildAgent(UUID agentID) | ||
3960 | { | ||
3961 | return IncomingCloseAgent(agentID, true); | ||
3962 | } | ||
3963 | |||
3824 | /// <summary> | 3964 | /// <summary> |
3825 | /// Tell a single agent to disconnect from the region. | 3965 | /// Tell a single agent to disconnect from the region. |
3826 | /// </summary> | 3966 | /// </summary> |
3827 | /// <param name="regionHandle"></param> | ||
3828 | /// <param name="agentID"></param> | 3967 | /// <param name="agentID"></param> |
3829 | public bool IncomingCloseAgent(UUID agentID) | 3968 | /// <param name="childOnly"></param> |
3969 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) | ||
3830 | { | 3970 | { |
3831 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 3971 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
3832 | 3972 | ||
@@ -3838,7 +3978,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3838 | { | 3978 | { |
3839 | m_sceneGraph.removeUserCount(false); | 3979 | m_sceneGraph.removeUserCount(false); |
3840 | } | 3980 | } |
3841 | else | 3981 | else if (!childOnly) |
3842 | { | 3982 | { |
3843 | m_sceneGraph.removeUserCount(true); | 3983 | m_sceneGraph.removeUserCount(true); |
3844 | } | 3984 | } |
@@ -3854,9 +3994,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3854 | } | 3994 | } |
3855 | else | 3995 | else |
3856 | presence.ControllingClient.SendShutdownConnectionNotice(); | 3996 | presence.ControllingClient.SendShutdownConnectionNotice(); |
3997 | presence.ControllingClient.Close(false); | ||
3998 | } | ||
3999 | else if (!childOnly) | ||
4000 | { | ||
4001 | presence.ControllingClient.Close(true); | ||
3857 | } | 4002 | } |
3858 | |||
3859 | presence.ControllingClient.Close(); | ||
3860 | return true; | 4003 | return true; |
3861 | } | 4004 | } |
3862 | 4005 | ||
@@ -4478,7 +4621,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4478 | // | 4621 | // |
4479 | int health=1; // Start at 1, means we're up | 4622 | int health=1; // Start at 1, means we're up |
4480 | 4623 | ||
4481 | if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) | 4624 | if (m_firstHeartbeat || ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)) |
4482 | health+=1; | 4625 | health+=1; |
4483 | else | 4626 | else |
4484 | return health; | 4627 | return health; |
@@ -4942,8 +5085,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4942 | { | 5085 | { |
4943 | float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; | 5086 | float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; |
4944 | 5087 | ||
5088 | Vector3 vec = g.AbsolutePosition; | ||
5089 | |||
4945 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); | 5090 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); |
4946 | 5091 | ||
5092 | ominX += vec.X; | ||
5093 | omaxX += vec.X; | ||
5094 | ominY += vec.Y; | ||
5095 | omaxY += vec.Y; | ||
5096 | ominZ += vec.Z; | ||
5097 | omaxZ += vec.Z; | ||
5098 | |||
4947 | if (minX > ominX) | 5099 | if (minX > ominX) |
4948 | minX = ominX; | 5100 | minX = ominX; |
4949 | if (minY > ominY) | 5101 | if (minY > ominY) |
@@ -4984,5 +5136,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
4984 | throw new Exception(error); | 5136 | throw new Exception(error); |
4985 | } | 5137 | } |
4986 | } | 5138 | } |
5139 | |||
5140 | public void CleanDroppedAttachments() | ||
5141 | { | ||
5142 | List<SceneObjectGroup> objectsToDelete = | ||
5143 | new List<SceneObjectGroup>(); | ||
5144 | |||
5145 | lock (m_cleaningAttachments) | ||
5146 | { | ||
5147 | ForEachSOG(delegate (SceneObjectGroup grp) | ||
5148 | { | ||
5149 | if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5150 | { | ||
5151 | UUID agentID = grp.OwnerID; | ||
5152 | if (agentID == UUID.Zero) | ||
5153 | { | ||
5154 | objectsToDelete.Add(grp); | ||
5155 | return; | ||
5156 | } | ||
5157 | |||
5158 | ScenePresence sp = GetScenePresence(agentID); | ||
5159 | if (sp == null) | ||
5160 | { | ||
5161 | objectsToDelete.Add(grp); | ||
5162 | return; | ||
5163 | } | ||
5164 | } | ||
5165 | }); | ||
5166 | } | ||
5167 | |||
5168 | if (objectsToDelete.Count > 0) | ||
5169 | { | ||
5170 | m_log.DebugFormat("[SCENE]: Starting delete of {0} dropped attachments", objectsToDelete.Count); | ||
5171 | foreach (SceneObjectGroup grp in objectsToDelete) | ||
5172 | { | ||
5173 | m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5174 | DeleteSceneObject(grp, true); | ||
5175 | } | ||
5176 | m_log.Debug("[SCENE]: Finished dropped attachment deletion"); | ||
5177 | } | ||
5178 | } | ||
4987 | } | 5179 | } |
4988 | } | 5180 | } |