diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 180 |
1 files changed, 149 insertions, 31 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a147628..957c4e8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -137,6 +137,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | protected SceneCommunicationService m_sceneGridService; | 137 | protected SceneCommunicationService m_sceneGridService; |
138 | public bool LoginsDisabled = true; | 138 | public bool LoginsDisabled = true; |
139 | public bool LoadingPrims = false; | 139 | public bool LoadingPrims = false; |
140 | public bool CombineRegions = false; | ||
140 | 141 | ||
141 | public new float TimeDilation | 142 | public new float TimeDilation |
142 | { | 143 | { |
@@ -150,6 +151,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
150 | 151 | ||
151 | public IXfer XferManager; | 152 | public IXfer XferManager; |
152 | 153 | ||
154 | protected ISnmpModule m_snmpService = null; | ||
155 | public ISnmpModule SnmpService | ||
156 | { | ||
157 | get | ||
158 | { | ||
159 | if (m_snmpService == null) | ||
160 | { | ||
161 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
162 | } | ||
163 | |||
164 | return m_snmpService; | ||
165 | } | ||
166 | } | ||
167 | |||
153 | protected IAssetService m_AssetService; | 168 | protected IAssetService m_AssetService; |
154 | protected IAuthorizationService m_AuthorizationService; | 169 | protected IAuthorizationService m_AuthorizationService; |
155 | 170 | ||
@@ -544,6 +559,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
544 | 559 | ||
545 | // Load region settings | 560 | // Load region settings |
546 | 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 | |||
547 | if (m_storageManager.EstateDataStore != null) | 564 | if (m_storageManager.EstateDataStore != null) |
548 | { | 565 | { |
549 | m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); | 566 | m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); |
@@ -606,9 +623,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
606 | //Animation states | 623 | //Animation states |
607 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 624 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
608 | // TODO: Change default to true once the feature is supported | 625 | // TODO: Change default to true once the feature is supported |
609 | m_usePreJump = startupConfig.GetBoolean("enableprejump", false); | 626 | m_usePreJump = startupConfig.GetBoolean("enableprejump", true); |
610 | |||
611 | 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"); | ||
612 | if (RegionInfo.NonphysPrimMax > 0) | 630 | if (RegionInfo.NonphysPrimMax > 0) |
613 | { | 631 | { |
614 | m_maxNonphys = RegionInfo.NonphysPrimMax; | 632 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
@@ -640,6 +658,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
640 | m_persistAfter *= 10000000; | 658 | m_persistAfter *= 10000000; |
641 | 659 | ||
642 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 660 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
661 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
643 | 662 | ||
644 | IConfig packetConfig = m_config.Configs["PacketPool"]; | 663 | IConfig packetConfig = m_config.Configs["PacketPool"]; |
645 | if (packetConfig != null) | 664 | if (packetConfig != null) |
@@ -649,6 +668,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
649 | } | 668 | } |
650 | 669 | ||
651 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 670 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
671 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
652 | 672 | ||
653 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 673 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); |
654 | if (m_generateMaptiles) | 674 | if (m_generateMaptiles) |
@@ -673,9 +693,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
673 | } | 693 | } |
674 | } | 694 | } |
675 | } | 695 | } |
676 | catch | 696 | catch (Exception e) |
677 | { | 697 | { |
678 | m_log.Warn("[SCENE]: Failed to load StartupConfig"); | 698 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); |
679 | } | 699 | } |
680 | 700 | ||
681 | #endregion Region Config | 701 | #endregion Region Config |
@@ -912,6 +932,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
912 | /// <param name="seconds">float indicating duration before restart.</param> | 932 | /// <param name="seconds">float indicating duration before restart.</param> |
913 | public virtual void Restart(float seconds) | 933 | public virtual void Restart(float seconds) |
914 | { | 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 | { | ||
915 | // notifications are done in 15 second increments | 944 | // notifications are done in 15 second increments |
916 | // 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 |
917 | // It's a 'Cancel restart' request. | 946 | // It's a 'Cancel restart' request. |
@@ -932,8 +961,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
932 | m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); | 961 | m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); |
933 | m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); | 962 | m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); |
934 | m_restartTimer.Start(); | 963 | m_restartTimer.Start(); |
935 | m_dialogModule.SendNotificationToUsersInRegion( | 964 | if (showDialog) |
965 | { | ||
966 | m_dialogModule.SendNotificationToUsersInRegion( | ||
936 | 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 | } | ||
937 | } | 969 | } |
938 | } | 970 | } |
939 | 971 | ||
@@ -1291,16 +1323,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1291 | // Check if any objects have reached their targets | 1323 | // Check if any objects have reached their targets |
1292 | CheckAtTargets(); | 1324 | CheckAtTargets(); |
1293 | 1325 | ||
1294 | // Update SceneObjectGroups that have scheduled themselves for updates | ||
1295 | // Objects queue their updates onto all scene presences | ||
1296 | if (m_frame % m_update_objects == 0) | ||
1297 | m_sceneGraph.UpdateObjectGroups(); | ||
1298 | |||
1299 | // Run through all ScenePresences looking for updates | 1326 | // Run through all ScenePresences looking for updates |
1300 | // Presence updates and queued object updates for each presence are sent to clients | 1327 | // Presence updates and queued object updates for each presence are sent to clients |
1301 | if (m_frame % m_update_presences == 0) | 1328 | if (m_frame % m_update_presences == 0) |
1302 | m_sceneGraph.UpdatePresences(); | 1329 | m_sceneGraph.UpdatePresences(); |
1303 | 1330 | ||
1331 | // Update SceneObjectGroups that have scheduled themselves for updates | ||
1332 | // Objects queue their updates onto all scene presences | ||
1333 | if (m_frame % m_update_objects == 0) | ||
1334 | m_sceneGraph.UpdateObjectGroups(); | ||
1335 | |||
1304 | if (m_frame % m_update_coarse_locations == 0) | 1336 | if (m_frame % m_update_coarse_locations == 0) |
1305 | { | 1337 | { |
1306 | List<Vector3> coarseLocations; | 1338 | List<Vector3> coarseLocations; |
@@ -1629,6 +1661,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1629 | public void StoreWindlightProfile(RegionLightShareData wl) | 1661 | public void StoreWindlightProfile(RegionLightShareData wl) |
1630 | { | 1662 | { |
1631 | m_regInfo.WindlightSettings = wl; | 1663 | m_regInfo.WindlightSettings = wl; |
1664 | wl.Save(); | ||
1632 | m_storageManager.DataStore.StoreRegionWindlightSettings(wl); | 1665 | m_storageManager.DataStore.StoreRegionWindlightSettings(wl); |
1633 | m_eventManager.TriggerOnSaveNewWindlightProfile(); | 1666 | m_eventManager.TriggerOnSaveNewWindlightProfile(); |
1634 | } | 1667 | } |
@@ -1789,14 +1822,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1789 | /// <returns></returns> | 1822 | /// <returns></returns> |
1790 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 1823 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
1791 | { | 1824 | { |
1825 | |||
1826 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
1827 | Vector3 wpos = Vector3.Zero; | ||
1828 | // Check for water surface intersection from above | ||
1829 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
1830 | { | ||
1831 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
1832 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
1833 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
1834 | wpos.Z = wheight; | ||
1835 | } | ||
1836 | |||
1792 | Vector3 pos = Vector3.Zero; | 1837 | Vector3 pos = Vector3.Zero; |
1793 | if (RayEndIsIntersection == (byte)1) | 1838 | if (RayEndIsIntersection == (byte)1) |
1794 | { | 1839 | { |
1795 | pos = RayEnd; | 1840 | pos = RayEnd; |
1796 | return pos; | ||
1797 | } | 1841 | } |
1798 | 1842 | else if (RayTargetID != UUID.Zero) | |
1799 | if (RayTargetID != UUID.Zero) | ||
1800 | { | 1843 | { |
1801 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 1844 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
1802 | 1845 | ||
@@ -1818,7 +1861,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1818 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 1861 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
1819 | 1862 | ||
1820 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1863 | // Un-comment out the following line to Get Raytrace results printed to the console. |
1821 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 1864 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
1822 | float ScaleOffset = 0.5f; | 1865 | float ScaleOffset = 0.5f; |
1823 | 1866 | ||
1824 | // If we hit something | 1867 | // If we hit something |
@@ -1841,13 +1884,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1841 | //pos.Z -= 0.25F; | 1884 | //pos.Z -= 0.25F; |
1842 | 1885 | ||
1843 | } | 1886 | } |
1844 | |||
1845 | return pos; | ||
1846 | } | 1887 | } |
1847 | else | 1888 | else |
1848 | { | 1889 | { |
1849 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 1890 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
1850 | |||
1851 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 1891 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
1852 | 1892 | ||
1853 | // Un-comment the following line to print the raytrace results to the console. | 1893 | // Un-comment the following line to print the raytrace results to the console. |
@@ -1856,13 +1896,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1856 | if (ei.HitTF) | 1896 | if (ei.HitTF) |
1857 | { | 1897 | { |
1858 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 1898 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
1859 | } else | 1899 | } |
1900 | else | ||
1860 | { | 1901 | { |
1861 | // fall back to our stupid functionality | 1902 | // fall back to our stupid functionality |
1862 | pos = RayEnd; | 1903 | pos = RayEnd; |
1863 | } | 1904 | } |
1864 | |||
1865 | return pos; | ||
1866 | } | 1905 | } |
1867 | } | 1906 | } |
1868 | else | 1907 | else |
@@ -1873,8 +1912,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1873 | //increase height so its above the ground. | 1912 | //increase height so its above the ground. |
1874 | //should be getting the normal of the ground at the rez point and using that? | 1913 | //should be getting the normal of the ground at the rez point and using that? |
1875 | pos.Z += scale.Z / 2f; | 1914 | pos.Z += scale.Z / 2f; |
1876 | return pos; | 1915 | // return pos; |
1877 | } | 1916 | } |
1917 | |||
1918 | // check against posible water intercept | ||
1919 | if (wpos.Z > pos.Z) pos = wpos; | ||
1920 | return pos; | ||
1878 | } | 1921 | } |
1879 | 1922 | ||
1880 | 1923 | ||
@@ -2007,13 +2050,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2007 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 2050 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
2008 | { | 2051 | { |
2009 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); | 2052 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); |
2010 | } | 2053 | } |
2011 | 2054 | ||
2012 | /// <summary> | 2055 | /// <summary> |
2013 | /// Delete every object from the scene. This does not include attachments worn by avatars. | 2056 | /// Delete every object from the scene. This does not include attachments worn by avatars. |
2014 | /// </summary> | 2057 | /// </summary> |
2015 | public void DeleteAllSceneObjects() | 2058 | public void DeleteAllSceneObjects() |
2016 | { | 2059 | { |
2060 | DeleteAllSceneObjects(false); | ||
2061 | } | ||
2062 | |||
2063 | /// <summary> | ||
2064 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2065 | /// </summary> | ||
2066 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2067 | { | ||
2068 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2017 | lock (Entities) | 2069 | lock (Entities) |
2018 | { | 2070 | { |
2019 | ICollection<EntityBase> entities = new List<EntityBase>(Entities); | 2071 | ICollection<EntityBase> entities = new List<EntityBase>(Entities); |
@@ -2023,11 +2075,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2023 | if (e is SceneObjectGroup) | 2075 | if (e is SceneObjectGroup) |
2024 | { | 2076 | { |
2025 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2077 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2026 | if (!sog.IsAttachment) | 2078 | if (sog != null && !sog.IsAttachment) |
2027 | DeleteSceneObject((SceneObjectGroup)e, false); | 2079 | { |
2080 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2081 | { | ||
2082 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2083 | } | ||
2084 | else | ||
2085 | { | ||
2086 | toReturn.Add((SceneObjectGroup)e); | ||
2087 | } | ||
2088 | } | ||
2028 | } | 2089 | } |
2029 | } | 2090 | } |
2030 | } | 2091 | } |
2092 | if (toReturn.Count > 0) | ||
2093 | { | ||
2094 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2095 | } | ||
2031 | } | 2096 | } |
2032 | 2097 | ||
2033 | /// <summary> | 2098 | /// <summary> |
@@ -2395,6 +2460,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2395 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2460 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2396 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2461 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2397 | { | 2462 | { |
2463 | if (sceneObject.OwnerID == UUID.Zero) | ||
2464 | { | ||
2465 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2466 | return false; | ||
2467 | } | ||
2468 | |||
2398 | // If the user is banned, we won't let any of their objects | 2469 | // If the user is banned, we won't let any of their objects |
2399 | // enter. Period. | 2470 | // enter. Period. |
2400 | // | 2471 | // |
@@ -2444,15 +2515,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2444 | if (AttachmentsModule != null) | 2515 | if (AttachmentsModule != null) |
2445 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); | 2516 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); |
2446 | 2517 | ||
2518 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was found, attaching", sceneObject.UUID); | ||
2447 | } | 2519 | } |
2448 | else | 2520 | else |
2449 | { | 2521 | { |
2522 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2450 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2523 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2451 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2524 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2452 | } | 2525 | } |
2526 | if (sceneObject.OwnerID == UUID.Zero) | ||
2527 | { | ||
2528 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2529 | return false; | ||
2530 | } | ||
2453 | } | 2531 | } |
2454 | else | 2532 | else |
2455 | { | 2533 | { |
2534 | if (sceneObject.OwnerID == UUID.Zero) | ||
2535 | { | ||
2536 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2537 | return false; | ||
2538 | } | ||
2456 | AddRestoredSceneObject(sceneObject, true, false); | 2539 | AddRestoredSceneObject(sceneObject, true, false); |
2457 | 2540 | ||
2458 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | 2541 | if (!Permissions.CanObjectEntry(sceneObject.UUID, |
@@ -2723,6 +2806,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2723 | client.OnFetchInventory += HandleFetchInventory; | 2806 | client.OnFetchInventory += HandleFetchInventory; |
2724 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 2807 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
2725 | client.OnCopyInventoryItem += CopyInventoryItem; | 2808 | client.OnCopyInventoryItem += CopyInventoryItem; |
2809 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
2726 | client.OnMoveInventoryItem += MoveInventoryItem; | 2810 | client.OnMoveInventoryItem += MoveInventoryItem; |
2727 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 2811 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
2728 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 2812 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3008,6 +3092,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3008 | /// <param name="flags"></param> | 3092 | /// <param name="flags"></param> |
3009 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3093 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3010 | { | 3094 | { |
3095 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3096 | ScenePresence presence; | ||
3097 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3098 | { | ||
3099 | if (presence.Appearance != null) | ||
3100 | { | ||
3101 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3102 | } | ||
3103 | } | ||
3104 | |||
3011 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3105 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3012 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3106 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3013 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3107 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3102,7 +3196,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3102 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3196 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3103 | 3197 | ||
3104 | } | 3198 | } |
3199 | m_log.Debug("[Scene] Beginning ClientClosed"); | ||
3105 | m_eventManager.TriggerClientClosed(agentID, this); | 3200 | m_eventManager.TriggerClientClosed(agentID, this); |
3201 | m_log.Debug("[Scene] Finished ClientClosed"); | ||
3106 | } | 3202 | } |
3107 | catch (NullReferenceException) | 3203 | catch (NullReferenceException) |
3108 | { | 3204 | { |
@@ -3110,7 +3206,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3110 | // Avatar is already disposed :/ | 3206 | // Avatar is already disposed :/ |
3111 | } | 3207 | } |
3112 | 3208 | ||
3209 | m_log.Debug("[Scene] Beginning OnRemovePresence"); | ||
3113 | m_eventManager.TriggerOnRemovePresence(agentID); | 3210 | m_eventManager.TriggerOnRemovePresence(agentID); |
3211 | m_log.Debug("[Scene] Finished OnRemovePresence"); | ||
3114 | ForEachClient( | 3212 | ForEachClient( |
3115 | delegate(IClientAPI client) | 3213 | delegate(IClientAPI client) |
3116 | { | 3214 | { |
@@ -3126,8 +3224,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3126 | } | 3224 | } |
3127 | 3225 | ||
3128 | // Remove the avatar from the scene | 3226 | // Remove the avatar from the scene |
3227 | m_log.Debug("[Scene] Begin RemoveScenePresence"); | ||
3129 | m_sceneGraph.RemoveScenePresence(agentID); | 3228 | m_sceneGraph.RemoveScenePresence(agentID); |
3229 | m_log.Debug("[Scene] Finished RemoveScenePresence. Removing the client manager"); | ||
3130 | m_clientManager.Remove(agentID); | 3230 | m_clientManager.Remove(agentID); |
3231 | m_log.Debug("[Scene] Removed the client manager. Firing avatar.close"); | ||
3131 | 3232 | ||
3132 | try | 3233 | try |
3133 | { | 3234 | { |
@@ -3141,9 +3242,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3141 | { | 3242 | { |
3142 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); | 3243 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); |
3143 | } | 3244 | } |
3144 | 3245 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); | |
3145 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3246 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3146 | 3247 | m_log.Debug("[Scene] The avatar has left the building"); | |
3147 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3248 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
3148 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 3249 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
3149 | } | 3250 | } |
@@ -3283,6 +3384,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3283 | { | 3384 | { |
3284 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3385 | if (land != null && !TestLandRestrictions(agent, land, out reason)) |
3285 | { | 3386 | { |
3387 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3286 | return false; | 3388 | return false; |
3287 | } | 3389 | } |
3288 | } | 3390 | } |
@@ -3396,6 +3498,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3396 | } | 3498 | } |
3397 | } | 3499 | } |
3398 | // Honor parcel landing type and position. | 3500 | // Honor parcel landing type and position. |
3501 | /* | ||
3502 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3399 | if (land != null) | 3503 | if (land != null) |
3400 | { | 3504 | { |
3401 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3505 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3403,6 +3507,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3403 | agent.startpos = land.LandData.UserLocation; | 3507 | agent.startpos = land.LandData.UserLocation; |
3404 | } | 3508 | } |
3405 | } | 3509 | } |
3510 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3406 | } | 3511 | } |
3407 | 3512 | ||
3408 | return true; | 3513 | return true; |
@@ -3765,12 +3870,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3765 | return false; | 3870 | return false; |
3766 | } | 3871 | } |
3767 | 3872 | ||
3873 | public bool IncomingCloseAgent(UUID agentID) | ||
3874 | { | ||
3875 | return IncomingCloseAgent(agentID, false); | ||
3876 | } | ||
3877 | |||
3878 | public bool IncomingCloseChildAgent(UUID agentID) | ||
3879 | { | ||
3880 | return IncomingCloseAgent(agentID, true); | ||
3881 | } | ||
3882 | |||
3768 | /// <summary> | 3883 | /// <summary> |
3769 | /// Tell a single agent to disconnect from the region. | 3884 | /// Tell a single agent to disconnect from the region. |
3770 | /// </summary> | 3885 | /// </summary> |
3771 | /// <param name="regionHandle"></param> | ||
3772 | /// <param name="agentID"></param> | 3886 | /// <param name="agentID"></param> |
3773 | public bool IncomingCloseAgent(UUID agentID) | 3887 | /// <param name="childOnly"></param> |
3888 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) | ||
3774 | { | 3889 | { |
3775 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 3890 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
3776 | 3891 | ||
@@ -3782,7 +3897,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3782 | { | 3897 | { |
3783 | m_sceneGraph.removeUserCount(false); | 3898 | m_sceneGraph.removeUserCount(false); |
3784 | } | 3899 | } |
3785 | else | 3900 | else if (!childOnly) |
3786 | { | 3901 | { |
3787 | m_sceneGraph.removeUserCount(true); | 3902 | m_sceneGraph.removeUserCount(true); |
3788 | } | 3903 | } |
@@ -3798,9 +3913,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3798 | } | 3913 | } |
3799 | else | 3914 | else |
3800 | presence.ControllingClient.SendShutdownConnectionNotice(); | 3915 | presence.ControllingClient.SendShutdownConnectionNotice(); |
3916 | presence.ControllingClient.Close(false); | ||
3917 | } | ||
3918 | else if (!childOnly) | ||
3919 | { | ||
3920 | presence.ControllingClient.Close(true); | ||
3801 | } | 3921 | } |
3802 | |||
3803 | presence.ControllingClient.Close(); | ||
3804 | return true; | 3922 | return true; |
3805 | } | 3923 | } |
3806 | 3924 | ||