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.cs141
1 files changed, 115 insertions, 26 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 93f684c..644fbb0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -137,6 +137,7 @@ namespace OpenSim.Region.Framework.Scenes
137 protected SceneCommunicationService m_sceneGridService; 137 protected SceneCommunicationService m_sceneGridService;
138 public bool LoginsDisabled = true; 138 public bool LoginsDisabled = true;
139 public bool LoadingPrims = false; 139 public bool LoadingPrims = false;
140 public bool CombineRegions = false;
140 141
141 public new float TimeDilation 142 public new float TimeDilation
142 { 143 {
@@ -150,6 +151,20 @@ namespace OpenSim.Region.Framework.Scenes
150 151
151 public IXfer XferManager; 152 public IXfer XferManager;
152 153
154 protected ISnmpModule m_snmpService = null;
155 public ISnmpModule SnmpService
156 {
157 get
158 {
159 if (m_snmpService == null)
160 {
161 m_snmpService = RequestModuleInterface<ISnmpModule>();
162 }
163
164 return m_snmpService;
165 }
166 }
167
153 protected IAssetService m_AssetService; 168 protected IAssetService m_AssetService;
154 protected IAuthorizationService m_AuthorizationService; 169 protected IAuthorizationService m_AuthorizationService;
155 170
@@ -608,6 +623,8 @@ namespace OpenSim.Region.Framework.Scenes
608 623
609 // Load region settings 624 // Load region settings
610 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
611 if (m_storageManager.EstateDataStore != null) 628 if (m_storageManager.EstateDataStore != null)
612 { 629 {
613 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); 630 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
@@ -710,7 +727,7 @@ namespace OpenSim.Region.Framework.Scenes
710 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 727 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
711 // TODO: Change default to true once the feature is supported 728 // TODO: Change default to true once the feature is supported
712 m_usePreJump = startupConfig.GetBoolean("enableprejump", false); 729 m_usePreJump = startupConfig.GetBoolean("enableprejump", false);
713 730 m_usePreJump = true; // Above line fails!?
714 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); 731 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
715 if (RegionInfo.NonphysPrimMax > 0) 732 if (RegionInfo.NonphysPrimMax > 0)
716 { 733 {
@@ -752,6 +769,7 @@ namespace OpenSim.Region.Framework.Scenes
752 } 769 }
753 770
754 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); 771 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
772 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
755 773
756 #region BinaryStats 774 #region BinaryStats
757 775
@@ -1024,6 +1042,15 @@ namespace OpenSim.Region.Framework.Scenes
1024 /// <param name="seconds">float indicating duration before restart.</param> 1042 /// <param name="seconds">float indicating duration before restart.</param>
1025 public virtual void Restart(float seconds) 1043 public virtual void Restart(float seconds)
1026 { 1044 {
1045 Restart(seconds, true);
1046 }
1047
1048 /// <summary>
1049 /// Given float seconds, this will restart the region. showDialog will optionally alert the users.
1050 /// </summary>
1051 /// <param name="seconds">float indicating duration before restart.</param>
1052 public virtual void Restart(float seconds, bool showDialog)
1053 {
1027 // notifications are done in 15 second increments 1054 // notifications are done in 15 second increments
1028 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request 1055 // so .. if the number of seconds is less then 15 seconds, it's not really a restart request
1029 // It's a 'Cancel restart' request. 1056 // It's a 'Cancel restart' request.
@@ -1044,8 +1071,11 @@ namespace OpenSim.Region.Framework.Scenes
1044 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); 1071 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
1045 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); 1072 m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
1046 m_restartTimer.Start(); 1073 m_restartTimer.Start();
1047 m_dialogModule.SendNotificationToUsersInRegion( 1074 if (showDialog)
1075 {
1076 m_dialogModule.SendNotificationToUsersInRegion(
1048 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0))); 1077 UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0)));
1078 }
1049 } 1079 }
1050 } 1080 }
1051 1081
@@ -1403,16 +1433,16 @@ namespace OpenSim.Region.Framework.Scenes
1403 // Check if any objects have reached their targets 1433 // Check if any objects have reached their targets
1404 CheckAtTargets(); 1434 CheckAtTargets();
1405 1435
1406 // Update SceneObjectGroups that have scheduled themselves for updates
1407 // Objects queue their updates onto all scene presences
1408 if (m_frame % m_update_objects == 0)
1409 m_sceneGraph.UpdateObjectGroups();
1410
1411 // Run through all ScenePresences looking for updates 1436 // Run through all ScenePresences looking for updates
1412 // Presence updates and queued object updates for each presence are sent to clients 1437 // Presence updates and queued object updates for each presence are sent to clients
1413 if (m_frame % m_update_presences == 0) 1438 if (m_frame % m_update_presences == 0)
1414 m_sceneGraph.UpdatePresences(); 1439 m_sceneGraph.UpdatePresences();
1415 1440
1441 // Update SceneObjectGroups that have scheduled themselves for updates
1442 // Objects queue their updates onto all scene presences
1443 if (m_frame % m_update_objects == 0)
1444 m_sceneGraph.UpdateObjectGroups();
1445
1416 if (m_frame % m_update_coarse_locations == 0) 1446 if (m_frame % m_update_coarse_locations == 0)
1417 { 1447 {
1418 List<Vector3> coarseLocations; 1448 List<Vector3> coarseLocations;
@@ -1741,6 +1771,7 @@ namespace OpenSim.Region.Framework.Scenes
1741 public void StoreWindlightProfile(RegionLightShareData wl) 1771 public void StoreWindlightProfile(RegionLightShareData wl)
1742 { 1772 {
1743 m_regInfo.WindlightSettings = wl; 1773 m_regInfo.WindlightSettings = wl;
1774 wl.Save();
1744 m_storageManager.DataStore.StoreRegionWindlightSettings(wl); 1775 m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
1745 m_eventManager.TriggerOnSaveNewWindlightProfile(); 1776 m_eventManager.TriggerOnSaveNewWindlightProfile();
1746 } 1777 }
@@ -1921,14 +1952,24 @@ namespace OpenSim.Region.Framework.Scenes
1921 /// <returns></returns> 1952 /// <returns></returns>
1922 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) 1953 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
1923 { 1954 {
1955
1956 float wheight = (float)RegionInfo.RegionSettings.WaterHeight;
1957 Vector3 wpos = Vector3.Zero;
1958 // Check for water surface intersection from above
1959 if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) )
1960 {
1961 float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z);
1962 wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X));
1963 wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y));
1964 wpos.Z = wheight;
1965 }
1966
1924 Vector3 pos = Vector3.Zero; 1967 Vector3 pos = Vector3.Zero;
1925 if (RayEndIsIntersection == (byte)1) 1968 if (RayEndIsIntersection == (byte)1)
1926 { 1969 {
1927 pos = RayEnd; 1970 pos = RayEnd;
1928 return pos;
1929 } 1971 }
1930 1972 else if (RayTargetID != UUID.Zero)
1931 if (RayTargetID != UUID.Zero)
1932 { 1973 {
1933 SceneObjectPart target = GetSceneObjectPart(RayTargetID); 1974 SceneObjectPart target = GetSceneObjectPart(RayTargetID);
1934 1975
@@ -1950,7 +1991,7 @@ namespace OpenSim.Region.Framework.Scenes
1950 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); 1991 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter);
1951 1992
1952 // Un-comment out the following line to Get Raytrace results printed to the console. 1993 // Un-comment out the following line to Get Raytrace results printed to the console.
1953 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); 1994 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
1954 float ScaleOffset = 0.5f; 1995 float ScaleOffset = 0.5f;
1955 1996
1956 // If we hit something 1997 // If we hit something
@@ -1973,13 +2014,10 @@ namespace OpenSim.Region.Framework.Scenes
1973 //pos.Z -= 0.25F; 2014 //pos.Z -= 0.25F;
1974 2015
1975 } 2016 }
1976
1977 return pos;
1978 } 2017 }
1979 else 2018 else
1980 { 2019 {
1981 // We don't have a target here, so we're going to raytrace all the objects in the scene. 2020 // We don't have a target here, so we're going to raytrace all the objects in the scene.
1982
1983 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); 2021 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false);
1984 2022
1985 // Un-comment the following line to print the raytrace results to the console. 2023 // Un-comment the following line to print the raytrace results to the console.
@@ -1988,13 +2026,12 @@ namespace OpenSim.Region.Framework.Scenes
1988 if (ei.HitTF) 2026 if (ei.HitTF)
1989 { 2027 {
1990 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 2028 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
1991 } else 2029 }
2030 else
1992 { 2031 {
1993 // fall back to our stupid functionality 2032 // fall back to our stupid functionality
1994 pos = RayEnd; 2033 pos = RayEnd;
1995 } 2034 }
1996
1997 return pos;
1998 } 2035 }
1999 } 2036 }
2000 else 2037 else
@@ -2005,8 +2042,12 @@ namespace OpenSim.Region.Framework.Scenes
2005 //increase height so its above the ground. 2042 //increase height so its above the ground.
2006 //should be getting the normal of the ground at the rez point and using that? 2043 //should be getting the normal of the ground at the rez point and using that?
2007 pos.Z += scale.Z / 2f; 2044 pos.Z += scale.Z / 2f;
2008 return pos; 2045// return pos;
2009 } 2046 }
2047
2048 // check against posible water intercept
2049 if (wpos.Z > pos.Z) pos = wpos;
2050 return pos;
2010 } 2051 }
2011 2052
2012 2053
@@ -2139,13 +2180,22 @@ namespace OpenSim.Region.Framework.Scenes
2139 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 2180 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
2140 { 2181 {
2141 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); 2182 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates);
2142 } 2183 }
2143 2184
2144 /// <summary> 2185 /// <summary>
2145 /// Delete every object from the scene. This does not include attachments worn by avatars. 2186 /// Delete every object from the scene. This does not include attachments worn by avatars.
2146 /// </summary> 2187 /// </summary>
2147 public void DeleteAllSceneObjects() 2188 public void DeleteAllSceneObjects()
2148 { 2189 {
2190 DeleteAllSceneObjects(false);
2191 }
2192
2193 /// <summary>
2194 /// Delete every object from the scene. This does not include attachments worn by avatars.
2195 /// </summary>
2196 public void DeleteAllSceneObjects(bool exceptNoCopy)
2197 {
2198 List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
2149 lock (Entities) 2199 lock (Entities)
2150 { 2200 {
2151 ICollection<EntityBase> entities = new List<EntityBase>(Entities); 2201 ICollection<EntityBase> entities = new List<EntityBase>(Entities);
@@ -2155,11 +2205,24 @@ namespace OpenSim.Region.Framework.Scenes
2155 if (e is SceneObjectGroup) 2205 if (e is SceneObjectGroup)
2156 { 2206 {
2157 SceneObjectGroup sog = (SceneObjectGroup)e; 2207 SceneObjectGroup sog = (SceneObjectGroup)e;
2158 if (!sog.IsAttachment) 2208 if (sog != null && !sog.IsAttachment)
2159 DeleteSceneObject((SceneObjectGroup)e, false); 2209 {
2210 if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0))
2211 {
2212 DeleteSceneObject((SceneObjectGroup)e, false);
2213 }
2214 else
2215 {
2216 toReturn.Add((SceneObjectGroup)e);
2217 }
2218 }
2160 } 2219 }
2161 } 2220 }
2162 } 2221 }
2222 if (toReturn.Count > 0)
2223 {
2224 returnObjects(toReturn.ToArray(), UUID.Zero);
2225 }
2163 } 2226 }
2164 2227
2165 /// <summary> 2228 /// <summary>
@@ -3146,6 +3209,16 @@ namespace OpenSim.Region.Framework.Scenes
3146 /// <param name="flags"></param> 3209 /// <param name="flags"></param>
3147 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 3210 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3148 { 3211 {
3212 //Add half the avatar's height so that the user doesn't fall through prims
3213 ScenePresence presence;
3214 if (TryGetScenePresence(remoteClient.AgentId, out presence))
3215 {
3216 if (presence.Appearance != null)
3217 {
3218 position.Z = position.Z + (presence.Appearance.AvatarHeight / 2);
3219 }
3220 }
3221
3149 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) 3222 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3150 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 3223 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3151 m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); 3224 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
@@ -3533,6 +3606,8 @@ namespace OpenSim.Region.Framework.Scenes
3533 } 3606 }
3534 } 3607 }
3535 // Honor parcel landing type and position. 3608 // Honor parcel landing type and position.
3609 /*
3610 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3536 if (land != null) 3611 if (land != null)
3537 { 3612 {
3538 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) 3613 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
@@ -3540,6 +3615,7 @@ namespace OpenSim.Region.Framework.Scenes
3540 agent.startpos = land.LandData.UserLocation; 3615 agent.startpos = land.LandData.UserLocation;
3541 } 3616 }
3542 } 3617 }
3618 */// This is now handled properly in ScenePresence.MakeRootAgent
3543 } 3619 }
3544 3620
3545 return true; 3621 return true;
@@ -3902,12 +3978,22 @@ namespace OpenSim.Region.Framework.Scenes
3902 return false; 3978 return false;
3903 } 3979 }
3904 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
3905 /// <summary> 3991 /// <summary>
3906 /// Tell a single agent to disconnect from the region. 3992 /// Tell a single agent to disconnect from the region.
3907 /// </summary> 3993 /// </summary>
3908 /// <param name="regionHandle"></param>
3909 /// <param name="agentID"></param> 3994 /// <param name="agentID"></param>
3910 public bool IncomingCloseAgent(UUID agentID) 3995 /// <param name="childOnly"></param>
3996 public bool IncomingCloseAgent(UUID agentID, bool childOnly)
3911 { 3997 {
3912 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 3998 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
3913 3999
@@ -3919,7 +4005,7 @@ namespace OpenSim.Region.Framework.Scenes
3919 { 4005 {
3920 m_sceneGraph.removeUserCount(false); 4006 m_sceneGraph.removeUserCount(false);
3921 } 4007 }
3922 else 4008 else if (!childOnly)
3923 { 4009 {
3924 m_sceneGraph.removeUserCount(true); 4010 m_sceneGraph.removeUserCount(true);
3925 } 4011 }
@@ -3935,9 +4021,12 @@ namespace OpenSim.Region.Framework.Scenes
3935 } 4021 }
3936 else 4022 else
3937 presence.ControllingClient.SendShutdownConnectionNotice(); 4023 presence.ControllingClient.SendShutdownConnectionNotice();
4024 presence.ControllingClient.Close(false);
4025 }
4026 else if (!childOnly)
4027 {
4028 presence.ControllingClient.Close(true);
3938 } 4029 }
3939
3940 presence.ControllingClient.Close();
3941 return true; 4030 return true;
3942 } 4031 }
3943 4032