aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs256
1 files changed, 213 insertions, 43 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 96a9f99..a0ae82f 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;
@@ -218,6 +221,19 @@ namespace OpenSim.Region.Framework.Scenes
218 get { return m_sceneGridService; } 221 get { return m_sceneGridService; }
219 } 222 }
220 223
224 public ISnmpModule SnmpService
225 {
226 get
227 {
228 if (m_snmpService == null)
229 {
230 m_snmpService = RequestModuleInterface<ISnmpModule>();
231 }
232
233 return m_snmpService;
234 }
235 }
236
221 public ISimulationDataService SimulationDataService 237 public ISimulationDataService SimulationDataService
222 { 238 {
223 get 239 get
@@ -562,6 +578,8 @@ namespace OpenSim.Region.Framework.Scenes
562 #region Region Settings 578 #region Region Settings
563 579
564 // Load region settings 580 // Load region settings
581 m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID);
582
565 m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); 583 m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID);
566 if (estateDataService != null) 584 if (estateDataService != null)
567 m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); 585 m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
@@ -621,9 +639,10 @@ namespace OpenSim.Region.Framework.Scenes
621 //Animation states 639 //Animation states
622 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 640 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
623 // TODO: Change default to true once the feature is supported 641 // TODO: Change default to true once the feature is supported
624 m_usePreJump = startupConfig.GetBoolean("enableprejump", false); 642 m_usePreJump = startupConfig.GetBoolean("enableprejump", true);
625
626 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); 643 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
644
645 m_log.DebugFormat("[SCENE]: prejump is {0}", m_usePreJump ? "ON" : "OFF");
627 if (RegionInfo.NonphysPrimMax > 0) 646 if (RegionInfo.NonphysPrimMax > 0)
628 { 647 {
629 m_maxNonphys = RegionInfo.NonphysPrimMax; 648 m_maxNonphys = RegionInfo.NonphysPrimMax;
@@ -655,6 +674,7 @@ namespace OpenSim.Region.Framework.Scenes
655 m_persistAfter *= 10000000; 674 m_persistAfter *= 10000000;
656 675
657 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); 676 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
677 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
658 678
659 IConfig packetConfig = m_config.Configs["PacketPool"]; 679 IConfig packetConfig = m_config.Configs["PacketPool"];
660 if (packetConfig != null) 680 if (packetConfig != null)
@@ -664,6 +684,8 @@ namespace OpenSim.Region.Framework.Scenes
664 } 684 }
665 685
666 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); 686 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
687 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
688 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
667 689
668 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); 690 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
669 if (m_generateMaptiles) 691 if (m_generateMaptiles)
@@ -688,9 +710,9 @@ namespace OpenSim.Region.Framework.Scenes
688 } 710 }
689 } 711 }
690 } 712 }
691 catch 713 catch (Exception e)
692 { 714 {
693 m_log.Warn("[SCENE]: Failed to load StartupConfig"); 715 m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString());
694 } 716 }
695 717
696 #endregion Region Config 718 #endregion Region Config
@@ -927,6 +949,15 @@ namespace OpenSim.Region.Framework.Scenes
927 /// <param name="seconds">float indicating duration before restart.</param> 949 /// <param name="seconds">float indicating duration before restart.</param>
928 public virtual void Restart(float seconds) 950 public virtual void Restart(float seconds)
929 { 951 {
952 Restart(seconds, true);
953 }
954
955 /// <summary>
956 /// Given float seconds, this will restart the region. showDialog will optionally alert the users.
957 /// </summary>
958 /// <param name="seconds">float indicating duration before restart.</param>
959 public virtual void Restart(float seconds, bool showDialog)
960 {
930 // notifications are done in 15 second increments 961 // notifications are done in 15 second increments
931 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request 962 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request
932 // It's a 'Cancel restart' request. 963 // It's a 'Cancel restart' request.
@@ -947,8 +978,11 @@ namespace OpenSim.Region.Framework.Scenes
947 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); 978 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
948 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); 979 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
949 m_restartTimer.Start(); 980 m_restartTimer.Start();
950 m_dialogModule.SendNotificationToUsersInRegion( 981 if (showDialog)
982 {
983 m_dialogModule.SendNotificationToUsersInRegion(
951 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0))); 984 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0)));
985 }
952 } 986 }
953 } 987 }
954 988
@@ -1144,6 +1178,7 @@ namespace OpenSim.Region.Framework.Scenes
1144 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); 1178 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
1145 if (HeartbeatThread != null) 1179 if (HeartbeatThread != null)
1146 { 1180 {
1181 m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName);
1147 HeartbeatThread.Abort(); 1182 HeartbeatThread.Abort();
1148 HeartbeatThread = null; 1183 HeartbeatThread = null;
1149 } 1184 }
@@ -1815,14 +1850,24 @@ namespace OpenSim.Region.Framework.Scenes
1815 /// <returns></returns> 1850 /// <returns></returns>
1816 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) 1851 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
1817 { 1852 {
1853
1854 float wheight = (float)RegionInfo.RegionSettings.WaterHeight;
1855 Vector3 wpos = Vector3.Zero;
1856 // Check for water surface intersection from above
1857 if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) )
1858 {
1859 float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z);
1860 wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X));
1861 wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y));
1862 wpos.Z = wheight;
1863 }
1864
1818 Vector3 pos = Vector3.Zero; 1865 Vector3 pos = Vector3.Zero;
1819 if (RayEndIsIntersection == (byte)1) 1866 if (RayEndIsIntersection == (byte)1)
1820 { 1867 {
1821 pos = RayEnd; 1868 pos = RayEnd;
1822 return pos;
1823 } 1869 }
1824 1870 else if (RayTargetID != UUID.Zero)
1825 if (RayTargetID != UUID.Zero)
1826 { 1871 {
1827 SceneObjectPart target = GetSceneObjectPart(RayTargetID); 1872 SceneObjectPart target = GetSceneObjectPart(RayTargetID);
1828 1873
@@ -1844,7 +1889,7 @@ namespace OpenSim.Region.Framework.Scenes
1844 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); 1889 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter);
1845 1890
1846 // Un-comment out the following line to Get Raytrace results printed to the console. 1891 // Un-comment out the following line to Get Raytrace results printed to the console.
1847 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); 1892 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
1848 float ScaleOffset = 0.5f; 1893 float ScaleOffset = 0.5f;
1849 1894
1850 // If we hit something 1895 // If we hit something
@@ -1867,13 +1912,10 @@ namespace OpenSim.Region.Framework.Scenes
1867 //pos.Z -= 0.25F; 1912 //pos.Z -= 0.25F;
1868 1913
1869 } 1914 }
1870
1871 return pos;
1872 } 1915 }
1873 else 1916 else
1874 { 1917 {
1875 // We don't have a target here, so we're going to raytrace all the objects in the scene. 1918 // We don't have a target here, so we're going to raytrace all the objects in the scene.
1876
1877 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); 1919 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false);
1878 1920
1879 // Un-comment the following line to print the raytrace results to the console. 1921 // Un-comment the following line to print the raytrace results to the console.
@@ -1882,13 +1924,12 @@ namespace OpenSim.Region.Framework.Scenes
1882 if (ei.HitTF) 1924 if (ei.HitTF)
1883 { 1925 {
1884 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 1926 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
1885 } else 1927 }
1928 else
1886 { 1929 {
1887 // fall back to our stupid functionality 1930 // fall back to our stupid functionality
1888 pos = RayEnd; 1931 pos = RayEnd;
1889 } 1932 }
1890
1891 return pos;
1892 } 1933 }
1893 } 1934 }
1894 else 1935 else
@@ -1899,8 +1940,12 @@ namespace OpenSim.Region.Framework.Scenes
1899 //increase height so its above the ground. 1940 //increase height so its above the ground.
1900 //should be getting the normal of the ground at the rez point and using that? 1941 //should be getting the normal of the ground at the rez point and using that?
1901 pos.Z += scale.Z / 2f; 1942 pos.Z += scale.Z / 2f;
1902 return pos; 1943// return pos;
1903 } 1944 }
1945
1946 // check against posible water intercept
1947 if (wpos.Z > pos.Z) pos = wpos;
1948 return pos;
1904 } 1949 }
1905 1950
1906 1951
@@ -1980,7 +2025,10 @@ namespace OpenSim.Region.Framework.Scenes
1980 public bool AddRestoredSceneObject( 2025 public bool AddRestoredSceneObject(
1981 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) 2026 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
1982 { 2027 {
1983 return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); 2028 bool result = m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates);
2029 if (result)
2030 sceneObject.IsDeleted = false;
2031 return result;
1984 } 2032 }
1985 2033
1986 /// <summary> 2034 /// <summary>
@@ -2057,6 +2105,15 @@ namespace OpenSim.Region.Framework.Scenes
2057 /// </summary> 2105 /// </summary>
2058 public void DeleteAllSceneObjects() 2106 public void DeleteAllSceneObjects()
2059 { 2107 {
2108 DeleteAllSceneObjects(false);
2109 }
2110
2111 /// <summary>
2112 /// Delete every object from the scene. This does not include attachments worn by avatars.
2113 /// </summary>
2114 public void DeleteAllSceneObjects(bool exceptNoCopy)
2115 {
2116 List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
2060 lock (Entities) 2117 lock (Entities)
2061 { 2118 {
2062 EntityBase[] entities = Entities.GetEntities(); 2119 EntityBase[] entities = Entities.GetEntities();
@@ -2065,11 +2122,24 @@ namespace OpenSim.Region.Framework.Scenes
2065 if (e is SceneObjectGroup) 2122 if (e is SceneObjectGroup)
2066 { 2123 {
2067 SceneObjectGroup sog = (SceneObjectGroup)e; 2124 SceneObjectGroup sog = (SceneObjectGroup)e;
2068 if (!sog.IsAttachment) 2125 if (sog != null && !sog.IsAttachment)
2069 DeleteSceneObject((SceneObjectGroup)e, false); 2126 {
2127 if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0))
2128 {
2129 DeleteSceneObject((SceneObjectGroup)e, false);
2130 }
2131 else
2132 {
2133 toReturn.Add((SceneObjectGroup)e);
2134 }
2135 }
2070 } 2136 }
2071 } 2137 }
2072 } 2138 }
2139 if (toReturn.Count > 0)
2140 {
2141 returnObjects(toReturn.ToArray(), UUID.Zero);
2142 }
2073 } 2143 }
2074 2144
2075 /// <summary> 2145 /// <summary>
@@ -2118,6 +2188,8 @@ namespace OpenSim.Region.Framework.Scenes
2118 } 2188 }
2119 2189
2120 group.DeleteGroupFromScene(silent); 2190 group.DeleteGroupFromScene(silent);
2191 if (!silent)
2192 SendKillObject(new List<uint>() { group.LocalId });
2121 2193
2122// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); 2194// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
2123 } 2195 }
@@ -2447,6 +2519,12 @@ namespace OpenSim.Region.Framework.Scenes
2447 /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> 2519 /// <returns>True if the SceneObjectGroup was added, False if it was not</returns>
2448 public bool AddSceneObject(SceneObjectGroup sceneObject) 2520 public bool AddSceneObject(SceneObjectGroup sceneObject)
2449 { 2521 {
2522 if (sceneObject.OwnerID == UUID.Zero)
2523 {
2524 m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID);
2525 return false;
2526 }
2527
2450 // If the user is banned, we won't let any of their objects 2528 // If the user is banned, we won't let any of their objects
2451 // enter. Period. 2529 // enter. Period.
2452 // 2530 //
@@ -2494,15 +2572,28 @@ namespace OpenSim.Region.Framework.Scenes
2494 2572
2495 if (AttachmentsModule != null) 2573 if (AttachmentsModule != null)
2496 AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); 2574 AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false);
2575
2576 m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was found, attaching", sceneObject.UUID);
2497 } 2577 }
2498 else 2578 else
2499 { 2579 {
2580 m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID);
2500 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 2581 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2501 RootPrim.AddFlag(PrimFlags.TemporaryOnRez); 2582 RootPrim.AddFlag(PrimFlags.TemporaryOnRez);
2502 } 2583 }
2584 if (sceneObject.OwnerID == UUID.Zero)
2585 {
2586 m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID);
2587 return false;
2588 }
2503 } 2589 }
2504 else 2590 else
2505 { 2591 {
2592 if (sceneObject.OwnerID == UUID.Zero)
2593 {
2594 m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID);
2595 return false;
2596 }
2506 AddRestoredSceneObject(sceneObject, true, false); 2597 AddRestoredSceneObject(sceneObject, true, false);
2507 2598
2508 if (!Permissions.CanObjectEntry(sceneObject.UUID, 2599 if (!Permissions.CanObjectEntry(sceneObject.UUID,
@@ -2615,12 +2706,19 @@ namespace OpenSim.Region.Framework.Scenes
2615 } 2706 }
2616 } 2707 }
2617 2708
2618 if (GetScenePresence(client.AgentId) != null) 2709 if (TryGetScenePresence(client.AgentId, out presence))
2619 { 2710 {
2620 m_LastLogin = Util.EnvironmentTickCount(); 2711 m_LastLogin = Util.EnvironmentTickCount();
2621 EventManager.TriggerOnNewClient(client); 2712 EventManager.TriggerOnNewClient(client);
2622 if (vialogin) 2713 if (vialogin)
2714 {
2623 EventManager.TriggerOnClientLogin(client); 2715 EventManager.TriggerOnClientLogin(client);
2716
2717 // Send initial parcel data
2718 Vector3 pos = presence.AbsolutePosition;
2719 ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y);
2720 land.SendLandUpdateToClient(presence.ControllingClient);
2721 }
2624 } 2722 }
2625 } 2723 }
2626 2724
@@ -2775,6 +2873,7 @@ namespace OpenSim.Region.Framework.Scenes
2775 client.OnFetchInventory += HandleFetchInventory; 2873 client.OnFetchInventory += HandleFetchInventory;
2776 client.OnUpdateInventoryItem += UpdateInventoryItemAsset; 2874 client.OnUpdateInventoryItem += UpdateInventoryItemAsset;
2777 client.OnCopyInventoryItem += CopyInventoryItem; 2875 client.OnCopyInventoryItem += CopyInventoryItem;
2876 client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy;
2778 client.OnMoveInventoryItem += MoveInventoryItem; 2877 client.OnMoveInventoryItem += MoveInventoryItem;
2779 client.OnRemoveInventoryItem += RemoveInventoryItem; 2878 client.OnRemoveInventoryItem += RemoveInventoryItem;
2780 client.OnRemoveInventoryFolder += RemoveInventoryFolder; 2879 client.OnRemoveInventoryFolder += RemoveInventoryFolder;
@@ -2953,15 +3052,16 @@ namespace OpenSim.Region.Framework.Scenes
2953 /// </summary> 3052 /// </summary>
2954 /// <param name="agentId">The avatar's Unique ID</param> 3053 /// <param name="agentId">The avatar's Unique ID</param>
2955 /// <param name="client">The IClientAPI for the client</param> 3054 /// <param name="client">The IClientAPI for the client</param>
2956 public virtual void TeleportClientHome(UUID agentId, IClientAPI client) 3055 public virtual bool TeleportClientHome(UUID agentId, IClientAPI client)
2957 { 3056 {
2958 if (m_teleportModule != null) 3057 if (m_teleportModule != null)
2959 m_teleportModule.TeleportHome(agentId, client); 3058 return m_teleportModule.TeleportHome(agentId, client);
2960 else 3059 else
2961 { 3060 {
2962 m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); 3061 m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active");
2963 client.SendTeleportFailed("Unable to perform teleports on this simulator."); 3062 client.SendTeleportFailed("Unable to perform teleports on this simulator.");
2964 } 3063 }
3064 return false;
2965 } 3065 }
2966 3066
2967 /// <summary> 3067 /// <summary>
@@ -3060,6 +3160,16 @@ namespace OpenSim.Region.Framework.Scenes
3060 /// <param name="flags"></param> 3160 /// <param name="flags"></param>
3061 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 3161 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3062 { 3162 {
3163 //Add half the avatar's height so that the user doesn't fall through prims
3164 ScenePresence presence;
3165 if (TryGetScenePresence(remoteClient.AgentId, out presence))
3166 {
3167 if (presence.Appearance != null)
3168 {
3169 position.Z = position.Z + (presence.Appearance.AvatarHeight / 2);
3170 }
3171 }
3172
3063 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) 3173 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3064 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 3174 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3065 m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); 3175 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
@@ -3153,7 +3263,9 @@ namespace OpenSim.Region.Framework.Scenes
3153 regions.Remove(RegionInfo.RegionHandle); 3263 regions.Remove(RegionInfo.RegionHandle);
3154 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); 3264 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
3155 } 3265 }
3266 m_log.Debug("[Scene] Beginning ClientClosed");
3156 m_eventManager.TriggerClientClosed(agentID, this); 3267 m_eventManager.TriggerClientClosed(agentID, this);
3268 m_log.Debug("[Scene] Finished ClientClosed");
3157 } 3269 }
3158 catch (NullReferenceException) 3270 catch (NullReferenceException)
3159 { 3271 {
@@ -3161,7 +3273,12 @@ namespace OpenSim.Region.Framework.Scenes
3161 // Avatar is already disposed :/ 3273 // Avatar is already disposed :/
3162 } 3274 }
3163 3275
3276 m_log.Debug("[Scene] Beginning OnRemovePresence");
3164 m_eventManager.TriggerOnRemovePresence(agentID); 3277 m_eventManager.TriggerOnRemovePresence(agentID);
3278 m_log.Debug("[Scene] Finished OnRemovePresence");
3279
3280 if (avatar != null && (!avatar.IsChildAgent))
3281 avatar.SaveChangedAttachments();
3165 3282
3166 if (avatar != null && (!avatar.IsChildAgent)) 3283 if (avatar != null && (!avatar.IsChildAgent))
3167 avatar.SaveChangedAttachments(); 3284 avatar.SaveChangedAttachments();
@@ -3170,7 +3287,7 @@ namespace OpenSim.Region.Framework.Scenes
3170 delegate(IClientAPI client) 3287 delegate(IClientAPI client)
3171 { 3288 {
3172 //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway 3289 //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway
3173 try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); } 3290 try { client.SendKillObject(avatar.RegionHandle, new List<uint>() { avatar.LocalId}); }
3174 catch (NullReferenceException) { } 3291 catch (NullReferenceException) { }
3175 }); 3292 });
3176 3293
@@ -3181,8 +3298,11 @@ namespace OpenSim.Region.Framework.Scenes
3181 } 3298 }
3182 3299
3183 // Remove the avatar from the scene 3300 // Remove the avatar from the scene
3301 m_log.Debug("[Scene] Begin RemoveScenePresence");
3184 m_sceneGraph.RemoveScenePresence(agentID); 3302 m_sceneGraph.RemoveScenePresence(agentID);
3303 m_log.Debug("[Scene] Finished RemoveScenePresence. Removing the client manager");
3185 m_clientManager.Remove(agentID); 3304 m_clientManager.Remove(agentID);
3305 m_log.Debug("[Scene] Removed the client manager. Firing avatar.close");
3186 3306
3187 try 3307 try
3188 { 3308 {
@@ -3196,9 +3316,10 @@ namespace OpenSim.Region.Framework.Scenes
3196 { 3316 {
3197 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString()); 3317 m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString());
3198 } 3318 }
3199 3319 m_log.Debug("[Scene] Done. Firing RemoveCircuit");
3200 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); 3320 m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
3201 CleanDroppedAttachments(); 3321 CleanDroppedAttachments();
3322 m_log.Debug("[Scene] The avatar has left the building");
3202 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); 3323 //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
3203 //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); 3324 //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
3204 } 3325 }
@@ -3229,18 +3350,24 @@ namespace OpenSim.Region.Framework.Scenes
3229 3350
3230 #region Entities 3351 #region Entities
3231 3352
3232 public void SendKillObject(uint localID) 3353 public void SendKillObject(List<uint> localIDs)
3233 { 3354 {
3234 SceneObjectPart part = GetSceneObjectPart(localID); 3355 List<uint> deleteIDs = new List<uint>();
3235 if (part != null) // It is a prim 3356
3357 foreach (uint localID in localIDs)
3236 { 3358 {
3237 if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid 3359 SceneObjectPart part = GetSceneObjectPart(localID);
3360 if (part != null) // It is a prim
3238 { 3361 {
3239 if (part.ParentGroup.RootPart != part) // Child part 3362 if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid
3240 return; 3363 {
3364 if (part.ParentGroup.RootPart != part) // Child part
3365 continue;
3366 }
3241 } 3367 }
3368 deleteIDs.Add(localID);
3242 } 3369 }
3243 ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); 3370 ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, deleteIDs); });
3244 } 3371 }
3245 3372
3246 #endregion 3373 #endregion
@@ -3258,7 +3385,6 @@ namespace OpenSim.Region.Framework.Scenes
3258 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; 3385 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
3259 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; 3386 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
3260 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; 3387 m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
3261 m_sceneGridService.KiPrimitive += SendKillObject;
3262 m_sceneGridService.OnGetLandData += GetLandData; 3388 m_sceneGridService.OnGetLandData += GetLandData;
3263 } 3389 }
3264 3390
@@ -3267,7 +3393,6 @@ namespace OpenSim.Region.Framework.Scenes
3267 /// </summary> 3393 /// </summary>
3268 public void UnRegisterRegionWithComms() 3394 public void UnRegisterRegionWithComms()
3269 { 3395 {
3270 m_sceneGridService.KiPrimitive -= SendKillObject;
3271 m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; 3396 m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
3272 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; 3397 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
3273 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; 3398 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
@@ -3354,6 +3479,7 @@ namespace OpenSim.Region.Framework.Scenes
3354 { 3479 {
3355 if (land != null && !TestLandRestrictions(agent, land, out reason)) 3480 if (land != null && !TestLandRestrictions(agent, land, out reason))
3356 { 3481 {
3482 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString());
3357 return false; 3483 return false;
3358 } 3484 }
3359 } 3485 }
@@ -3471,6 +3597,8 @@ namespace OpenSim.Region.Framework.Scenes
3471 } 3597 }
3472 } 3598 }
3473 // Honor parcel landing type and position. 3599 // Honor parcel landing type and position.
3600 /*
3601 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3474 if (land != null) 3602 if (land != null)
3475 { 3603 {
3476 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) 3604 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
@@ -3478,6 +3606,7 @@ namespace OpenSim.Region.Framework.Scenes
3478 agent.startpos = land.LandData.UserLocation; 3606 agent.startpos = land.LandData.UserLocation;
3479 } 3607 }
3480 } 3608 }
3609 */// This is now handled properly in ScenePresence.MakeRootAgent
3481 } 3610 }
3482 3611
3483 return true; 3612 return true;
@@ -3573,7 +3702,7 @@ namespace OpenSim.Region.Framework.Scenes
3573 3702
3574 if (m_regInfo.EstateSettings != null) 3703 if (m_regInfo.EstateSettings != null)
3575 { 3704 {
3576 if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) 3705 if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID))
3577 { 3706 {
3578 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", 3707 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
3579 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3708 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
@@ -3763,6 +3892,12 @@ namespace OpenSim.Region.Framework.Scenes
3763 3892
3764 // We have to wait until the viewer contacts this region after receiving EAC. 3893 // We have to wait until the viewer contacts this region after receiving EAC.
3765 // That calls AddNewClient, which finally creates the ScenePresence 3894 // That calls AddNewClient, which finally creates the ScenePresence
3895 if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID))
3896 {
3897 m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID);
3898 return false;
3899 }
3900
3766 ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); 3901 ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2);
3767 if (nearestParcel == null) 3902 if (nearestParcel == null)
3768 { 3903 {
@@ -3770,6 +3905,14 @@ namespace OpenSim.Region.Framework.Scenes
3770 return false; 3905 return false;
3771 } 3906 }
3772 3907
3908 int num = m_sceneGraph.GetNumberOfScenePresences();
3909
3910 if (num >= RegionInfo.RegionSettings.AgentLimit)
3911 {
3912 if (!Permissions.IsAdministrator(cAgentData.AgentID))
3913 return false;
3914 }
3915
3773 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); 3916 ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
3774 if (childAgentUpdate != null) 3917 if (childAgentUpdate != null)
3775 { 3918 {
@@ -3835,12 +3978,22 @@ namespace OpenSim.Region.Framework.Scenes
3835 return false; 3978 return false;
3836 } 3979 }
3837 3980
3981 public bool IncomingCloseAgent(UUID agentID)
3982 {
3983 return IncomingCloseAgent(agentID, false);
3984 }
3985
3986 public bool IncomingCloseChildAgent(UUID agentID)
3987 {
3988 return IncomingCloseAgent(agentID, true);
3989 }
3990
3838 /// <summary> 3991 /// <summary>
3839 /// Tell a single agent to disconnect from the region. 3992 /// Tell a single agent to disconnect from the region.
3840 /// </summary> 3993 /// </summary>
3841 /// <param name="regionHandle"></param>
3842 /// <param name="agentID"></param> 3994 /// <param name="agentID"></param>
3843 public bool IncomingCloseAgent(UUID agentID) 3995 /// <param name="childOnly"></param>
3996 public bool IncomingCloseAgent(UUID agentID, bool childOnly)
3844 { 3997 {
3845 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 3998 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
3846 3999
@@ -3852,7 +4005,7 @@ namespace OpenSim.Region.Framework.Scenes
3852 { 4005 {
3853 m_sceneGraph.removeUserCount(false); 4006 m_sceneGraph.removeUserCount(false);
3854 } 4007 }
3855 else 4008 else if (!childOnly)
3856 { 4009 {
3857 m_sceneGraph.removeUserCount(true); 4010 m_sceneGraph.removeUserCount(true);
3858 } 4011 }
@@ -3868,9 +4021,12 @@ namespace OpenSim.Region.Framework.Scenes
3868 } 4021 }
3869 else 4022 else
3870 presence.ControllingClient.SendShutdownConnectionNotice(); 4023 presence.ControllingClient.SendShutdownConnectionNotice();
4024 presence.ControllingClient.Close(false);
4025 }
4026 else if (!childOnly)
4027 {
4028 presence.ControllingClient.Close(true);
3871 } 4029 }
3872
3873 presence.ControllingClient.Close();
3874 return true; 4030 return true;
3875 } 4031 }
3876 4032
@@ -4492,7 +4648,7 @@ namespace OpenSim.Region.Framework.Scenes
4492 // 4648 //
4493 int health=1; // Start at 1, means we're up 4649 int health=1; // Start at 1, means we're up
4494 4650
4495 if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) 4651 if (m_firstHeartbeat || ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000))
4496 health+=1; 4652 health+=1;
4497 else 4653 else
4498 return health; 4654 return health;
@@ -4955,8 +5111,17 @@ namespace OpenSim.Region.Framework.Scenes
4955 { 5111 {
4956 float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; 5112 float ominX, ominY, ominZ, omaxX, omaxY, omaxZ;
4957 5113
5114 Vector3 vec = g.AbsolutePosition;
5115
4958 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); 5116 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ);
4959 5117
5118 ominX += vec.X;
5119 omaxX += vec.X;
5120 ominY += vec.Y;
5121 omaxY += vec.Y;
5122 ominZ += vec.Z;
5123 omaxZ += vec.Z;
5124
4960 if (minX > ominX) 5125 if (minX > ominX)
4961 minX = ominX; 5126 minX = ominX;
4962 if (minY > ominY) 5127 if (minY > ominY)
@@ -5026,10 +5191,15 @@ namespace OpenSim.Region.Framework.Scenes
5026 }); 5191 });
5027 } 5192 }
5028 5193
5029 foreach (SceneObjectGroup grp in objectsToDelete) 5194 if (objectsToDelete.Count > 0)
5030 { 5195 {
5031 m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); 5196 m_log.DebugFormat("[SCENE]: Starting delete of {0} dropped attachments", objectsToDelete.Count);
5032 DeleteSceneObject(grp, true); 5197 foreach (SceneObjectGroup grp in objectsToDelete)
5198 {
5199 m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID);
5200 DeleteSceneObject(grp, true);
5201 }
5202 m_log.Debug("[SCENE]: Finished dropped attachment deletion");
5033 } 5203 }
5034 } 5204 }
5035 } 5205 }