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.cs112
1 files changed, 88 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e2ab643..dc58d84 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
@@ -609,6 +623,8 @@ namespace OpenSim.Region.Framework.Scenes
609 623
610 // Load region settings 624 // Load region settings
611 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); 625 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
626 m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
627
612 if (m_storageManager.EstateDataStore != null) 628 if (m_storageManager.EstateDataStore != null)
613 { 629 {
614 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); 630 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
@@ -711,7 +727,7 @@ namespace OpenSim.Region.Framework.Scenes
711 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 727 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
712 // TODO: Change default to true once the feature is supported 728 // TODO: Change default to true once the feature is supported
713 m_usePreJump = startupConfig.GetBoolean("enableprejump", false); 729 m_usePreJump = startupConfig.GetBoolean("enableprejump", false);
714 730 m_usePreJump = true; // Above line fails!?
715 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); 731 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
716 if (RegionInfo.NonphysPrimMax > 0) 732 if (RegionInfo.NonphysPrimMax > 0)
717 { 733 {
@@ -1025,6 +1041,15 @@ namespace OpenSim.Region.Framework.Scenes
1025 /// <param name="seconds">float indicating duration before restart.</param> 1041 /// <param name="seconds">float indicating duration before restart.</param>
1026 public virtual void Restart(float seconds) 1042 public virtual void Restart(float seconds)
1027 { 1043 {
1044 Restart(seconds, true);
1045 }
1046
1047 /// <summary>
1048 /// Given float seconds, this will restart the region. showDialog will optionally alert the users.
1049 /// </summary>
1050 /// <param name="seconds">float indicating duration before restart.</param>
1051 public virtual void Restart(float seconds, bool showDialog)
1052 {
1028 // notifications are done in 15 second increments 1053 // notifications are done in 15 second increments
1029 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request 1054 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request
1030 // It's a 'Cancel restart' request. 1055 // It's a 'Cancel restart' request.
@@ -1045,8 +1070,11 @@ namespace OpenSim.Region.Framework.Scenes
1045 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); 1070 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
1046 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); 1071 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
1047 m_restartTimer.Start(); 1072 m_restartTimer.Start();
1048 m_dialogModule.SendNotificationToUsersInRegion( 1073 if (showDialog)
1074 {
1075 m_dialogModule.SendNotificationToUsersInRegion(
1049 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0))); 1076 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0)));
1077 }
1050 } 1078 }
1051 } 1079 }
1052 1080
@@ -1404,16 +1432,16 @@ namespace OpenSim.Region.Framework.Scenes
1404 // Check if any objects have reached their targets 1432 // Check if any objects have reached their targets
1405 CheckAtTargets(); 1433 CheckAtTargets();
1406 1434
1407 // Update SceneObjectGroups that have scheduled themselves for updates
1408 // Objects queue their updates onto all scene presences
1409 if (m_frame % m_update_objects == 0)
1410 m_sceneGraph.UpdateObjectGroups();
1411
1412 // Run through all ScenePresences looking for updates 1435 // Run through all ScenePresences looking for updates
1413 // Presence updates and queued object updates for each presence are sent to clients 1436 // Presence updates and queued object updates for each presence are sent to clients
1414 if (m_frame % m_update_presences == 0) 1437 if (m_frame % m_update_presences == 0)
1415 m_sceneGraph.UpdatePresences(); 1438 m_sceneGraph.UpdatePresences();
1416 1439
1440 // Update SceneObjectGroups that have scheduled themselves for updates
1441 // Objects queue their updates onto all scene presences
1442 if (m_frame % m_update_objects == 0)
1443 m_sceneGraph.UpdateObjectGroups();
1444
1417 if (m_frame % m_update_coarse_locations == 0) 1445 if (m_frame % m_update_coarse_locations == 0)
1418 { 1446 {
1419 List<Vector3> coarseLocations; 1447 List<Vector3> coarseLocations;
@@ -1920,14 +1948,24 @@ namespace OpenSim.Region.Framework.Scenes
1920 /// <returns></returns> 1948 /// <returns></returns>
1921 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) 1949 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
1922 { 1950 {
1951
1952 float wheight = (float)RegionInfo.RegionSettings.WaterHeight;
1953 Vector3 wpos = Vector3.Zero;
1954 // Check for water surface intersection from above
1955 if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) )
1956 {
1957 float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z);
1958 wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X));
1959 wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y));
1960 wpos.Z = wheight;
1961 }
1962
1923 Vector3 pos = Vector3.Zero; 1963 Vector3 pos = Vector3.Zero;
1924 if (RayEndIsIntersection == (byte)1) 1964 if (RayEndIsIntersection == (byte)1)
1925 { 1965 {
1926 pos = RayEnd; 1966 pos = RayEnd;
1927 return pos;
1928 } 1967 }
1929 1968 else if (RayTargetID != UUID.Zero)
1930 if (RayTargetID != UUID.Zero)
1931 { 1969 {
1932 SceneObjectPart target = GetSceneObjectPart(RayTargetID); 1970 SceneObjectPart target = GetSceneObjectPart(RayTargetID);
1933 1971
@@ -1949,7 +1987,7 @@ namespace OpenSim.Region.Framework.Scenes
1949 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); 1987 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter);
1950 1988
1951 // Un-comment out the following line to Get Raytrace results printed to the console. 1989 // Un-comment out the following line to Get Raytrace results printed to the console.
1952 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); 1990 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
1953 float ScaleOffset = 0.5f; 1991 float ScaleOffset = 0.5f;
1954 1992
1955 // If we hit something 1993 // If we hit something
@@ -1972,13 +2010,10 @@ namespace OpenSim.Region.Framework.Scenes
1972 //pos.Z -= 0.25F; 2010 //pos.Z -= 0.25F;
1973 2011
1974 } 2012 }
1975
1976 return pos;
1977 } 2013 }
1978 else 2014 else
1979 { 2015 {
1980 // We don't have a target here, so we're going to raytrace all the objects in the scene. 2016 // We don't have a target here, so we're going to raytrace all the objects in the scene.
1981
1982 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); 2017 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false);
1983 2018
1984 // Un-comment the following line to print the raytrace results to the console. 2019 // Un-comment the following line to print the raytrace results to the console.
@@ -1987,13 +2022,12 @@ namespace OpenSim.Region.Framework.Scenes
1987 if (ei.HitTF) 2022 if (ei.HitTF)
1988 { 2023 {
1989 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 2024 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
1990 } else 2025 }
2026 else
1991 { 2027 {
1992 // fall back to our stupid functionality 2028 // fall back to our stupid functionality
1993 pos = RayEnd; 2029 pos = RayEnd;
1994 } 2030 }
1995
1996 return pos;
1997 } 2031 }
1998 } 2032 }
1999 else 2033 else
@@ -2004,8 +2038,12 @@ namespace OpenSim.Region.Framework.Scenes
2004 //increase height so its above the ground. 2038 //increase height so its above the ground.
2005 //should be getting the normal of the ground at the rez point and using that? 2039 //should be getting the normal of the ground at the rez point and using that?
2006 pos.Z += scale.Z / 2f; 2040 pos.Z += scale.Z / 2f;
2007 return pos; 2041// return pos;
2008 } 2042 }
2043
2044 // check against posible water intercept
2045 if (wpos.Z > pos.Z) pos = wpos;
2046 return pos;
2009 } 2047 }
2010 2048
2011 2049
@@ -2138,7 +2176,7 @@ namespace OpenSim.Region.Framework.Scenes
2138 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 2176 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
2139 { 2177 {
2140 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); 2178 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates);
2141 } 2179 }
2142 2180
2143 /// <summary> 2181 /// <summary>
2144 /// Delete every object from the scene. This does not include attachments worn by avatars. 2182 /// Delete every object from the scene. This does not include attachments worn by avatars.
@@ -3197,6 +3235,16 @@ namespace OpenSim.Region.Framework.Scenes
3197 /// <param name="flags"></param> 3235 /// <param name="flags"></param>
3198 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 3236 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3199 { 3237 {
3238 //Add half the avatar's height so that the user doesn't fall through prims
3239 ScenePresence presence;
3240 if (TryGetScenePresence(remoteClient.AgentId, out presence))
3241 {
3242 if (presence.Appearance != null)
3243 {
3244 position.Z = position.Z + (presence.Appearance.AvatarHeight / 2);
3245 }
3246 }
3247
3200 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) 3248 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3201 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 3249 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3202 m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); 3250 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
@@ -3584,6 +3632,8 @@ namespace OpenSim.Region.Framework.Scenes
3584 } 3632 }
3585 } 3633 }
3586 // Honor parcel landing type and position. 3634 // Honor parcel landing type and position.
3635 /*
3636 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3587 if (land != null) 3637 if (land != null)
3588 { 3638 {
3589 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) 3639 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
@@ -3591,6 +3641,7 @@ namespace OpenSim.Region.Framework.Scenes
3591 agent.startpos = land.LandData.UserLocation; 3641 agent.startpos = land.LandData.UserLocation;
3592 } 3642 }
3593 } 3643 }
3644 */// This is now handled properly in ScenePresence.MakeRootAgent
3594 } 3645 }
3595 3646
3596 return true; 3647 return true;
@@ -3953,12 +4004,22 @@ namespace OpenSim.Region.Framework.Scenes
3953 return false; 4004 return false;
3954 } 4005 }
3955 4006
4007 public bool IncomingCloseAgent(UUID agentID)
4008 {
4009 return IncomingCloseAgent(agentID, false);
4010 }
4011
4012 public bool IncomingCloseChildAgent(UUID agentID)
4013 {
4014 return IncomingCloseAgent(agentID, true);
4015 }
4016
3956 /// <summary> 4017 /// <summary>
3957 /// Tell a single agent to disconnect from the region. 4018 /// Tell a single agent to disconnect from the region.
3958 /// </summary> 4019 /// </summary>
3959 /// <param name="regionHandle"></param>
3960 /// <param name="agentID"></param> 4020 /// <param name="agentID"></param>
3961 public bool IncomingCloseAgent(UUID agentID) 4021 /// <param name="childOnly"></param>
4022 public bool IncomingCloseAgent(UUID agentID, bool childOnly)
3962 { 4023 {
3963 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 4024 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
3964 4025
@@ -3970,7 +4031,7 @@ namespace OpenSim.Region.Framework.Scenes
3970 { 4031 {
3971 m_sceneGraph.removeUserCount(false); 4032 m_sceneGraph.removeUserCount(false);
3972 } 4033 }
3973 else 4034 else if (!childOnly)
3974 { 4035 {
3975 m_sceneGraph.removeUserCount(true); 4036 m_sceneGraph.removeUserCount(true);
3976 } 4037 }
@@ -3986,9 +4047,12 @@ namespace OpenSim.Region.Framework.Scenes
3986 } 4047 }
3987 else 4048 else
3988 presence.ControllingClient.SendShutdownConnectionNotice(); 4049 presence.ControllingClient.SendShutdownConnectionNotice();
4050 presence.ControllingClient.Close(false);
4051 }
4052 else if (!childOnly)
4053 {
4054 presence.ControllingClient.Close(true);
3989 } 4055 }
3990
3991 presence.ControllingClient.Close();
3992 return true; 4056 return true;
3993 } 4057 }
3994 4058