diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 139 |
1 files changed, 113 insertions, 26 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e2ab643..c5fb198 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; |
@@ -1742,6 +1770,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1742 | public void StoreWindlightProfile(RegionLightShareData wl) | 1770 | public void StoreWindlightProfile(RegionLightShareData wl) |
1743 | { | 1771 | { |
1744 | m_regInfo.WindlightSettings = wl; | 1772 | m_regInfo.WindlightSettings = wl; |
1773 | wl.Save(); | ||
1745 | m_storageManager.DataStore.StoreRegionWindlightSettings(wl); | 1774 | m_storageManager.DataStore.StoreRegionWindlightSettings(wl); |
1746 | m_eventManager.TriggerOnSaveNewWindlightProfile(); | 1775 | m_eventManager.TriggerOnSaveNewWindlightProfile(); |
1747 | } | 1776 | } |
@@ -1920,14 +1949,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1920 | /// <returns></returns> | 1949 | /// <returns></returns> |
1921 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 1950 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
1922 | { | 1951 | { |
1952 | |||
1953 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
1954 | Vector3 wpos = Vector3.Zero; | ||
1955 | // Check for water surface intersection from above | ||
1956 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
1957 | { | ||
1958 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
1959 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
1960 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
1961 | wpos.Z = wheight; | ||
1962 | } | ||
1963 | |||
1923 | Vector3 pos = Vector3.Zero; | 1964 | Vector3 pos = Vector3.Zero; |
1924 | if (RayEndIsIntersection == (byte)1) | 1965 | if (RayEndIsIntersection == (byte)1) |
1925 | { | 1966 | { |
1926 | pos = RayEnd; | 1967 | pos = RayEnd; |
1927 | return pos; | ||
1928 | } | 1968 | } |
1929 | 1969 | else if (RayTargetID != UUID.Zero) | |
1930 | if (RayTargetID != UUID.Zero) | ||
1931 | { | 1970 | { |
1932 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 1971 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
1933 | 1972 | ||
@@ -1949,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1949 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 1988 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
1950 | 1989 | ||
1951 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1990 | // 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()); | 1991 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
1953 | float ScaleOffset = 0.5f; | 1992 | float ScaleOffset = 0.5f; |
1954 | 1993 | ||
1955 | // If we hit something | 1994 | // If we hit something |
@@ -1972,13 +2011,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1972 | //pos.Z -= 0.25F; | 2011 | //pos.Z -= 0.25F; |
1973 | 2012 | ||
1974 | } | 2013 | } |
1975 | |||
1976 | return pos; | ||
1977 | } | 2014 | } |
1978 | else | 2015 | else |
1979 | { | 2016 | { |
1980 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2017 | // 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); | 2018 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
1983 | 2019 | ||
1984 | // Un-comment the following line to print the raytrace results to the console. | 2020 | // Un-comment the following line to print the raytrace results to the console. |
@@ -1987,13 +2023,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1987 | if (ei.HitTF) | 2023 | if (ei.HitTF) |
1988 | { | 2024 | { |
1989 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2025 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
1990 | } else | 2026 | } |
2027 | else | ||
1991 | { | 2028 | { |
1992 | // fall back to our stupid functionality | 2029 | // fall back to our stupid functionality |
1993 | pos = RayEnd; | 2030 | pos = RayEnd; |
1994 | } | 2031 | } |
1995 | |||
1996 | return pos; | ||
1997 | } | 2032 | } |
1998 | } | 2033 | } |
1999 | else | 2034 | else |
@@ -2004,8 +2039,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2004 | //increase height so its above the ground. | 2039 | //increase height so its above the ground. |
2005 | //should be getting the normal of the ground at the rez point and using that? | 2040 | //should be getting the normal of the ground at the rez point and using that? |
2006 | pos.Z += scale.Z / 2f; | 2041 | pos.Z += scale.Z / 2f; |
2007 | return pos; | 2042 | // return pos; |
2008 | } | 2043 | } |
2044 | |||
2045 | // check against posible water intercept | ||
2046 | if (wpos.Z > pos.Z) pos = wpos; | ||
2047 | return pos; | ||
2009 | } | 2048 | } |
2010 | 2049 | ||
2011 | 2050 | ||
@@ -2138,13 +2177,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2138 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 2177 | public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
2139 | { | 2178 | { |
2140 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); | 2179 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); |
2141 | } | 2180 | } |
2142 | 2181 | ||
2143 | /// <summary> | 2182 | /// <summary> |
2144 | /// Delete every object from the scene. This does not include attachments worn by avatars. | 2183 | /// Delete every object from the scene. This does not include attachments worn by avatars. |
2145 | /// </summary> | 2184 | /// </summary> |
2146 | public void DeleteAllSceneObjects() | 2185 | public void DeleteAllSceneObjects() |
2147 | { | 2186 | { |
2187 | DeleteAllSceneObjects(false); | ||
2188 | } | ||
2189 | |||
2190 | /// <summary> | ||
2191 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2192 | /// </summary> | ||
2193 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2194 | { | ||
2195 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2148 | lock (Entities) | 2196 | lock (Entities) |
2149 | { | 2197 | { |
2150 | ICollection<EntityBase> entities = new List<EntityBase>(Entities); | 2198 | ICollection<EntityBase> entities = new List<EntityBase>(Entities); |
@@ -2154,11 +2202,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2154 | if (e is SceneObjectGroup) | 2202 | if (e is SceneObjectGroup) |
2155 | { | 2203 | { |
2156 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2204 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2157 | if (!sog.IsAttachment) | 2205 | if (sog != null && !sog.IsAttachment) |
2158 | DeleteSceneObject((SceneObjectGroup)e, false); | 2206 | { |
2207 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2208 | { | ||
2209 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2210 | } | ||
2211 | else | ||
2212 | { | ||
2213 | toReturn.Add((SceneObjectGroup)e); | ||
2214 | } | ||
2215 | } | ||
2159 | } | 2216 | } |
2160 | } | 2217 | } |
2161 | } | 2218 | } |
2219 | if (toReturn.Count > 0) | ||
2220 | { | ||
2221 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2222 | } | ||
2162 | } | 2223 | } |
2163 | 2224 | ||
2164 | /// <summary> | 2225 | /// <summary> |
@@ -3197,6 +3258,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3197 | /// <param name="flags"></param> | 3258 | /// <param name="flags"></param> |
3198 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3259 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3199 | { | 3260 | { |
3261 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3262 | ScenePresence presence; | ||
3263 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3264 | { | ||
3265 | if (presence.Appearance != null) | ||
3266 | { | ||
3267 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3268 | } | ||
3269 | } | ||
3270 | |||
3200 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3271 | 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. | 3272 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3202 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3273 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3584,6 +3655,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3584 | } | 3655 | } |
3585 | } | 3656 | } |
3586 | // Honor parcel landing type and position. | 3657 | // Honor parcel landing type and position. |
3658 | /* | ||
3659 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3587 | if (land != null) | 3660 | if (land != null) |
3588 | { | 3661 | { |
3589 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3662 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3591,6 +3664,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3591 | agent.startpos = land.LandData.UserLocation; | 3664 | agent.startpos = land.LandData.UserLocation; |
3592 | } | 3665 | } |
3593 | } | 3666 | } |
3667 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3594 | } | 3668 | } |
3595 | 3669 | ||
3596 | return true; | 3670 | return true; |
@@ -3953,12 +4027,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3953 | return false; | 4027 | return false; |
3954 | } | 4028 | } |
3955 | 4029 | ||
4030 | public bool IncomingCloseAgent(UUID agentID) | ||
4031 | { | ||
4032 | return IncomingCloseAgent(agentID, false); | ||
4033 | } | ||
4034 | |||
4035 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4036 | { | ||
4037 | return IncomingCloseAgent(agentID, true); | ||
4038 | } | ||
4039 | |||
3956 | /// <summary> | 4040 | /// <summary> |
3957 | /// Tell a single agent to disconnect from the region. | 4041 | /// Tell a single agent to disconnect from the region. |
3958 | /// </summary> | 4042 | /// </summary> |
3959 | /// <param name="regionHandle"></param> | ||
3960 | /// <param name="agentID"></param> | 4043 | /// <param name="agentID"></param> |
3961 | public bool IncomingCloseAgent(UUID agentID) | 4044 | /// <param name="childOnly"></param> |
4045 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) | ||
3962 | { | 4046 | { |
3963 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 4047 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
3964 | 4048 | ||
@@ -3970,7 +4054,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3970 | { | 4054 | { |
3971 | m_sceneGraph.removeUserCount(false); | 4055 | m_sceneGraph.removeUserCount(false); |
3972 | } | 4056 | } |
3973 | else | 4057 | else if (!childOnly) |
3974 | { | 4058 | { |
3975 | m_sceneGraph.removeUserCount(true); | 4059 | m_sceneGraph.removeUserCount(true); |
3976 | } | 4060 | } |
@@ -3986,9 +4070,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3986 | } | 4070 | } |
3987 | else | 4071 | else |
3988 | presence.ControllingClient.SendShutdownConnectionNotice(); | 4072 | presence.ControllingClient.SendShutdownConnectionNotice(); |
4073 | presence.ControllingClient.Close(false); | ||
4074 | } | ||
4075 | else if (!childOnly) | ||
4076 | { | ||
4077 | presence.ControllingClient.Close(true); | ||
3989 | } | 4078 | } |
3990 | |||
3991 | presence.ControllingClient.Close(); | ||
3992 | return true; | 4079 | return true; |
3993 | } | 4080 | } |
3994 | 4081 | ||