diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 242 |
1 files changed, 200 insertions, 42 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b1216c5..216eb51 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -84,6 +84,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
84 | // TODO: need to figure out how allow client agents but deny | 84 | // TODO: need to figure out how allow client agents but deny |
85 | // root agents when ACL denies access to root agent | 85 | // root agents when ACL denies access to root agent |
86 | public bool m_strictAccessControl = true; | 86 | public bool m_strictAccessControl = true; |
87 | public bool m_seeIntoBannedRegion = false; | ||
87 | public int MaxUndoCount = 5; | 88 | public int MaxUndoCount = 5; |
88 | public bool LoginsDisabled = true; | 89 | public bool LoginsDisabled = true; |
89 | public bool LoadingPrims; | 90 | public bool LoadingPrims; |
@@ -102,6 +103,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
102 | protected ModuleLoader m_moduleLoader; | 103 | protected ModuleLoader m_moduleLoader; |
103 | protected AgentCircuitManager m_authenticateHandler; | 104 | protected AgentCircuitManager m_authenticateHandler; |
104 | protected SceneCommunicationService m_sceneGridService; | 105 | protected SceneCommunicationService m_sceneGridService; |
106 | protected ISnmpModule m_snmpService = null; | ||
105 | 107 | ||
106 | protected ISimulationDataService m_SimulationDataService; | 108 | protected ISimulationDataService m_SimulationDataService; |
107 | protected IEstateDataService m_EstateDataService; | 109 | protected IEstateDataService m_EstateDataService; |
@@ -163,6 +165,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
163 | private int landMS; | 165 | private int landMS; |
164 | private int lastCompletedFrame; | 166 | private int lastCompletedFrame; |
165 | 167 | ||
168 | public bool CombineRegions = false; | ||
166 | private bool m_physics_enabled = true; | 169 | private bool m_physics_enabled = true; |
167 | private bool m_scripts_enabled = true; | 170 | private bool m_scripts_enabled = true; |
168 | private string m_defaultScriptEngine; | 171 | private string m_defaultScriptEngine; |
@@ -220,6 +223,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
220 | get { return m_sceneGridService; } | 223 | get { return m_sceneGridService; } |
221 | } | 224 | } |
222 | 225 | ||
226 | public ISnmpModule SnmpService | ||
227 | { | ||
228 | get | ||
229 | { | ||
230 | if (m_snmpService == null) | ||
231 | { | ||
232 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
233 | } | ||
234 | |||
235 | return m_snmpService; | ||
236 | } | ||
237 | } | ||
238 | |||
223 | public ISimulationDataService SimulationDataService | 239 | public ISimulationDataService SimulationDataService |
224 | { | 240 | { |
225 | get | 241 | get |
@@ -564,6 +580,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
564 | #region Region Settings | 580 | #region Region Settings |
565 | 581 | ||
566 | // Load region settings | 582 | // Load region settings |
583 | m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID); | ||
584 | |||
567 | m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); | 585 | m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); |
568 | if (estateDataService != null) | 586 | if (estateDataService != null) |
569 | m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); | 587 | m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); |
@@ -623,9 +641,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
623 | //Animation states | 641 | //Animation states |
624 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 642 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
625 | // TODO: Change default to true once the feature is supported | 643 | // TODO: Change default to true once the feature is supported |
626 | m_usePreJump = startupConfig.GetBoolean("enableprejump", false); | 644 | m_usePreJump = startupConfig.GetBoolean("enableprejump", true); |
627 | |||
628 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 645 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
646 | |||
647 | m_log.DebugFormat("[SCENE]: prejump is {0}", m_usePreJump ? "ON" : "OFF"); | ||
629 | if (RegionInfo.NonphysPrimMax > 0) | 648 | if (RegionInfo.NonphysPrimMax > 0) |
630 | { | 649 | { |
631 | m_maxNonphys = RegionInfo.NonphysPrimMax; | 650 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
@@ -657,6 +676,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
657 | m_persistAfter *= 10000000; | 676 | m_persistAfter *= 10000000; |
658 | 677 | ||
659 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 678 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
679 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
660 | 680 | ||
661 | IConfig packetConfig = m_config.Configs["PacketPool"]; | 681 | IConfig packetConfig = m_config.Configs["PacketPool"]; |
662 | if (packetConfig != null) | 682 | if (packetConfig != null) |
@@ -666,6 +686,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
666 | } | 686 | } |
667 | 687 | ||
668 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 688 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
689 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
690 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
669 | 691 | ||
670 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 692 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); |
671 | if (m_generateMaptiles) | 693 | if (m_generateMaptiles) |
@@ -690,9 +712,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
690 | } | 712 | } |
691 | } | 713 | } |
692 | } | 714 | } |
693 | catch | 715 | catch (Exception e) |
694 | { | 716 | { |
695 | m_log.Warn("[SCENE]: Failed to load StartupConfig"); | 717 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); |
696 | } | 718 | } |
697 | 719 | ||
698 | #endregion Region Config | 720 | #endregion Region Config |
@@ -1063,6 +1085,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1063 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1085 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1064 | if (HeartbeatThread != null) | 1086 | if (HeartbeatThread != null) |
1065 | { | 1087 | { |
1088 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1066 | HeartbeatThread.Abort(); | 1089 | HeartbeatThread.Abort(); |
1067 | HeartbeatThread = null; | 1090 | HeartbeatThread = null; |
1068 | } | 1091 | } |
@@ -1734,14 +1757,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1734 | /// <returns></returns> | 1757 | /// <returns></returns> |
1735 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 1758 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
1736 | { | 1759 | { |
1760 | |||
1761 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
1762 | Vector3 wpos = Vector3.Zero; | ||
1763 | // Check for water surface intersection from above | ||
1764 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
1765 | { | ||
1766 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
1767 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
1768 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
1769 | wpos.Z = wheight; | ||
1770 | } | ||
1771 | |||
1737 | Vector3 pos = Vector3.Zero; | 1772 | Vector3 pos = Vector3.Zero; |
1738 | if (RayEndIsIntersection == (byte)1) | 1773 | if (RayEndIsIntersection == (byte)1) |
1739 | { | 1774 | { |
1740 | pos = RayEnd; | 1775 | pos = RayEnd; |
1741 | return pos; | ||
1742 | } | 1776 | } |
1743 | 1777 | else if (RayTargetID != UUID.Zero) | |
1744 | if (RayTargetID != UUID.Zero) | ||
1745 | { | 1778 | { |
1746 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 1779 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
1747 | 1780 | ||
@@ -1763,7 +1796,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1763 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 1796 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
1764 | 1797 | ||
1765 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1798 | // Un-comment out the following line to Get Raytrace results printed to the console. |
1766 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 1799 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
1767 | float ScaleOffset = 0.5f; | 1800 | float ScaleOffset = 0.5f; |
1768 | 1801 | ||
1769 | // If we hit something | 1802 | // If we hit something |
@@ -1786,13 +1819,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1786 | //pos.Z -= 0.25F; | 1819 | //pos.Z -= 0.25F; |
1787 | 1820 | ||
1788 | } | 1821 | } |
1789 | |||
1790 | return pos; | ||
1791 | } | 1822 | } |
1792 | else | 1823 | else |
1793 | { | 1824 | { |
1794 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 1825 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
1795 | |||
1796 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 1826 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
1797 | 1827 | ||
1798 | // Un-comment the following line to print the raytrace results to the console. | 1828 | // Un-comment the following line to print the raytrace results to the console. |
@@ -1801,13 +1831,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1801 | if (ei.HitTF) | 1831 | if (ei.HitTF) |
1802 | { | 1832 | { |
1803 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 1833 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
1804 | } else | 1834 | } |
1835 | else | ||
1805 | { | 1836 | { |
1806 | // fall back to our stupid functionality | 1837 | // fall back to our stupid functionality |
1807 | pos = RayEnd; | 1838 | pos = RayEnd; |
1808 | } | 1839 | } |
1809 | |||
1810 | return pos; | ||
1811 | } | 1840 | } |
1812 | } | 1841 | } |
1813 | else | 1842 | else |
@@ -1818,8 +1847,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1818 | //increase height so its above the ground. | 1847 | //increase height so its above the ground. |
1819 | //should be getting the normal of the ground at the rez point and using that? | 1848 | //should be getting the normal of the ground at the rez point and using that? |
1820 | pos.Z += scale.Z / 2f; | 1849 | pos.Z += scale.Z / 2f; |
1821 | return pos; | 1850 | // return pos; |
1822 | } | 1851 | } |
1852 | |||
1853 | // check against posible water intercept | ||
1854 | if (wpos.Z > pos.Z) pos = wpos; | ||
1855 | return pos; | ||
1823 | } | 1856 | } |
1824 | 1857 | ||
1825 | 1858 | ||
@@ -1899,7 +1932,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1899 | public bool AddRestoredSceneObject( | 1932 | public bool AddRestoredSceneObject( |
1900 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 1933 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
1901 | { | 1934 | { |
1902 | return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); | 1935 | bool result = m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); |
1936 | if (result) | ||
1937 | sceneObject.IsDeleted = false; | ||
1938 | return result; | ||
1903 | } | 1939 | } |
1904 | 1940 | ||
1905 | /// <summary> | 1941 | /// <summary> |
@@ -1976,6 +2012,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1976 | /// </summary> | 2012 | /// </summary> |
1977 | public void DeleteAllSceneObjects() | 2013 | public void DeleteAllSceneObjects() |
1978 | { | 2014 | { |
2015 | DeleteAllSceneObjects(false); | ||
2016 | } | ||
2017 | |||
2018 | /// <summary> | ||
2019 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2020 | /// </summary> | ||
2021 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2022 | { | ||
2023 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
1979 | lock (Entities) | 2024 | lock (Entities) |
1980 | { | 2025 | { |
1981 | EntityBase[] entities = Entities.GetEntities(); | 2026 | EntityBase[] entities = Entities.GetEntities(); |
@@ -1984,11 +2029,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1984 | if (e is SceneObjectGroup) | 2029 | if (e is SceneObjectGroup) |
1985 | { | 2030 | { |
1986 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2031 | SceneObjectGroup sog = (SceneObjectGroup)e; |
1987 | if (!sog.IsAttachment) | 2032 | if (sog != null && !sog.IsAttachment) |
1988 | DeleteSceneObject((SceneObjectGroup)e, false); | 2033 | { |
2034 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2035 | { | ||
2036 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2037 | } | ||
2038 | else | ||
2039 | { | ||
2040 | toReturn.Add((SceneObjectGroup)e); | ||
2041 | } | ||
2042 | } | ||
1989 | } | 2043 | } |
1990 | } | 2044 | } |
1991 | } | 2045 | } |
2046 | if (toReturn.Count > 0) | ||
2047 | { | ||
2048 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2049 | } | ||
1992 | } | 2050 | } |
1993 | 2051 | ||
1994 | /// <summary> | 2052 | /// <summary> |
@@ -2037,6 +2095,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2037 | } | 2095 | } |
2038 | 2096 | ||
2039 | group.DeleteGroupFromScene(silent); | 2097 | group.DeleteGroupFromScene(silent); |
2098 | if (!silent) | ||
2099 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2040 | 2100 | ||
2041 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2101 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2042 | } | 2102 | } |
@@ -2364,6 +2424,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2364 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2424 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2365 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2425 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2366 | { | 2426 | { |
2427 | if (sceneObject.OwnerID == UUID.Zero) | ||
2428 | { | ||
2429 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2430 | return false; | ||
2431 | } | ||
2432 | |||
2367 | // If the user is banned, we won't let any of their objects | 2433 | // If the user is banned, we won't let any of their objects |
2368 | // enter. Period. | 2434 | // enter. Period. |
2369 | // | 2435 | // |
@@ -2411,15 +2477,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
2411 | 2477 | ||
2412 | if (AttachmentsModule != null) | 2478 | if (AttachmentsModule != null) |
2413 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); | 2479 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); |
2480 | |||
2481 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was found, attaching", sceneObject.UUID); | ||
2414 | } | 2482 | } |
2415 | else | 2483 | else |
2416 | { | 2484 | { |
2485 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2417 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2486 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2418 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2487 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2419 | } | 2488 | } |
2489 | if (sceneObject.OwnerID == UUID.Zero) | ||
2490 | { | ||
2491 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2492 | return false; | ||
2493 | } | ||
2420 | } | 2494 | } |
2421 | else | 2495 | else |
2422 | { | 2496 | { |
2497 | if (sceneObject.OwnerID == UUID.Zero) | ||
2498 | { | ||
2499 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2500 | return false; | ||
2501 | } | ||
2423 | AddRestoredSceneObject(sceneObject, true, false); | 2502 | AddRestoredSceneObject(sceneObject, true, false); |
2424 | 2503 | ||
2425 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | 2504 | if (!Permissions.CanObjectEntry(sceneObject.UUID, |
@@ -2531,12 +2610,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2531 | } | 2610 | } |
2532 | } | 2611 | } |
2533 | 2612 | ||
2534 | if (GetScenePresence(client.AgentId) != null) | 2613 | if (TryGetScenePresence(client.AgentId, out presence)) |
2535 | { | 2614 | { |
2536 | m_LastLogin = Util.EnvironmentTickCount(); | 2615 | m_LastLogin = Util.EnvironmentTickCount(); |
2537 | EventManager.TriggerOnNewClient(client); | 2616 | EventManager.TriggerOnNewClient(client); |
2538 | if (vialogin) | 2617 | if (vialogin) |
2618 | { | ||
2539 | EventManager.TriggerOnClientLogin(client); | 2619 | EventManager.TriggerOnClientLogin(client); |
2620 | |||
2621 | // Send initial parcel data | ||
2622 | Vector3 pos = presence.AbsolutePosition; | ||
2623 | ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); | ||
2624 | land.SendLandUpdateToClient(presence.ControllingClient); | ||
2625 | } | ||
2540 | } | 2626 | } |
2541 | } | 2627 | } |
2542 | 2628 | ||
@@ -2691,6 +2777,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2691 | client.OnFetchInventory += HandleFetchInventory; | 2777 | client.OnFetchInventory += HandleFetchInventory; |
2692 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 2778 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
2693 | client.OnCopyInventoryItem += CopyInventoryItem; | 2779 | client.OnCopyInventoryItem += CopyInventoryItem; |
2780 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
2694 | client.OnMoveInventoryItem += MoveInventoryItem; | 2781 | client.OnMoveInventoryItem += MoveInventoryItem; |
2695 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 2782 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
2696 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 2783 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -2869,15 +2956,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2869 | /// </summary> | 2956 | /// </summary> |
2870 | /// <param name="agentId">The avatar's Unique ID</param> | 2957 | /// <param name="agentId">The avatar's Unique ID</param> |
2871 | /// <param name="client">The IClientAPI for the client</param> | 2958 | /// <param name="client">The IClientAPI for the client</param> |
2872 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 2959 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
2873 | { | 2960 | { |
2874 | if (m_teleportModule != null) | 2961 | if (m_teleportModule != null) |
2875 | m_teleportModule.TeleportHome(agentId, client); | 2962 | return m_teleportModule.TeleportHome(agentId, client); |
2876 | else | 2963 | else |
2877 | { | 2964 | { |
2878 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 2965 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
2879 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 2966 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
2880 | } | 2967 | } |
2968 | return false; | ||
2881 | } | 2969 | } |
2882 | 2970 | ||
2883 | /// <summary> | 2971 | /// <summary> |
@@ -2976,6 +3064,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2976 | /// <param name="flags"></param> | 3064 | /// <param name="flags"></param> |
2977 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3065 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
2978 | { | 3066 | { |
3067 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3068 | ScenePresence presence; | ||
3069 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3070 | { | ||
3071 | if (presence.Appearance != null) | ||
3072 | { | ||
3073 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3074 | } | ||
3075 | } | ||
3076 | |||
2979 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3077 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
2980 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3078 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
2981 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3079 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3069,7 +3167,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3069 | regions.Remove(RegionInfo.RegionHandle); | 3167 | regions.Remove(RegionInfo.RegionHandle); |
3070 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3168 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3071 | } | 3169 | } |
3170 | m_log.Debug("[Scene] Beginning ClientClosed"); | ||
3072 | m_eventManager.TriggerClientClosed(agentID, this); | 3171 | m_eventManager.TriggerClientClosed(agentID, this); |
3172 | m_log.Debug("[Scene] Finished ClientClosed"); | ||
3073 | } | 3173 | } |
3074 | catch (NullReferenceException) | 3174 | catch (NullReferenceException) |
3075 | { | 3175 | { |
@@ -3077,7 +3177,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3077 | // Avatar is already disposed :/ | 3177 | // Avatar is already disposed :/ |
3078 | } | 3178 | } |
3079 | 3179 | ||
3180 | m_log.Debug("[Scene] Beginning OnRemovePresence"); | ||
3080 | m_eventManager.TriggerOnRemovePresence(agentID); | 3181 | m_eventManager.TriggerOnRemovePresence(agentID); |
3182 | m_log.Debug("[Scene] Finished OnRemovePresence"); | ||
3183 | |||
3184 | if (avatar != null && (!avatar.IsChildAgent)) | ||
3185 | avatar.SaveChangedAttachments(); | ||
3081 | 3186 | ||
3082 | if (avatar != null && (!avatar.IsChildAgent)) | 3187 | if (avatar != null && (!avatar.IsChildAgent)) |
3083 | avatar.SaveChangedAttachments(); | 3188 | avatar.SaveChangedAttachments(); |
@@ -3086,7 +3191,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3086 | delegate(IClientAPI client) | 3191 | delegate(IClientAPI client) |
3087 | { | 3192 | { |
3088 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway | 3193 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway |
3089 | try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); } | 3194 | try { client.SendKillObject(avatar.RegionHandle, new List<uint>() { avatar.LocalId}); } |
3090 | catch (NullReferenceException) { } | 3195 | catch (NullReferenceException) { } |
3091 | }); | 3196 | }); |
3092 | 3197 | ||
@@ -3097,8 +3202,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3097 | } | 3202 | } |
3098 | 3203 | ||
3099 | // Remove the avatar from the scene | 3204 | // Remove the avatar from the scene |
3205 | m_log.Debug("[Scene] Begin RemoveScenePresence"); | ||
3100 | m_sceneGraph.RemoveScenePresence(agentID); | 3206 | m_sceneGraph.RemoveScenePresence(agentID); |
3207 | m_log.Debug("[Scene] Finished RemoveScenePresence. Removing the client manager"); | ||
3101 | m_clientManager.Remove(agentID); | 3208 | m_clientManager.Remove(agentID); |
3209 | m_log.Debug("[Scene] Removed the client manager. Firing avatar.close"); | ||
3102 | 3210 | ||
3103 | try | 3211 | try |
3104 | { | 3212 | { |
@@ -3112,9 +3220,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3112 | { | 3220 | { |
3113 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); | 3221 | m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); |
3114 | } | 3222 | } |
3115 | 3223 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); | |
3116 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3224 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3117 | CleanDroppedAttachments(); | 3225 | CleanDroppedAttachments(); |
3226 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3118 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3227 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
3119 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 3228 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
3120 | } | 3229 | } |
@@ -3145,18 +3254,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
3145 | 3254 | ||
3146 | #region Entities | 3255 | #region Entities |
3147 | 3256 | ||
3148 | public void SendKillObject(uint localID) | 3257 | public void SendKillObject(List<uint> localIDs) |
3149 | { | 3258 | { |
3150 | SceneObjectPart part = GetSceneObjectPart(localID); | 3259 | List<uint> deleteIDs = new List<uint>(); |
3151 | if (part != null) // It is a prim | 3260 | |
3261 | foreach (uint localID in localIDs) | ||
3152 | { | 3262 | { |
3153 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid | 3263 | SceneObjectPart part = GetSceneObjectPart(localID); |
3264 | if (part != null) // It is a prim | ||
3154 | { | 3265 | { |
3155 | if (part.ParentGroup.RootPart != part) // Child part | 3266 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid |
3156 | return; | 3267 | { |
3268 | if (part.ParentGroup.RootPart != part) // Child part | ||
3269 | continue; | ||
3270 | } | ||
3157 | } | 3271 | } |
3272 | deleteIDs.Add(localID); | ||
3158 | } | 3273 | } |
3159 | ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); | 3274 | ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, deleteIDs); }); |
3160 | } | 3275 | } |
3161 | 3276 | ||
3162 | #endregion | 3277 | #endregion |
@@ -3174,7 +3289,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3174 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | 3289 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; |
3175 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; | 3290 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; |
3176 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; | 3291 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; |
3177 | m_sceneGridService.KiPrimitive += SendKillObject; | ||
3178 | m_sceneGridService.OnGetLandData += GetLandData; | 3292 | m_sceneGridService.OnGetLandData += GetLandData; |
3179 | } | 3293 | } |
3180 | 3294 | ||
@@ -3183,7 +3297,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3183 | /// </summary> | 3297 | /// </summary> |
3184 | public void UnRegisterRegionWithComms() | 3298 | public void UnRegisterRegionWithComms() |
3185 | { | 3299 | { |
3186 | m_sceneGridService.KiPrimitive -= SendKillObject; | ||
3187 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; | 3300 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; |
3188 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; | 3301 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; |
3189 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | 3302 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; |
@@ -3270,6 +3383,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3270 | { | 3383 | { |
3271 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3384 | if (land != null && !TestLandRestrictions(agent, land, out reason)) |
3272 | { | 3385 | { |
3386 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3273 | return false; | 3387 | return false; |
3274 | } | 3388 | } |
3275 | } | 3389 | } |
@@ -3387,6 +3501,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3387 | } | 3501 | } |
3388 | } | 3502 | } |
3389 | // Honor parcel landing type and position. | 3503 | // Honor parcel landing type and position. |
3504 | /* | ||
3505 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3390 | if (land != null) | 3506 | if (land != null) |
3391 | { | 3507 | { |
3392 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3508 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3394,6 +3510,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3394 | agent.startpos = land.LandData.UserLocation; | 3510 | agent.startpos = land.LandData.UserLocation; |
3395 | } | 3511 | } |
3396 | } | 3512 | } |
3513 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3397 | } | 3514 | } |
3398 | 3515 | ||
3399 | return true; | 3516 | return true; |
@@ -3489,7 +3606,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3489 | 3606 | ||
3490 | if (m_regInfo.EstateSettings != null) | 3607 | if (m_regInfo.EstateSettings != null) |
3491 | { | 3608 | { |
3492 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) | 3609 | if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID)) |
3493 | { | 3610 | { |
3494 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 3611 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3495 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 3612 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -3679,6 +3796,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3679 | 3796 | ||
3680 | // We have to wait until the viewer contacts this region after receiving EAC. | 3797 | // We have to wait until the viewer contacts this region after receiving EAC. |
3681 | // That calls AddNewClient, which finally creates the ScenePresence | 3798 | // That calls AddNewClient, which finally creates the ScenePresence |
3799 | if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID)) | ||
3800 | { | ||
3801 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
3802 | return false; | ||
3803 | } | ||
3804 | |||
3682 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 3805 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
3683 | if (nearestParcel == null) | 3806 | if (nearestParcel == null) |
3684 | { | 3807 | { |
@@ -3686,6 +3809,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3686 | return false; | 3809 | return false; |
3687 | } | 3810 | } |
3688 | 3811 | ||
3812 | int num = m_sceneGraph.GetNumberOfScenePresences(); | ||
3813 | |||
3814 | if (num >= RegionInfo.RegionSettings.AgentLimit) | ||
3815 | { | ||
3816 | if (!Permissions.IsAdministrator(cAgentData.AgentID)) | ||
3817 | return false; | ||
3818 | } | ||
3819 | |||
3689 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); | 3820 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); |
3690 | if (childAgentUpdate != null) | 3821 | if (childAgentUpdate != null) |
3691 | { | 3822 | { |
@@ -3751,12 +3882,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3751 | return false; | 3882 | return false; |
3752 | } | 3883 | } |
3753 | 3884 | ||
3885 | public bool IncomingCloseAgent(UUID agentID) | ||
3886 | { | ||
3887 | return IncomingCloseAgent(agentID, false); | ||
3888 | } | ||
3889 | |||
3890 | public bool IncomingCloseChildAgent(UUID agentID) | ||
3891 | { | ||
3892 | return IncomingCloseAgent(agentID, true); | ||
3893 | } | ||
3894 | |||
3754 | /// <summary> | 3895 | /// <summary> |
3755 | /// Tell a single agent to disconnect from the region. | 3896 | /// Tell a single agent to disconnect from the region. |
3756 | /// </summary> | 3897 | /// </summary> |
3757 | /// <param name="regionHandle"></param> | ||
3758 | /// <param name="agentID"></param> | 3898 | /// <param name="agentID"></param> |
3759 | public bool IncomingCloseAgent(UUID agentID) | 3899 | /// <param name="childOnly"></param> |
3900 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) | ||
3760 | { | 3901 | { |
3761 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 3902 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
3762 | 3903 | ||
@@ -3768,7 +3909,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3768 | { | 3909 | { |
3769 | m_sceneGraph.removeUserCount(false); | 3910 | m_sceneGraph.removeUserCount(false); |
3770 | } | 3911 | } |
3771 | else | 3912 | else if (!childOnly) |
3772 | { | 3913 | { |
3773 | m_sceneGraph.removeUserCount(true); | 3914 | m_sceneGraph.removeUserCount(true); |
3774 | } | 3915 | } |
@@ -3784,9 +3925,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3784 | } | 3925 | } |
3785 | else | 3926 | else |
3786 | presence.ControllingClient.SendShutdownConnectionNotice(); | 3927 | presence.ControllingClient.SendShutdownConnectionNotice(); |
3928 | presence.ControllingClient.Close(false); | ||
3929 | } | ||
3930 | else if (!childOnly) | ||
3931 | { | ||
3932 | presence.ControllingClient.Close(true); | ||
3787 | } | 3933 | } |
3788 | |||
3789 | presence.ControllingClient.Close(); | ||
3790 | return true; | 3934 | return true; |
3791 | } | 3935 | } |
3792 | 3936 | ||
@@ -4408,7 +4552,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4408 | // | 4552 | // |
4409 | int health=1; // Start at 1, means we're up | 4553 | int health=1; // Start at 1, means we're up |
4410 | 4554 | ||
4411 | if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) | 4555 | if (m_firstHeartbeat || ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)) |
4412 | health+=1; | 4556 | health+=1; |
4413 | else | 4557 | else |
4414 | return health; | 4558 | return health; |
@@ -4871,8 +5015,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4871 | { | 5015 | { |
4872 | float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; | 5016 | float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; |
4873 | 5017 | ||
5018 | Vector3 vec = g.AbsolutePosition; | ||
5019 | |||
4874 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); | 5020 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); |
4875 | 5021 | ||
5022 | ominX += vec.X; | ||
5023 | omaxX += vec.X; | ||
5024 | ominY += vec.Y; | ||
5025 | omaxY += vec.Y; | ||
5026 | ominZ += vec.Z; | ||
5027 | omaxZ += vec.Z; | ||
5028 | |||
4876 | if (minX > ominX) | 5029 | if (minX > ominX) |
4877 | minX = ominX; | 5030 | minX = ominX; |
4878 | if (minY > ominY) | 5031 | if (minY > ominY) |
@@ -4942,10 +5095,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4942 | }); | 5095 | }); |
4943 | } | 5096 | } |
4944 | 5097 | ||
4945 | foreach (SceneObjectGroup grp in objectsToDelete) | 5098 | if (objectsToDelete.Count > 0) |
4946 | { | 5099 | { |
4947 | m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | 5100 | m_log.DebugFormat("[SCENE]: Starting delete of {0} dropped attachments", objectsToDelete.Count); |
4948 | DeleteSceneObject(grp, true); | 5101 | foreach (SceneObjectGroup grp in objectsToDelete) |
5102 | { | ||
5103 | m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5104 | DeleteSceneObject(grp, true); | ||
5105 | } | ||
5106 | m_log.Debug("[SCENE]: Finished dropped attachment deletion"); | ||
4949 | } | 5107 | } |
4950 | } | 5108 | } |
4951 | } | 5109 | } |