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.cs139
1 files changed, 113 insertions, 26 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 40176ec..7c25e87 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -149,6 +149,20 @@ namespace OpenSim.Region.Framework.Scenes
149 149
150 public IXfer XferManager; 150 public IXfer XferManager;
151 151
152 protected ISnmpModule m_snmpService = null;
153 public ISnmpModule SnmpService
154 {
155 get
156 {
157 if (m_snmpService == null)
158 {
159 m_snmpService = RequestModuleInterface<ISnmpModule>();
160 }
161
162 return m_snmpService;
163 }
164 }
165
152 protected IAssetService m_AssetService; 166 protected IAssetService m_AssetService;
153 protected IAuthorizationService m_AuthorizationService; 167 protected IAuthorizationService m_AuthorizationService;
154 168
@@ -607,6 +621,8 @@ namespace OpenSim.Region.Framework.Scenes
607 621
608 // Load region settings 622 // Load region settings
609 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); 623 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
624 m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
625
610 if (m_storageManager.EstateDataStore != null) 626 if (m_storageManager.EstateDataStore != null)
611 { 627 {
612 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); 628 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
@@ -709,7 +725,7 @@ namespace OpenSim.Region.Framework.Scenes
709 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 725 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
710 // TODO: Change default to true once the feature is supported 726 // TODO: Change default to true once the feature is supported
711 m_usePreJump = startupConfig.GetBoolean("enableprejump", false); 727 m_usePreJump = startupConfig.GetBoolean("enableprejump", false);
712 728 m_usePreJump = true; // Above line fails!?
713 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); 729 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
714 if (RegionInfo.NonphysPrimMax > 0) 730 if (RegionInfo.NonphysPrimMax > 0)
715 { 731 {
@@ -1023,6 +1039,15 @@ namespace OpenSim.Region.Framework.Scenes
1023 /// <param name="seconds">float indicating duration before restart.</param> 1039 /// <param name="seconds">float indicating duration before restart.</param>
1024 public virtual void Restart(float seconds) 1040 public virtual void Restart(float seconds)
1025 { 1041 {
1042 Restart(seconds, true);
1043 }
1044
1045 /// <summary>
1046 /// Given float seconds, this will restart the region. showDialog will optionally alert the users.
1047 /// </summary>
1048 /// <param name="seconds">float indicating duration before restart.</param>
1049 public virtual void Restart(float seconds, bool showDialog)
1050 {
1026 // notifications are done in 15 second increments 1051 // notifications are done in 15 second increments
1027 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request 1052 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request
1028 // It's a 'Cancel restart' request. 1053 // It's a 'Cancel restart' request.
@@ -1043,8 +1068,11 @@ namespace OpenSim.Region.Framework.Scenes
1043 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); 1068 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
1044 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); 1069 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
1045 m_restartTimer.Start(); 1070 m_restartTimer.Start();
1046 m_dialogModule.SendNotificationToUsersInRegion( 1071 if (showDialog)
1072 {
1073 m_dialogModule.SendNotificationToUsersInRegion(
1047 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0))); 1074 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0)));
1075 }
1048 } 1076 }
1049 } 1077 }
1050 1078
@@ -1402,16 +1430,16 @@ namespace OpenSim.Region.Framework.Scenes
1402 // Check if any objects have reached their targets 1430 // Check if any objects have reached their targets
1403 CheckAtTargets(); 1431 CheckAtTargets();
1404 1432
1405 // Update SceneObjectGroups that have scheduled themselves for updates
1406 // Objects queue their updates onto all scene presences
1407 if (m_frame % m_update_objects == 0)
1408 m_sceneGraph.UpdateObjectGroups();
1409
1410 // Run through all ScenePresences looking for updates 1433 // Run through all ScenePresences looking for updates
1411 // Presence updates and queued object updates for each presence are sent to clients 1434 // Presence updates and queued object updates for each presence are sent to clients
1412 if (m_frame % m_update_presences == 0) 1435 if (m_frame % m_update_presences == 0)
1413 m_sceneGraph.UpdatePresences(); 1436 m_sceneGraph.UpdatePresences();
1414 1437
1438 // Update SceneObjectGroups that have scheduled themselves for updates
1439 // Objects queue their updates onto all scene presences
1440 if (m_frame % m_update_objects == 0)
1441 m_sceneGraph.UpdateObjectGroups();
1442
1415 if (m_frame % m_update_coarse_locations == 0) 1443 if (m_frame % m_update_coarse_locations == 0)
1416 { 1444 {
1417 List<Vector3> coarseLocations; 1445 List<Vector3> coarseLocations;
@@ -1740,6 +1768,7 @@ namespace OpenSim.Region.Framework.Scenes
1740 public void StoreWindlightProfile(RegionLightShareData wl) 1768 public void StoreWindlightProfile(RegionLightShareData wl)
1741 { 1769 {
1742 m_regInfo.WindlightSettings = wl; 1770 m_regInfo.WindlightSettings = wl;
1771 wl.Save();
1743 m_storageManager.DataStore.StoreRegionWindlightSettings(wl); 1772 m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
1744 m_eventManager.TriggerOnSaveNewWindlightProfile(); 1773 m_eventManager.TriggerOnSaveNewWindlightProfile();
1745 } 1774 }
@@ -1918,14 +1947,24 @@ namespace OpenSim.Region.Framework.Scenes
1918 /// <returns></returns> 1947 /// <returns></returns>
1919 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) 1948 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
1920 { 1949 {
1950
1951 float wheight = (float)RegionInfo.RegionSettings.WaterHeight;
1952 Vector3 wpos = Vector3.Zero;
1953 // Check for water surface intersection from above
1954 if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) )
1955 {
1956 float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z);
1957 wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X));
1958 wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y));
1959 wpos.Z = wheight;
1960 }
1961
1921 Vector3 pos = Vector3.Zero; 1962 Vector3 pos = Vector3.Zero;
1922 if (RayEndIsIntersection == (byte)1) 1963 if (RayEndIsIntersection == (byte)1)
1923 { 1964 {
1924 pos = RayEnd; 1965 pos = RayEnd;
1925 return pos;
1926 } 1966 }
1927 1967 else if (RayTargetID != UUID.Zero)
1928 if (RayTargetID != UUID.Zero)
1929 { 1968 {
1930 SceneObjectPart target = GetSceneObjectPart(RayTargetID); 1969 SceneObjectPart target = GetSceneObjectPart(RayTargetID);
1931 1970
@@ -1947,7 +1986,7 @@ namespace OpenSim.Region.Framework.Scenes
1947 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); 1986 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter);
1948 1987
1949 // Un-comment out the following line to Get Raytrace results printed to the console. 1988 // Un-comment out the following line to Get Raytrace results printed to the console.
1950 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); 1989 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
1951 float ScaleOffset = 0.5f; 1990 float ScaleOffset = 0.5f;
1952 1991
1953 // If we hit something 1992 // If we hit something
@@ -1970,13 +2009,10 @@ namespace OpenSim.Region.Framework.Scenes
1970 //pos.Z -= 0.25F; 2009 //pos.Z -= 0.25F;
1971 2010
1972 } 2011 }
1973
1974 return pos;
1975 } 2012 }
1976 else 2013 else
1977 { 2014 {
1978 // We don't have a target here, so we're going to raytrace all the objects in the scene. 2015 // We don't have a target here, so we're going to raytrace all the objects in the scene.
1979
1980 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); 2016 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false);
1981 2017
1982 // Un-comment the following line to print the raytrace results to the console. 2018 // Un-comment the following line to print the raytrace results to the console.
@@ -1985,13 +2021,12 @@ namespace OpenSim.Region.Framework.Scenes
1985 if (ei.HitTF) 2021 if (ei.HitTF)
1986 { 2022 {
1987 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 2023 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
1988 } else 2024 }
2025 else
1989 { 2026 {
1990 // fall back to our stupid functionality 2027 // fall back to our stupid functionality
1991 pos = RayEnd; 2028 pos = RayEnd;
1992 } 2029 }
1993
1994 return pos;
1995 } 2030 }
1996 } 2031 }
1997 else 2032 else
@@ -2002,8 +2037,12 @@ namespace OpenSim.Region.Framework.Scenes
2002 //increase height so its above the ground. 2037 //increase height so its above the ground.
2003 //should be getting the normal of the ground at the rez point and using that? 2038 //should be getting the normal of the ground at the rez point and using that?
2004 pos.Z += scale.Z / 2f; 2039 pos.Z += scale.Z / 2f;
2005 return pos; 2040// return pos;
2006 } 2041 }
2042
2043 // check against posible water intercept
2044 if (wpos.Z > pos.Z) pos = wpos;
2045 return pos;
2007 } 2046 }
2008 2047
2009 2048
@@ -2136,13 +2175,22 @@ namespace OpenSim.Region.Framework.Scenes
2136 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 2175 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
2137 { 2176 {
2138 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); 2177 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates);
2139 } 2178 }
2140 2179
2141 /// <summary> 2180 /// <summary>
2142 /// Delete every object from the scene. This does not include attachments worn by avatars. 2181 /// Delete every object from the scene. This does not include attachments worn by avatars.
2143 /// </summary> 2182 /// </summary>
2144 public void DeleteAllSceneObjects() 2183 public void DeleteAllSceneObjects()
2145 { 2184 {
2185 DeleteAllSceneObjects(false);
2186 }
2187
2188 /// <summary>
2189 /// Delete every object from the scene. This does not include attachments worn by avatars.
2190 /// </summary>
2191 public void DeleteAllSceneObjects(bool exceptNoCopy)
2192 {
2193 List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
2146 lock (Entities) 2194 lock (Entities)
2147 { 2195 {
2148 ICollection<EntityBase> entities = new List<EntityBase>(Entities); 2196 ICollection<EntityBase> entities = new List<EntityBase>(Entities);
@@ -2152,11 +2200,24 @@ namespace OpenSim.Region.Framework.Scenes
2152 if (e is SceneObjectGroup) 2200 if (e is SceneObjectGroup)
2153 { 2201 {
2154 SceneObjectGroup sog = (SceneObjectGroup)e; 2202 SceneObjectGroup sog = (SceneObjectGroup)e;
2155 if (!sog.IsAttachment) 2203 if (sog != null && !sog.IsAttachment)
2156 DeleteSceneObject((SceneObjectGroup)e, false); 2204 {
2205 if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0))
2206 {
2207 DeleteSceneObject((SceneObjectGroup)e, false);
2208 }
2209 else
2210 {
2211 toReturn.Add((SceneObjectGroup)e);
2212 }
2213 }
2157 } 2214 }
2158 } 2215 }
2159 } 2216 }
2217 if (toReturn.Count > 0)
2218 {
2219 returnObjects(toReturn.ToArray(), UUID.Zero);
2220 }
2160 } 2221 }
2161 2222
2162 /// <summary> 2223 /// <summary>
@@ -3195,6 +3256,16 @@ namespace OpenSim.Region.Framework.Scenes
3195 /// <param name="flags"></param> 3256 /// <param name="flags"></param>
3196 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 3257 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3197 { 3258 {
3259 //Add half the avatar's height so that the user doesn't fall through prims
3260 ScenePresence presence;
3261 if (TryGetScenePresence(remoteClient.AgentId, out presence))
3262 {
3263 if (presence.Appearance != null)
3264 {
3265 position.Z = position.Z + (presence.Appearance.AvatarHeight / 2);
3266 }
3267 }
3268
3198 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) 3269 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3199 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 3270 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3200 m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); 3271 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
@@ -3582,6 +3653,8 @@ namespace OpenSim.Region.Framework.Scenes
3582 } 3653 }
3583 } 3654 }
3584 // Honor parcel landing type and position. 3655 // Honor parcel landing type and position.
3656 /*
3657 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3585 if (land != null) 3658 if (land != null)
3586 { 3659 {
3587 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) 3660 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
@@ -3589,6 +3662,7 @@ namespace OpenSim.Region.Framework.Scenes
3589 agent.startpos = land.LandData.UserLocation; 3662 agent.startpos = land.LandData.UserLocation;
3590 } 3663 }
3591 } 3664 }
3665 */// This is now handled properly in ScenePresence.MakeRootAgent
3592 } 3666 }
3593 3667
3594 return true; 3668 return true;
@@ -3951,12 +4025,22 @@ namespace OpenSim.Region.Framework.Scenes
3951 return false; 4025 return false;
3952 } 4026 }
3953 4027
4028 public bool IncomingCloseAgent(UUID agentID)
4029 {
4030 return IncomingCloseAgent(agentID, false);
4031 }
4032
4033 public bool IncomingCloseChildAgent(UUID agentID)
4034 {
4035 return IncomingCloseAgent(agentID, true);
4036 }
4037
3954 /// <summary> 4038 /// <summary>
3955 /// Tell a single agent to disconnect from the region. 4039 /// Tell a single agent to disconnect from the region.
3956 /// </summary> 4040 /// </summary>
3957 /// <param name="regionHandle"></param>
3958 /// <param name="agentID"></param> 4041 /// <param name="agentID"></param>
3959 public bool IncomingCloseAgent(UUID agentID) 4042 /// <param name="childOnly"></param>
4043 public bool IncomingCloseAgent(UUID agentID, bool childOnly)
3960 { 4044 {
3961 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 4045 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
3962 4046
@@ -3968,7 +4052,7 @@ namespace OpenSim.Region.Framework.Scenes
3968 { 4052 {
3969 m_sceneGraph.removeUserCount(false); 4053 m_sceneGraph.removeUserCount(false);
3970 } 4054 }
3971 else 4055 else if (!childOnly)
3972 { 4056 {
3973 m_sceneGraph.removeUserCount(true); 4057 m_sceneGraph.removeUserCount(true);
3974 } 4058 }
@@ -3984,9 +4068,12 @@ namespace OpenSim.Region.Framework.Scenes
3984 } 4068 }
3985 else 4069 else
3986 presence.ControllingClient.SendShutdownConnectionNotice(); 4070 presence.ControllingClient.SendShutdownConnectionNotice();
4071 presence.ControllingClient.Close(false);
4072 }
4073 else if (!childOnly)
4074 {
4075 presence.ControllingClient.Close(true);
3987 } 4076 }
3988
3989 presence.ControllingClient.Close();
3990 return true; 4077 return true;
3991 } 4078 }
3992 4079