diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 695 |
1 files changed, 534 insertions, 161 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d449116..8591b09 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -124,6 +124,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
124 | // TODO: need to figure out how allow client agents but deny | 124 | // TODO: need to figure out how allow client agents but deny |
125 | // root agents when ACL denies access to root agent | 125 | // root agents when ACL denies access to root agent |
126 | public bool m_strictAccessControl = true; | 126 | public bool m_strictAccessControl = true; |
127 | public bool m_seeIntoBannedRegion = false; | ||
127 | public int MaxUndoCount = 5; | 128 | public int MaxUndoCount = 5; |
128 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; | 129 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; |
129 | public bool LoginLock = false; | 130 | public bool LoginLock = false; |
@@ -139,12 +140,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
139 | 140 | ||
140 | protected int m_splitRegionID; | 141 | protected int m_splitRegionID; |
141 | protected Timer m_restartWaitTimer = new Timer(); | 142 | protected Timer m_restartWaitTimer = new Timer(); |
143 | protected Timer m_timerWatchdog = new Timer(); | ||
142 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 144 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
143 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 145 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
144 | protected string m_simulatorVersion = "OpenSimulator Server"; | 146 | protected string m_simulatorVersion = "OpenSimulator Server"; |
145 | protected ModuleLoader m_moduleLoader; | 147 | protected ModuleLoader m_moduleLoader; |
146 | protected AgentCircuitManager m_authenticateHandler; | 148 | protected AgentCircuitManager m_authenticateHandler; |
147 | protected SceneCommunicationService m_sceneGridService; | 149 | protected SceneCommunicationService m_sceneGridService; |
150 | protected ISnmpModule m_snmpService = null; | ||
148 | 151 | ||
149 | protected ISimulationDataService m_SimulationDataService; | 152 | protected ISimulationDataService m_SimulationDataService; |
150 | protected IEstateDataService m_EstateDataService; | 153 | protected IEstateDataService m_EstateDataService; |
@@ -206,7 +209,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
206 | private int m_update_events = 1; | 209 | private int m_update_events = 1; |
207 | private int m_update_backup = 200; | 210 | private int m_update_backup = 200; |
208 | private int m_update_terrain = 50; | 211 | private int m_update_terrain = 50; |
209 | // private int m_update_land = 1; | 212 | private int m_update_land = 10; |
210 | private int m_update_coarse_locations = 50; | 213 | private int m_update_coarse_locations = 50; |
211 | 214 | ||
212 | private int agentMS; | 215 | private int agentMS; |
@@ -226,6 +229,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | /// </summary> | 229 | /// </summary> |
227 | private int m_lastFrameTick; | 230 | private int m_lastFrameTick; |
228 | 231 | ||
232 | public bool CombineRegions = false; | ||
229 | /// <summary> | 233 | /// <summary> |
230 | /// Tick at which the last maintenance run occurred. | 234 | /// Tick at which the last maintenance run occurred. |
231 | /// </summary> | 235 | /// </summary> |
@@ -256,6 +260,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
256 | /// </summary> | 260 | /// </summary> |
257 | private int m_LastLogin; | 261 | private int m_LastLogin; |
258 | 262 | ||
263 | private int m_lastIncoming; | ||
264 | private int m_lastOutgoing; | ||
265 | private int m_hbRestarts = 0; | ||
266 | |||
267 | |||
259 | /// <summary> | 268 | /// <summary> |
260 | /// Thread that runs the scene loop. | 269 | /// Thread that runs the scene loop. |
261 | /// </summary> | 270 | /// </summary> |
@@ -271,7 +280,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
271 | private volatile bool m_shuttingDown; | 280 | private volatile bool m_shuttingDown; |
272 | 281 | ||
273 | // private int m_lastUpdate; | 282 | // private int m_lastUpdate; |
274 | // private bool m_firstHeartbeat = true; | 283 | private bool m_firstHeartbeat = true; |
275 | 284 | ||
276 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 285 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
277 | private bool m_reprioritizationEnabled = true; | 286 | private bool m_reprioritizationEnabled = true; |
@@ -316,6 +325,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
316 | get { return m_sceneGridService; } | 325 | get { return m_sceneGridService; } |
317 | } | 326 | } |
318 | 327 | ||
328 | public ISnmpModule SnmpService | ||
329 | { | ||
330 | get | ||
331 | { | ||
332 | if (m_snmpService == null) | ||
333 | { | ||
334 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
335 | } | ||
336 | |||
337 | return m_snmpService; | ||
338 | } | ||
339 | } | ||
340 | |||
319 | public ISimulationDataService SimulationDataService | 341 | public ISimulationDataService SimulationDataService |
320 | { | 342 | { |
321 | get | 343 | get |
@@ -616,6 +638,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
616 | m_EstateDataService = estateDataService; | 638 | m_EstateDataService = estateDataService; |
617 | m_regionHandle = m_regInfo.RegionHandle; | 639 | m_regionHandle = m_regInfo.RegionHandle; |
618 | m_regionName = m_regInfo.RegionName; | 640 | m_regionName = m_regInfo.RegionName; |
641 | m_lastIncoming = 0; | ||
642 | m_lastOutgoing = 0; | ||
619 | 643 | ||
620 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 644 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
621 | m_asyncSceneObjectDeleter.Enabled = true; | 645 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -696,102 +720,111 @@ namespace OpenSim.Region.Framework.Scenes | |||
696 | 720 | ||
697 | // Region config overrides global config | 721 | // Region config overrides global config |
698 | // | 722 | // |
699 | if (m_config.Configs["Startup"] != null) | 723 | try |
700 | { | 724 | { |
701 | IConfig startupConfig = m_config.Configs["Startup"]; | 725 | if (m_config.Configs["Startup"] != null) |
702 | |||
703 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | ||
704 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); | ||
705 | if (!m_useBackup) | ||
706 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | ||
707 | |||
708 | //Animation states | ||
709 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
710 | |||
711 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | ||
712 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | ||
713 | |||
714 | m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); | ||
715 | if (RegionInfo.NonphysPrimMax > 0) | ||
716 | { | 726 | { |
717 | m_maxNonphys = RegionInfo.NonphysPrimMax; | 727 | IConfig startupConfig = m_config.Configs["Startup"]; |
718 | } | ||
719 | |||
720 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | ||
721 | 728 | ||
722 | if (RegionInfo.PhysPrimMax > 0) | 729 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
723 | { | 730 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); |
724 | m_maxPhys = RegionInfo.PhysPrimMax; | 731 | if (!m_useBackup) |
725 | } | 732 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
733 | |||
734 | //Animation states | ||
735 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
726 | 736 | ||
727 | // Here, if clamping is requested in either global or | 737 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
728 | // local config, it will be used | 738 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
729 | // | ||
730 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | ||
731 | if (RegionInfo.ClampPrimSize) | ||
732 | { | ||
733 | m_clampPrimSize = true; | ||
734 | } | ||
735 | 739 | ||
736 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); | 740 | m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); |
737 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 741 | if (RegionInfo.NonphysPrimMax > 0) |
738 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 742 | { |
739 | m_dontPersistBefore = | 743 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
740 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 744 | } |
741 | m_dontPersistBefore *= 10000000; | ||
742 | m_persistAfter = | ||
743 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
744 | m_persistAfter *= 10000000; | ||
745 | 745 | ||
746 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 746 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
747 | 747 | ||
748 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | 748 | if (RegionInfo.PhysPrimMax > 0) |
749 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | 749 | { |
750 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
751 | } | ||
750 | 752 | ||
751 | IConfig packetConfig = m_config.Configs["PacketPool"]; | 753 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); |
752 | if (packetConfig != null) | 754 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); |
753 | { | ||
754 | PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); | ||
755 | PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); | ||
756 | } | ||
757 | 755 | ||
758 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 756 | // Here, if clamping is requested in either global or |
757 | // local config, it will be used | ||
758 | // | ||
759 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | ||
760 | if (RegionInfo.ClampPrimSize) | ||
761 | { | ||
762 | m_clampPrimSize = true; | ||
763 | } | ||
759 | 764 | ||
760 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 765 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
761 | if (m_generateMaptiles) | 766 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
762 | { | 767 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
763 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | 768 | m_dontPersistBefore = |
764 | if (maptileRefresh != 0) | 769 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); |
770 | m_dontPersistBefore *= 10000000; | ||
771 | m_persistAfter = | ||
772 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
773 | m_persistAfter *= 10000000; | ||
774 | |||
775 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | ||
776 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
777 | |||
778 | IConfig packetConfig = m_config.Configs["PacketPool"]; | ||
779 | if (packetConfig != null) | ||
765 | { | 780 | { |
766 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | 781 | PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); |
767 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | 782 | PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); |
768 | m_mapGenerationTimer.AutoReset = true; | ||
769 | m_mapGenerationTimer.Start(); | ||
770 | } | 783 | } |
771 | } | ||
772 | else | ||
773 | { | ||
774 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
775 | UUID tileID; | ||
776 | 784 | ||
777 | if (UUID.TryParse(tile, out tileID)) | 785 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
786 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
787 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
788 | |||
789 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | ||
790 | if (m_generateMaptiles) | ||
778 | { | 791 | { |
779 | RegionInfo.RegionSettings.TerrainImageID = tileID; | 792 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); |
793 | if (maptileRefresh != 0) | ||
794 | { | ||
795 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | ||
796 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
797 | m_mapGenerationTimer.AutoReset = true; | ||
798 | m_mapGenerationTimer.Start(); | ||
799 | } | ||
780 | } | 800 | } |
781 | } | 801 | else |
802 | { | ||
803 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
804 | UUID tileID; | ||
782 | 805 | ||
783 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); | 806 | if (UUID.TryParse(tile, out tileID)) |
784 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 807 | { |
785 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 808 | RegionInfo.RegionSettings.TerrainImageID = tileID; |
786 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 809 | } |
787 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 810 | } |
788 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | ||
789 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | ||
790 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | ||
791 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | ||
792 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | ||
793 | 811 | ||
794 | SendPeriodicAppearanceUpdates = startupConfig.GetBoolean("SendPeriodicAppearanceUpdates", SendPeriodicAppearanceUpdates); | 812 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); |
813 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | ||
814 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | ||
815 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | ||
816 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | ||
817 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | ||
818 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | ||
819 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | ||
820 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | ||
821 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | ||
822 | SendPeriodicAppearanceUpdates = startupConfig.GetBoolean("SendPeriodicAppearanceUpdates", SendPeriodicAppearanceUpdates); | ||
823 | } | ||
824 | } | ||
825 | catch (Exception e) | ||
826 | { | ||
827 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | ||
795 | } | 828 | } |
796 | 829 | ||
797 | #endregion Region Config | 830 | #endregion Region Config |
@@ -1218,7 +1251,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1218 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1251 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1219 | if (m_heartbeatThread != null) | 1252 | if (m_heartbeatThread != null) |
1220 | { | 1253 | { |
1254 | m_hbRestarts++; | ||
1255 | if(m_hbRestarts > 10) | ||
1256 | Environment.Exit(1); | ||
1257 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1258 | |||
1259 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1260 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1261 | //proc.EnableRaisingEvents=false; | ||
1262 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1263 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1264 | //proc.Start(); | ||
1265 | //proc.WaitForExit(); | ||
1266 | //Thread.Sleep(1000); | ||
1267 | //Environment.Exit(1); | ||
1221 | m_heartbeatThread.Abort(); | 1268 | m_heartbeatThread.Abort(); |
1269 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1222 | m_heartbeatThread = null; | 1270 | m_heartbeatThread = null; |
1223 | } | 1271 | } |
1224 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1272 | // m_lastUpdate = Util.EnvironmentTickCount(); |
@@ -1509,6 +1557,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1509 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1557 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); |
1510 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1558 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1511 | 1559 | ||
1560 | m_firstHeartbeat = false; | ||
1561 | |||
1512 | if (tmpMS > 0) | 1562 | if (tmpMS > 0) |
1513 | { | 1563 | { |
1514 | Thread.Sleep(tmpMS); | 1564 | Thread.Sleep(tmpMS); |
@@ -1559,9 +1609,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1559 | 1609 | ||
1560 | private void CheckAtTargets() | 1610 | private void CheckAtTargets() |
1561 | { | 1611 | { |
1562 | Dictionary<UUID, SceneObjectGroup>.ValueCollection objs; | 1612 | List<SceneObjectGroup> objs = new List<SceneObjectGroup>(); |
1563 | lock (m_groupsWithTargets) | 1613 | lock (m_groupsWithTargets) |
1564 | objs = m_groupsWithTargets.Values; | 1614 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); |
1565 | 1615 | ||
1566 | foreach (SceneObjectGroup entry in objs) | 1616 | foreach (SceneObjectGroup entry in objs) |
1567 | entry.checkAtTargets(); | 1617 | entry.checkAtTargets(); |
@@ -1642,7 +1692,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1642 | msg.fromAgentName = "Server"; | 1692 | msg.fromAgentName = "Server"; |
1643 | msg.dialog = (byte)19; // Object msg | 1693 | msg.dialog = (byte)19; // Object msg |
1644 | msg.fromGroup = false; | 1694 | msg.fromGroup = false; |
1645 | msg.offline = (byte)0; | 1695 | msg.offline = (byte)1; |
1646 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1696 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1647 | msg.Position = Vector3.Zero; | 1697 | msg.Position = Vector3.Zero; |
1648 | msg.RegionID = RegionInfo.RegionID.Guid; | 1698 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -1864,6 +1914,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1864 | EventManager.TriggerPrimsLoaded(this); | 1914 | EventManager.TriggerPrimsLoaded(this); |
1865 | } | 1915 | } |
1866 | 1916 | ||
1917 | public bool SuportsRayCastFiltered() | ||
1918 | { | ||
1919 | if (PhysicsScene == null) | ||
1920 | return false; | ||
1921 | return PhysicsScene.SuportsRaycastWorldFiltered(); | ||
1922 | } | ||
1923 | |||
1924 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | ||
1925 | { | ||
1926 | if (PhysicsScene == null) | ||
1927 | return null; | ||
1928 | return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); | ||
1929 | } | ||
1867 | 1930 | ||
1868 | /// <summary> | 1931 | /// <summary> |
1869 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. | 1932 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. |
@@ -1880,14 +1943,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1880 | /// <returns></returns> | 1943 | /// <returns></returns> |
1881 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 1944 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
1882 | { | 1945 | { |
1946 | |||
1947 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
1948 | Vector3 wpos = Vector3.Zero; | ||
1949 | // Check for water surface intersection from above | ||
1950 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
1951 | { | ||
1952 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
1953 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
1954 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
1955 | wpos.Z = wheight; | ||
1956 | } | ||
1957 | |||
1883 | Vector3 pos = Vector3.Zero; | 1958 | Vector3 pos = Vector3.Zero; |
1884 | if (RayEndIsIntersection == (byte)1) | 1959 | if (RayEndIsIntersection == (byte)1) |
1885 | { | 1960 | { |
1886 | pos = RayEnd; | 1961 | pos = RayEnd; |
1887 | return pos; | ||
1888 | } | 1962 | } |
1889 | 1963 | else if (RayTargetID != UUID.Zero) | |
1890 | if (RayTargetID != UUID.Zero) | ||
1891 | { | 1964 | { |
1892 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 1965 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
1893 | 1966 | ||
@@ -1909,7 +1982,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1909 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 1982 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
1910 | 1983 | ||
1911 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1984 | // Un-comment out the following line to Get Raytrace results printed to the console. |
1912 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 1985 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
1913 | float ScaleOffset = 0.5f; | 1986 | float ScaleOffset = 0.5f; |
1914 | 1987 | ||
1915 | // If we hit something | 1988 | // If we hit something |
@@ -1932,13 +2005,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1932 | //pos.Z -= 0.25F; | 2005 | //pos.Z -= 0.25F; |
1933 | 2006 | ||
1934 | } | 2007 | } |
1935 | |||
1936 | return pos; | ||
1937 | } | 2008 | } |
1938 | else | 2009 | else |
1939 | { | 2010 | { |
1940 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2011 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
1941 | |||
1942 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2012 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
1943 | 2013 | ||
1944 | // Un-comment the following line to print the raytrace results to the console. | 2014 | // Un-comment the following line to print the raytrace results to the console. |
@@ -1947,13 +2017,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1947 | if (ei.HitTF) | 2017 | if (ei.HitTF) |
1948 | { | 2018 | { |
1949 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2019 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
1950 | } else | 2020 | } |
2021 | else | ||
1951 | { | 2022 | { |
1952 | // fall back to our stupid functionality | 2023 | // fall back to our stupid functionality |
1953 | pos = RayEnd; | 2024 | pos = RayEnd; |
1954 | } | 2025 | } |
1955 | |||
1956 | return pos; | ||
1957 | } | 2026 | } |
1958 | } | 2027 | } |
1959 | else | 2028 | else |
@@ -1964,8 +2033,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1964 | //increase height so its above the ground. | 2033 | //increase height so its above the ground. |
1965 | //should be getting the normal of the ground at the rez point and using that? | 2034 | //should be getting the normal of the ground at the rez point and using that? |
1966 | pos.Z += scale.Z / 2f; | 2035 | pos.Z += scale.Z / 2f; |
1967 | return pos; | 2036 | // return pos; |
1968 | } | 2037 | } |
2038 | |||
2039 | // check against posible water intercept | ||
2040 | if (wpos.Z > pos.Z) pos = wpos; | ||
2041 | return pos; | ||
1969 | } | 2042 | } |
1970 | 2043 | ||
1971 | 2044 | ||
@@ -2054,7 +2127,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2054 | public bool AddRestoredSceneObject( | 2127 | public bool AddRestoredSceneObject( |
2055 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 2128 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
2056 | { | 2129 | { |
2057 | return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); | 2130 | bool result = m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); |
2131 | if (result) | ||
2132 | sceneObject.IsDeleted = false; | ||
2133 | return result; | ||
2058 | } | 2134 | } |
2059 | 2135 | ||
2060 | /// <summary> | 2136 | /// <summary> |
@@ -2146,6 +2222,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2146 | /// </summary> | 2222 | /// </summary> |
2147 | public void DeleteAllSceneObjects() | 2223 | public void DeleteAllSceneObjects() |
2148 | { | 2224 | { |
2225 | DeleteAllSceneObjects(false); | ||
2226 | } | ||
2227 | |||
2228 | /// <summary> | ||
2229 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2230 | /// </summary> | ||
2231 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2232 | { | ||
2233 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2149 | lock (Entities) | 2234 | lock (Entities) |
2150 | { | 2235 | { |
2151 | EntityBase[] entities = Entities.GetEntities(); | 2236 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2154,11 +2239,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2154 | if (e is SceneObjectGroup) | 2239 | if (e is SceneObjectGroup) |
2155 | { | 2240 | { |
2156 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2241 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2157 | if (!sog.IsAttachment) | 2242 | if (sog != null && !sog.IsAttachment) |
2158 | DeleteSceneObject((SceneObjectGroup)e, false); | 2243 | { |
2244 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2245 | { | ||
2246 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2247 | } | ||
2248 | else | ||
2249 | { | ||
2250 | toReturn.Add((SceneObjectGroup)e); | ||
2251 | } | ||
2252 | } | ||
2159 | } | 2253 | } |
2160 | } | 2254 | } |
2161 | } | 2255 | } |
2256 | if (toReturn.Count > 0) | ||
2257 | { | ||
2258 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2259 | } | ||
2162 | } | 2260 | } |
2163 | 2261 | ||
2164 | /// <summary> | 2262 | /// <summary> |
@@ -2193,6 +2291,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2193 | } | 2291 | } |
2194 | 2292 | ||
2195 | group.DeleteGroupFromScene(silent); | 2293 | group.DeleteGroupFromScene(silent); |
2294 | if (!silent) | ||
2295 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2196 | 2296 | ||
2197 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2297 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2198 | } | 2298 | } |
@@ -2482,6 +2582,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2482 | 2582 | ||
2483 | if (newPosition != Vector3.Zero) | 2583 | if (newPosition != Vector3.Zero) |
2484 | newObject.RootPart.GroupPosition = newPosition; | 2584 | newObject.RootPart.GroupPosition = newPosition; |
2585 | if (newObject.RootPart.KeyframeMotion != null) | ||
2586 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2485 | 2587 | ||
2486 | if (!AddSceneObject(newObject)) | 2588 | if (!AddSceneObject(newObject)) |
2487 | { | 2589 | { |
@@ -2550,10 +2652,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2550 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2652 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2551 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2653 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2552 | { | 2654 | { |
2655 | if (sceneObject.OwnerID == UUID.Zero) | ||
2656 | { | ||
2657 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2658 | return false; | ||
2659 | } | ||
2660 | |||
2553 | // If the user is banned, we won't let any of their objects | 2661 | // If the user is banned, we won't let any of their objects |
2554 | // enter. Period. | 2662 | // enter. Period. |
2555 | // | 2663 | // |
2556 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID)) | 2664 | int flags = GetUserFlags(sceneObject.OwnerID); |
2665 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2557 | { | 2666 | { |
2558 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | 2667 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); |
2559 | 2668 | ||
@@ -2595,16 +2704,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2595 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2704 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2596 | 2705 | ||
2597 | if (AttachmentsModule != null) | 2706 | if (AttachmentsModule != null) |
2598 | AttachmentsModule.AttachObject(sp, grp, 0, false); | 2707 | AttachmentsModule.AttachObject(sp, grp, 0, false, false); |
2599 | } | 2708 | } |
2600 | else | 2709 | else |
2601 | { | 2710 | { |
2711 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2602 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2712 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2603 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2713 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2604 | } | 2714 | } |
2715 | if (sceneObject.OwnerID == UUID.Zero) | ||
2716 | { | ||
2717 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2718 | return false; | ||
2719 | } | ||
2605 | } | 2720 | } |
2606 | else | 2721 | else |
2607 | { | 2722 | { |
2723 | if (sceneObject.OwnerID == UUID.Zero) | ||
2724 | { | ||
2725 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2726 | return false; | ||
2727 | } | ||
2608 | AddRestoredSceneObject(sceneObject, true, false); | 2728 | AddRestoredSceneObject(sceneObject, true, false); |
2609 | 2729 | ||
2610 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | 2730 | if (!Permissions.CanObjectEntry(sceneObject.UUID, |
@@ -2633,6 +2753,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2633 | return 2; // StateSource.PrimCrossing | 2753 | return 2; // StateSource.PrimCrossing |
2634 | } | 2754 | } |
2635 | 2755 | ||
2756 | public int GetUserFlags(UUID user) | ||
2757 | { | ||
2758 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2759 | /* | ||
2760 | ScenePresence sp; | ||
2761 | if (TryGetScenePresence(user, out sp)) | ||
2762 | { | ||
2763 | return sp.UserFlags; | ||
2764 | } | ||
2765 | else | ||
2766 | { | ||
2767 | */ | ||
2768 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2769 | if (uac == null) | ||
2770 | return 0; | ||
2771 | return uac.UserFlags; | ||
2772 | //} | ||
2773 | } | ||
2636 | #endregion | 2774 | #endregion |
2637 | 2775 | ||
2638 | #region Add/Remove Avatar Methods | 2776 | #region Add/Remove Avatar Methods |
@@ -2646,7 +2784,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2646 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2784 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2647 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2785 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2648 | 2786 | ||
2649 | // CheckHeartbeat(); | 2787 | CheckHeartbeat(); |
2650 | 2788 | ||
2651 | ScenePresence sp = GetScenePresence(client.AgentId); | 2789 | ScenePresence sp = GetScenePresence(client.AgentId); |
2652 | 2790 | ||
@@ -2700,7 +2838,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2700 | 2838 | ||
2701 | EventManager.TriggerOnNewClient(client); | 2839 | EventManager.TriggerOnNewClient(client); |
2702 | if (vialogin) | 2840 | if (vialogin) |
2841 | { | ||
2703 | EventManager.TriggerOnClientLogin(client); | 2842 | EventManager.TriggerOnClientLogin(client); |
2843 | // Send initial parcel data | ||
2844 | Vector3 pos = sp.AbsolutePosition; | ||
2845 | ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); | ||
2846 | land.SendLandUpdateToClient(client); | ||
2847 | } | ||
2704 | 2848 | ||
2705 | return sp; | 2849 | return sp; |
2706 | } | 2850 | } |
@@ -2789,19 +2933,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2789 | // and the scene presence and the client, if they exist | 2933 | // and the scene presence and the client, if they exist |
2790 | try | 2934 | try |
2791 | { | 2935 | { |
2792 | // We need to wait for the client to make UDP contact first. | 2936 | ScenePresence sp = GetScenePresence(agentID); |
2793 | // It's the UDP contact that creates the scene presence | 2937 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2794 | ScenePresence sp = WaitGetScenePresence(agentID); | 2938 | |
2795 | if (sp != null) | 2939 | if (sp != null) |
2796 | { | ||
2797 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | ||
2798 | |||
2799 | sp.ControllingClient.Close(); | 2940 | sp.ControllingClient.Close(); |
2800 | } | 2941 | |
2801 | else | ||
2802 | { | ||
2803 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2804 | } | ||
2805 | // BANG! SLASH! | 2942 | // BANG! SLASH! |
2806 | m_authenticateHandler.RemoveCircuit(agentID); | 2943 | m_authenticateHandler.RemoveCircuit(agentID); |
2807 | 2944 | ||
@@ -2846,6 +2983,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2846 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 2983 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2847 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 2984 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2848 | 2985 | ||
2986 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
2987 | |||
2849 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 2988 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2850 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 2989 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2851 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 2990 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -2902,6 +3041,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2902 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3041 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
2903 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3042 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
2904 | client.OnCopyInventoryItem += CopyInventoryItem; | 3043 | client.OnCopyInventoryItem += CopyInventoryItem; |
3044 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
2905 | client.OnMoveInventoryItem += MoveInventoryItem; | 3045 | client.OnMoveInventoryItem += MoveInventoryItem; |
2906 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3046 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
2907 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3047 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -2973,6 +3113,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2973 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3113 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
2974 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3114 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
2975 | 3115 | ||
3116 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3117 | |||
2976 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3118 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
2977 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3119 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
2978 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3120 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3075,7 +3217,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3075 | /// </summary> | 3217 | /// </summary> |
3076 | /// <param name="agentId">The avatar's Unique ID</param> | 3218 | /// <param name="agentId">The avatar's Unique ID</param> |
3077 | /// <param name="client">The IClientAPI for the client</param> | 3219 | /// <param name="client">The IClientAPI for the client</param> |
3078 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3220 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3079 | { | 3221 | { |
3080 | if (EntityTransferModule != null) | 3222 | if (EntityTransferModule != null) |
3081 | { | 3223 | { |
@@ -3086,6 +3228,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3086 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3228 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
3087 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3229 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3088 | } | 3230 | } |
3231 | return false; | ||
3089 | } | 3232 | } |
3090 | 3233 | ||
3091 | /// <summary> | 3234 | /// <summary> |
@@ -3195,6 +3338,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3195 | /// <param name="flags"></param> | 3338 | /// <param name="flags"></param> |
3196 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3339 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3197 | { | 3340 | { |
3341 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3342 | ScenePresence presence; | ||
3343 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3344 | { | ||
3345 | if (presence.Appearance != null) | ||
3346 | { | ||
3347 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3348 | } | ||
3349 | } | ||
3350 | |||
3198 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3351 | 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. | 3352 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3200 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3353 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3323,6 +3476,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3323 | avatar.Close(); | 3476 | avatar.Close(); |
3324 | 3477 | ||
3325 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3478 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3479 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3326 | } | 3480 | } |
3327 | catch (Exception e) | 3481 | catch (Exception e) |
3328 | { | 3482 | { |
@@ -3472,13 +3626,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3472 | sp = null; | 3626 | sp = null; |
3473 | } | 3627 | } |
3474 | 3628 | ||
3475 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3476 | 3629 | ||
3477 | //On login test land permisions | 3630 | //On login test land permisions |
3478 | if (vialogin) | 3631 | if (vialogin) |
3479 | { | 3632 | { |
3480 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3633 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3634 | if (cache != null) | ||
3635 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3636 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3481 | { | 3637 | { |
3638 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3482 | return false; | 3639 | return false; |
3483 | } | 3640 | } |
3484 | } | 3641 | } |
@@ -3501,9 +3658,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3501 | 3658 | ||
3502 | try | 3659 | try |
3503 | { | 3660 | { |
3504 | if (!AuthorizeUser(agent, out reason)) | 3661 | // Always check estate if this is a login. Always |
3505 | return false; | 3662 | // check if banned regions are to be blacked out. |
3506 | } catch (Exception e) | 3663 | if (vialogin || (!m_seeIntoBannedRegion)) |
3664 | { | ||
3665 | if (!AuthorizeUser(agent, out reason)) | ||
3666 | return false; | ||
3667 | } | ||
3668 | } | ||
3669 | catch (Exception e) | ||
3507 | { | 3670 | { |
3508 | m_log.ErrorFormat( | 3671 | m_log.ErrorFormat( |
3509 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3672 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
@@ -3634,6 +3797,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3634 | } | 3797 | } |
3635 | 3798 | ||
3636 | // Honor parcel landing type and position. | 3799 | // Honor parcel landing type and position. |
3800 | /* | ||
3801 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3637 | if (land != null) | 3802 | if (land != null) |
3638 | { | 3803 | { |
3639 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3804 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3641,25 +3806,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
3641 | agent.startpos = land.LandData.UserLocation; | 3806 | agent.startpos = land.LandData.UserLocation; |
3642 | } | 3807 | } |
3643 | } | 3808 | } |
3809 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3644 | } | 3810 | } |
3645 | 3811 | ||
3646 | return true; | 3812 | return true; |
3647 | } | 3813 | } |
3648 | 3814 | ||
3649 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 3815 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3650 | { | 3816 | { |
3651 | bool banned = land.IsBannedFromLand(agent.AgentID); | 3817 | reason = String.Empty; |
3652 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 3818 | if (Permissions.IsGod(agentID)) |
3819 | return true; | ||
3820 | |||
3821 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
3822 | if (land == null) | ||
3823 | return false; | ||
3824 | |||
3825 | bool banned = land.IsBannedFromLand(agentID); | ||
3826 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3653 | 3827 | ||
3654 | if (banned || restricted) | 3828 | if (banned || restricted) |
3655 | { | 3829 | { |
3656 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 3830 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3657 | if (nearestParcel != null) | 3831 | if (nearestParcel != null) |
3658 | { | 3832 | { |
3659 | //Move agent to nearest allowed | 3833 | //Move agent to nearest allowed |
3660 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 3834 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3661 | agent.startpos.X = newPosition.X; | 3835 | posX = newPosition.X; |
3662 | agent.startpos.Y = newPosition.Y; | 3836 | posY = newPosition.Y; |
3663 | } | 3837 | } |
3664 | else | 3838 | else |
3665 | { | 3839 | { |
@@ -3721,7 +3895,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3721 | 3895 | ||
3722 | if (!m_strictAccessControl) return true; | 3896 | if (!m_strictAccessControl) return true; |
3723 | if (Permissions.IsGod(agent.AgentID)) return true; | 3897 | if (Permissions.IsGod(agent.AgentID)) return true; |
3724 | 3898 | ||
3725 | if (AuthorizationService != null) | 3899 | if (AuthorizationService != null) |
3726 | { | 3900 | { |
3727 | if (!AuthorizationService.IsAuthorizedForRegion( | 3901 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3736,7 +3910,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3736 | 3910 | ||
3737 | if (m_regInfo.EstateSettings != null) | 3911 | if (m_regInfo.EstateSettings != null) |
3738 | { | 3912 | { |
3739 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) | 3913 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID,0)) |
3740 | { | 3914 | { |
3741 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 3915 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3742 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 3916 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -3926,6 +4100,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3926 | 4100 | ||
3927 | // XPTO: if this agent is not allowed here as root, always return false | 4101 | // XPTO: if this agent is not allowed here as root, always return false |
3928 | 4102 | ||
4103 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4104 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4105 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4106 | if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4107 | { | ||
4108 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4109 | return false; | ||
4110 | } | ||
4111 | |||
3929 | // TODO: This check should probably be in QueryAccess(). | 4112 | // TODO: This check should probably be in QueryAccess(). |
3930 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4113 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
3931 | if (nearestParcel == null) | 4114 | if (nearestParcel == null) |
@@ -4019,12 +4202,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
4019 | return false; | 4202 | return false; |
4020 | } | 4203 | } |
4021 | 4204 | ||
4205 | public bool IncomingCloseAgent(UUID agentID) | ||
4206 | { | ||
4207 | return IncomingCloseAgent(agentID, false); | ||
4208 | } | ||
4209 | |||
4210 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4211 | { | ||
4212 | return IncomingCloseAgent(agentID, true); | ||
4213 | } | ||
4214 | |||
4022 | /// <summary> | 4215 | /// <summary> |
4023 | /// Tell a single agent to disconnect from the region. | 4216 | /// Tell a single agent to disconnect from the region. |
4024 | /// </summary> | 4217 | /// </summary> |
4025 | /// <param name="regionHandle"></param> | ||
4026 | /// <param name="agentID"></param> | 4218 | /// <param name="agentID"></param> |
4027 | public bool IncomingCloseAgent(UUID agentID) | 4219 | /// <param name="childOnly"></param> |
4220 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) | ||
4028 | { | 4221 | { |
4029 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 4222 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
4030 | 4223 | ||
@@ -4617,35 +4810,81 @@ namespace OpenSim.Region.Framework.Scenes | |||
4617 | SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); | 4810 | SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); |
4618 | } | 4811 | } |
4619 | 4812 | ||
4620 | public int GetHealth() | 4813 | public int GetHealth(out int flags, out string message) |
4621 | { | 4814 | { |
4622 | // Returns: | 4815 | // Returns: |
4623 | // 1 = sim is up and accepting http requests. The heartbeat has | 4816 | // 1 = sim is up and accepting http requests. The heartbeat has |
4624 | // stopped and the sim is probably locked up, but a remote | 4817 | // stopped and the sim is probably locked up, but a remote |
4625 | // admin restart may succeed | 4818 | // admin restart may succeed |
4626 | // | 4819 | // |
4627 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 4820 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4628 | // usable for people within and logins _may_ work | 4821 | // usable for people within |
4822 | // | ||
4823 | // 3 = Sim is up and one packet thread is running. Sim is | ||
4824 | // unstable and will not accept new logins | ||
4629 | // | 4825 | // |
4630 | // 3 = We have seen a new user enter within the past 4 minutes | 4826 | // 4 = Sim is up and both packet threads are running. Sim is |
4827 | // likely usable | ||
4828 | // | ||
4829 | // 5 = We have seen a new user enter within the past 4 minutes | ||
4631 | // which can be seen as positive confirmation of sim health | 4830 | // which can be seen as positive confirmation of sim health |
4632 | // | 4831 | // |
4832 | |||
4833 | flags = 0; | ||
4834 | message = String.Empty; | ||
4835 | |||
4836 | CheckHeartbeat(); | ||
4837 | |||
4838 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
4839 | { | ||
4840 | // We're still starting | ||
4841 | // 0 means "in startup", it can't happen another way, since | ||
4842 | // to get here, we must be able to accept http connections | ||
4843 | return 0; | ||
4844 | } | ||
4845 | |||
4633 | int health=1; // Start at 1, means we're up | 4846 | int health=1; // Start at 1, means we're up |
4634 | 4847 | ||
4635 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 4848 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4636 | health += 1; | 4849 | { |
4850 | health+=1; | ||
4851 | flags |= 1; | ||
4852 | } | ||
4853 | |||
4854 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
4855 | { | ||
4856 | health+=1; | ||
4857 | flags |= 2; | ||
4858 | } | ||
4859 | |||
4860 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
4861 | { | ||
4862 | health+=1; | ||
4863 | flags |= 4; | ||
4864 | } | ||
4637 | else | 4865 | else |
4866 | { | ||
4867 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
4868 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
4869 | proc.EnableRaisingEvents=false; | ||
4870 | proc.StartInfo.FileName = "/bin/kill"; | ||
4871 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
4872 | proc.Start(); | ||
4873 | proc.WaitForExit(); | ||
4874 | Thread.Sleep(1000); | ||
4875 | Environment.Exit(1); | ||
4876 | } | ||
4877 | |||
4878 | if (flags != 7) | ||
4638 | return health; | 4879 | return health; |
4639 | 4880 | ||
4640 | // A login in the last 4 mins? We can't be doing too badly | 4881 | // A login in the last 4 mins? We can't be doing too badly |
4641 | // | 4882 | // |
4642 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 4883 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4643 | health++; | 4884 | health++; |
4644 | else | 4885 | else |
4645 | return health; | 4886 | return health; |
4646 | 4887 | ||
4647 | // CheckHeartbeat(); | ||
4648 | |||
4649 | return health; | 4888 | return health; |
4650 | } | 4889 | } |
4651 | 4890 | ||
@@ -4733,7 +4972,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4733 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 4972 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
4734 | if (wasUsingPhysics) | 4973 | if (wasUsingPhysics) |
4735 | { | 4974 | { |
4736 | jointProxyObject.UpdatePrimFlags(false, false, true, false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock | 4975 | jointProxyObject.UpdatePrimFlags(false, false, true, false,false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock |
4737 | } | 4976 | } |
4738 | } | 4977 | } |
4739 | 4978 | ||
@@ -4832,14 +5071,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4832 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5071 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
4833 | } | 5072 | } |
4834 | 5073 | ||
4835 | // private void CheckHeartbeat() | 5074 | private void CheckHeartbeat() |
4836 | // { | 5075 | { |
4837 | // if (m_firstHeartbeat) | 5076 | if (m_firstHeartbeat) |
4838 | // return; | 5077 | return; |
4839 | // | 5078 | |
4840 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5079 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
4841 | // StartTimer(); | 5080 | Start(); |
4842 | // } | 5081 | } |
4843 | 5082 | ||
4844 | public override ISceneObject DeserializeObject(string representation) | 5083 | public override ISceneObject DeserializeObject(string representation) |
4845 | { | 5084 | { |
@@ -4851,9 +5090,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4851 | get { return m_allowScriptCrossings; } | 5090 | get { return m_allowScriptCrossings; } |
4852 | } | 5091 | } |
4853 | 5092 | ||
4854 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 5093 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
5094 | { | ||
5095 | return GetNearestAllowedPosition(avatar, null); | ||
5096 | } | ||
5097 | |||
5098 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
4855 | { | 5099 | { |
4856 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 5100 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); |
4857 | 5101 | ||
4858 | if (nearestParcel != null) | 5102 | if (nearestParcel != null) |
4859 | { | 5103 | { |
@@ -4862,10 +5106,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4862 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5106 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
4863 | if (nearestPoint != null) | 5107 | if (nearestPoint != null) |
4864 | { | 5108 | { |
4865 | // m_log.DebugFormat( | 5109 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
4866 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
4867 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
4868 | |||
4869 | return nearestPoint.Value; | 5110 | return nearestPoint.Value; |
4870 | } | 5111 | } |
4871 | 5112 | ||
@@ -4875,17 +5116,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
4875 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5116 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
4876 | if (nearestPoint != null) | 5117 | if (nearestPoint != null) |
4877 | { | 5118 | { |
4878 | // m_log.DebugFormat( | 5119 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
4879 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
4880 | |||
4881 | return nearestPoint.Value; | 5120 | return nearestPoint.Value; |
4882 | } | 5121 | } |
4883 | 5122 | ||
4884 | //Ultimate backup if we have no idea where they are | 5123 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
4885 | // m_log.DebugFormat( | 5124 | if (dest != excludeParcel) |
4886 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 5125 | { |
5126 | // Ultimate backup if we have no idea where they are and | ||
5127 | // the last allowed position was in another parcel | ||
5128 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
5129 | return avatar.lastKnownAllowedPosition; | ||
5130 | } | ||
4887 | 5131 | ||
4888 | return avatar.lastKnownAllowedPosition; | 5132 | // else fall through to region edge |
4889 | } | 5133 | } |
4890 | 5134 | ||
4891 | //Go to the edge, this happens in teleporting to a region with no available parcels | 5135 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -4919,13 +5163,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
4919 | 5163 | ||
4920 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 5164 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
4921 | { | 5165 | { |
5166 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
5167 | } | ||
5168 | |||
5169 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
5170 | { | ||
4922 | List<ILandObject> all = AllParcels(); | 5171 | List<ILandObject> all = AllParcels(); |
4923 | float minParcelDistance = float.MaxValue; | 5172 | float minParcelDistance = float.MaxValue; |
4924 | ILandObject nearestParcel = null; | 5173 | ILandObject nearestParcel = null; |
4925 | 5174 | ||
4926 | foreach (var parcel in all) | 5175 | foreach (var parcel in all) |
4927 | { | 5176 | { |
4928 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 5177 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
4929 | { | 5178 | { |
4930 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 5179 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
4931 | if (parcelDistance < minParcelDistance) | 5180 | if (parcelDistance < minParcelDistance) |
@@ -5167,7 +5416,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5167 | mapModule.GenerateMaptile(); | 5416 | mapModule.GenerateMaptile(); |
5168 | } | 5417 | } |
5169 | 5418 | ||
5170 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5419 | // public void CleanDroppedAttachments() |
5420 | // { | ||
5421 | // List<SceneObjectGroup> objectsToDelete = | ||
5422 | // new List<SceneObjectGroup>(); | ||
5423 | // | ||
5424 | // lock (m_cleaningAttachments) | ||
5425 | // { | ||
5426 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5427 | // { | ||
5428 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5429 | // { | ||
5430 | // UUID agentID = grp.OwnerID; | ||
5431 | // if (agentID == UUID.Zero) | ||
5432 | // { | ||
5433 | // objectsToDelete.Add(grp); | ||
5434 | // return; | ||
5435 | // } | ||
5436 | // | ||
5437 | // ScenePresence sp = GetScenePresence(agentID); | ||
5438 | // if (sp == null) | ||
5439 | // { | ||
5440 | // objectsToDelete.Add(grp); | ||
5441 | // return; | ||
5442 | // } | ||
5443 | // } | ||
5444 | // }); | ||
5445 | // } | ||
5446 | // | ||
5447 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5448 | // { | ||
5449 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5450 | // DeleteSceneObject(grp, true); | ||
5451 | // } | ||
5452 | // } | ||
5453 | |||
5454 | public void ThreadAlive(int threadCode) | ||
5455 | { | ||
5456 | switch(threadCode) | ||
5457 | { | ||
5458 | case 1: // Incoming | ||
5459 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5460 | break; | ||
5461 | case 2: // Incoming | ||
5462 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5463 | break; | ||
5464 | } | ||
5465 | } | ||
5466 | |||
5467 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5171 | { | 5468 | { |
5172 | RegenerateMaptile(); | 5469 | RegenerateMaptile(); |
5173 | 5470 | ||
@@ -5195,6 +5492,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5195 | /// <returns></returns> | 5492 | /// <returns></returns> |
5196 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5493 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5197 | { | 5494 | { |
5495 | reason = "You are banned from the region"; | ||
5496 | |||
5198 | if (EntityTransferModule.IsInTransit(agentID)) | 5497 | if (EntityTransferModule.IsInTransit(agentID)) |
5199 | { | 5498 | { |
5200 | reason = "Agent is still in transit from this region"; | 5499 | reason = "Agent is still in transit from this region"; |
@@ -5206,6 +5505,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5206 | return false; | 5505 | return false; |
5207 | } | 5506 | } |
5208 | 5507 | ||
5508 | if (Permissions.IsGod(agentID)) | ||
5509 | { | ||
5510 | reason = String.Empty; | ||
5511 | return true; | ||
5512 | } | ||
5513 | |||
5209 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5514 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5210 | // However, the long term fix is to make sure root agent count is always accurate. | 5515 | // However, the long term fix is to make sure root agent count is always accurate. |
5211 | m_sceneGraph.RecalculateStats(); | 5516 | m_sceneGraph.RecalculateStats(); |
@@ -5226,6 +5531,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5226 | } | 5531 | } |
5227 | } | 5532 | } |
5228 | 5533 | ||
5534 | ScenePresence presence = GetScenePresence(agentID); | ||
5535 | IClientAPI client = null; | ||
5536 | AgentCircuitData aCircuit = null; | ||
5537 | |||
5538 | if (presence != null) | ||
5539 | { | ||
5540 | client = presence.ControllingClient; | ||
5541 | if (client != null) | ||
5542 | aCircuit = client.RequestClientInfo(); | ||
5543 | } | ||
5544 | |||
5545 | // We may be called before there is a presence or a client. | ||
5546 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5547 | if (client == null) | ||
5548 | { | ||
5549 | aCircuit = new AgentCircuitData(); | ||
5550 | aCircuit.AgentID = agentID; | ||
5551 | aCircuit.firstname = String.Empty; | ||
5552 | aCircuit.lastname = String.Empty; | ||
5553 | } | ||
5554 | |||
5555 | try | ||
5556 | { | ||
5557 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5558 | { | ||
5559 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5560 | return false; | ||
5561 | } | ||
5562 | } | ||
5563 | catch (Exception e) | ||
5564 | { | ||
5565 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5566 | return false; | ||
5567 | } | ||
5568 | |||
5229 | if (position == Vector3.Zero) // Teleport | 5569 | if (position == Vector3.Zero) // Teleport |
5230 | { | 5570 | { |
5231 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5571 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5254,13 +5594,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5254 | } | 5594 | } |
5255 | } | 5595 | } |
5256 | } | 5596 | } |
5597 | |||
5598 | float posX = 128.0f; | ||
5599 | float posY = 128.0f; | ||
5600 | |||
5601 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5602 | { | ||
5603 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5604 | return false; | ||
5605 | } | ||
5606 | } | ||
5607 | else // Walking | ||
5608 | { | ||
5609 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5610 | if (land == null) | ||
5611 | return false; | ||
5612 | |||
5613 | bool banned = land.IsBannedFromLand(agentID); | ||
5614 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5615 | |||
5616 | if (banned || restricted) | ||
5617 | return false; | ||
5257 | } | 5618 | } |
5258 | 5619 | ||
5259 | reason = String.Empty; | 5620 | reason = String.Empty; |
5260 | return true; | 5621 | return true; |
5261 | } | 5622 | } |
5262 | 5623 | ||
5263 | /// <summary> | 5624 | public void StartTimerWatchdog() |
5625 | { | ||
5626 | m_timerWatchdog.Interval = 1000; | ||
5627 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5628 | m_timerWatchdog.AutoReset = true; | ||
5629 | m_timerWatchdog.Start(); | ||
5630 | } | ||
5631 | |||
5632 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5633 | { | ||
5634 | CheckHeartbeat(); | ||
5635 | } | ||
5636 | |||
5264 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5637 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5265 | /// autopilot that moves an avatar to a sit target!. | 5638 | /// autopilot that moves an avatar to a sit target!. |
5266 | /// </summary> | 5639 | /// </summary> |