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 dcd7f3d..d55c7a1 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 }
@@ -1923,14 +1954,24 @@ namespace OpenSim.Region.Framework.Scenes
1923 /// <returns></returns> 1954 /// <returns></returns>
1924 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) 1955 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
1925 { 1956 {
1957
1958 float wheight = (float)RegionInfo.RegionSettings.WaterHeight;
1959 Vector3 wpos = Vector3.Zero;
1960 // Check for water surface intersection from above
1961 if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) )
1962 {
1963 float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z);
1964 wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X));
1965 wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y));
1966 wpos.Z = wheight;
1967 }
1968
1926 Vector3 pos = Vector3.Zero; 1969 Vector3 pos = Vector3.Zero;
1927 if (RayEndIsIntersection == (byte)1) 1970 if (RayEndIsIntersection == (byte)1)
1928 { 1971 {
1929 pos = RayEnd; 1972 pos = RayEnd;
1930 return pos;
1931 } 1973 }
1932 1974 else if (RayTargetID != UUID.Zero)
1933 if (RayTargetID != UUID.Zero)
1934 { 1975 {
1935 SceneObjectPart target = GetSceneObjectPart(RayTargetID); 1976 SceneObjectPart target = GetSceneObjectPart(RayTargetID);
1936 1977
@@ -1952,7 +1993,7 @@ namespace OpenSim.Region.Framework.Scenes
1952 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); 1993 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter);
1953 1994
1954 // Un-comment out the following line to Get Raytrace results printed to the console. 1995 // Un-comment out the following line to Get Raytrace results printed to the console.
1955 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); 1996 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
1956 float ScaleOffset = 0.5f; 1997 float ScaleOffset = 0.5f;
1957 1998
1958 // If we hit something 1999 // If we hit something
@@ -1975,13 +2016,10 @@ namespace OpenSim.Region.Framework.Scenes
1975 //pos.Z -= 0.25F; 2016 //pos.Z -= 0.25F;
1976 2017
1977 } 2018 }
1978
1979 return pos;
1980 } 2019 }
1981 else 2020 else
1982 { 2021 {
1983 // We don't have a target here, so we're going to raytrace all the objects in the scene. 2022 // We don't have a target here, so we're going to raytrace all the objects in the scene.
1984
1985 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); 2023 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false);
1986 2024
1987 // Un-comment the following line to print the raytrace results to the console. 2025 // Un-comment the following line to print the raytrace results to the console.
@@ -1990,13 +2028,12 @@ namespace OpenSim.Region.Framework.Scenes
1990 if (ei.HitTF) 2028 if (ei.HitTF)
1991 { 2029 {
1992 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 2030 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
1993 } else 2031 }
2032 else
1994 { 2033 {
1995 // fall back to our stupid functionality 2034 // fall back to our stupid functionality
1996 pos = RayEnd; 2035 pos = RayEnd;
1997 } 2036 }
1998
1999 return pos;
2000 } 2037 }
2001 } 2038 }
2002 else 2039 else
@@ -2007,8 +2044,12 @@ namespace OpenSim.Region.Framework.Scenes
2007 //increase height so its above the ground. 2044 //increase height so its above the ground.
2008 //should be getting the normal of the ground at the rez point and using that? 2045 //should be getting the normal of the ground at the rez point and using that?
2009 pos.Z += scale.Z / 2f; 2046 pos.Z += scale.Z / 2f;
2010 return pos; 2047// return pos;
2011 } 2048 }
2049
2050 // check against posible water intercept
2051 if (wpos.Z > pos.Z) pos = wpos;
2052 return pos;
2012 } 2053 }
2013 2054
2014 2055
@@ -2141,13 +2182,22 @@ namespace OpenSim.Region.Framework.Scenes
2141 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 2182 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
2142 { 2183 {
2143 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); 2184 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates);
2144 } 2185 }
2145 2186
2146 /// <summary> 2187 /// <summary>
2147 /// Delete every object from the scene. This does not include attachments worn by avatars. 2188 /// Delete every object from the scene. This does not include attachments worn by avatars.
2148 /// </summary> 2189 /// </summary>
2149 public void DeleteAllSceneObjects() 2190 public void DeleteAllSceneObjects()
2150 { 2191 {
2192 DeleteAllSceneObjects(false);
2193 }
2194
2195 /// <summary>
2196 /// Delete every object from the scene. This does not include attachments worn by avatars.
2197 /// </summary>
2198 public void DeleteAllSceneObjects(bool exceptNoCopy)
2199 {
2200 List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
2151 lock (Entities) 2201 lock (Entities)
2152 { 2202 {
2153 ICollection<EntityBase> entities = new List<EntityBase>(Entities); 2203 ICollection<EntityBase> entities = new List<EntityBase>(Entities);
@@ -2157,11 +2207,24 @@ namespace OpenSim.Region.Framework.Scenes
2157 if (e is SceneObjectGroup) 2207 if (e is SceneObjectGroup)
2158 { 2208 {
2159 SceneObjectGroup sog = (SceneObjectGroup)e; 2209 SceneObjectGroup sog = (SceneObjectGroup)e;
2160 if (!sog.IsAttachment) 2210 if (sog != null && !sog.IsAttachment)
2161 DeleteSceneObject((SceneObjectGroup)e, false); 2211 {
2212 if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0))
2213 {
2214 DeleteSceneObject((SceneObjectGroup)e, false);
2215 }
2216 else
2217 {
2218 toReturn.Add((SceneObjectGroup)e);
2219 }
2220 }
2162 } 2221 }
2163 } 2222 }
2164 } 2223 }
2224 if (toReturn.Count > 0)
2225 {
2226 returnObjects(toReturn.ToArray(), UUID.Zero);
2227 }
2165 } 2228 }
2166 2229
2167 /// <summary> 2230 /// <summary>
@@ -3148,6 +3211,16 @@ namespace OpenSim.Region.Framework.Scenes
3148 /// <param name="flags"></param> 3211 /// <param name="flags"></param>
3149 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 3212 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3150 { 3213 {
3214 //Add half the avatar's height so that the user doesn't fall through prims
3215 ScenePresence presence;
3216 if (TryGetScenePresence(remoteClient.AgentId, out presence))
3217 {
3218 if (presence.Appearance != null)
3219 {
3220 position.Z = position.Z + (presence.Appearance.AvatarHeight / 2);
3221 }
3222 }
3223
3151 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) 3224 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3152 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 3225 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3153 m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); 3226 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
@@ -3535,6 +3608,8 @@ namespace OpenSim.Region.Framework.Scenes
3535 } 3608 }
3536 } 3609 }
3537 // Honor parcel landing type and position. 3610 // Honor parcel landing type and position.
3611 /*
3612 ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
3538 if (land != null) 3613 if (land != null)
3539 { 3614 {
3540 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) 3615 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
@@ -3542,6 +3617,7 @@ namespace OpenSim.Region.Framework.Scenes
3542 agent.startpos = land.LandData.UserLocation; 3617 agent.startpos = land.LandData.UserLocation;
3543 } 3618 }
3544 } 3619 }
3620 */// This is now handled properly in ScenePresence.MakeRootAgent
3545 } 3621 }
3546 3622
3547 return true; 3623 return true;
@@ -3904,12 +3980,22 @@ namespace OpenSim.Region.Framework.Scenes
3904 return false; 3980 return false;
3905 } 3981 }
3906 3982
3983 public bool IncomingCloseAgent(UUID agentID)
3984 {
3985 return IncomingCloseAgent(agentID, false);
3986 }
3987
3988 public bool IncomingCloseChildAgent(UUID agentID)
3989 {
3990 return IncomingCloseAgent(agentID, true);
3991 }
3992
3907 /// <summary> 3993 /// <summary>
3908 /// Tell a single agent to disconnect from the region. 3994 /// Tell a single agent to disconnect from the region.
3909 /// </summary> 3995 /// </summary>
3910 /// <param name="regionHandle"></param>
3911 /// <param name="agentID"></param> 3996 /// <param name="agentID"></param>
3912 public bool IncomingCloseAgent(UUID agentID) 3997 /// <param name="childOnly"></param>
3998 public bool IncomingCloseAgent(UUID agentID, bool childOnly)
3913 { 3999 {
3914 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 4000 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
3915 4001
@@ -3921,7 +4007,7 @@ namespace OpenSim.Region.Framework.Scenes
3921 { 4007 {
3922 m_sceneGraph.removeUserCount(false); 4008 m_sceneGraph.removeUserCount(false);
3923 } 4009 }
3924 else 4010 else if (!childOnly)
3925 { 4011 {
3926 m_sceneGraph.removeUserCount(true); 4012 m_sceneGraph.removeUserCount(true);
3927 } 4013 }
@@ -3937,9 +4023,12 @@ namespace OpenSim.Region.Framework.Scenes
3937 } 4023 }
3938 else 4024 else
3939 presence.ControllingClient.SendShutdownConnectionNotice(); 4025 presence.ControllingClient.SendShutdownConnectionNotice();
4026 presence.ControllingClient.Close(false);
4027 }
4028 else if (!childOnly)
4029 {
4030 presence.ControllingClient.Close(true);
3940 } 4031 }
3941
3942 presence.ControllingClient.Close();
3943 return true; 4032 return true;
3944 } 4033 }
3945 4034