diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 722 |
1 files changed, 569 insertions, 153 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 14dac7a..92d0aff 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -226,8 +226,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | // TODO: need to figure out how allow client agents but deny | 226 | // TODO: need to figure out how allow client agents but deny |
227 | // root agents when ACL denies access to root agent | 227 | // root agents when ACL denies access to root agent |
228 | public bool m_strictAccessControl = true; | 228 | public bool m_strictAccessControl = true; |
229 | 229 | public bool m_seeIntoBannedRegion = false; | |
230 | public int MaxUndoCount { get; set; } | 230 | public int MaxUndoCount = 5; |
231 | 231 | ||
232 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; | 232 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; |
233 | public bool LoginLock = false; | 233 | public bool LoginLock = false; |
@@ -243,11 +243,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
243 | 243 | ||
244 | protected int m_splitRegionID; | 244 | protected int m_splitRegionID; |
245 | protected Timer m_restartWaitTimer = new Timer(); | 245 | protected Timer m_restartWaitTimer = new Timer(); |
246 | protected Timer m_timerWatchdog = new Timer(); | ||
246 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 247 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
247 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 248 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
248 | protected string m_simulatorVersion = "OpenSimulator Server"; | 249 | protected string m_simulatorVersion = "OpenSimulator Server"; |
249 | protected AgentCircuitManager m_authenticateHandler; | 250 | protected AgentCircuitManager m_authenticateHandler; |
250 | protected SceneCommunicationService m_sceneGridService; | 251 | protected SceneCommunicationService m_sceneGridService; |
252 | protected ISnmpModule m_snmpService = null; | ||
251 | 253 | ||
252 | protected ISimulationDataService m_SimulationDataService; | 254 | protected ISimulationDataService m_SimulationDataService; |
253 | protected IEstateDataService m_EstateDataService; | 255 | protected IEstateDataService m_EstateDataService; |
@@ -310,8 +312,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
310 | private int m_update_presences = 1; // Update scene presence movements | 312 | private int m_update_presences = 1; // Update scene presence movements |
311 | private int m_update_events = 1; | 313 | private int m_update_events = 1; |
312 | private int m_update_backup = 200; | 314 | private int m_update_backup = 200; |
313 | private int m_update_terrain = 50; | 315 | private int m_update_terrain = 1000; |
314 | // private int m_update_land = 1; | 316 | private int m_update_land = 10; |
315 | private int m_update_coarse_locations = 50; | 317 | private int m_update_coarse_locations = 50; |
316 | 318 | ||
317 | private int agentMS; | 319 | private int agentMS; |
@@ -324,13 +326,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
324 | private int backupMS; | 326 | private int backupMS; |
325 | private int terrainMS; | 327 | private int terrainMS; |
326 | private int landMS; | 328 | private int landMS; |
327 | private int spareMS; | ||
328 | 329 | ||
329 | /// <summary> | 330 | /// <summary> |
330 | /// Tick at which the last frame was processed. | 331 | /// Tick at which the last frame was processed. |
331 | /// </summary> | 332 | /// </summary> |
332 | private int m_lastFrameTick; | 333 | private int m_lastFrameTick; |
333 | 334 | ||
335 | public bool CombineRegions = false; | ||
334 | /// <summary> | 336 | /// <summary> |
335 | /// Tick at which the last maintenance run occurred. | 337 | /// Tick at which the last maintenance run occurred. |
336 | /// </summary> | 338 | /// </summary> |
@@ -350,7 +352,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
350 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing | 352 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
351 | private volatile bool m_backingup; | 353 | private volatile bool m_backingup; |
352 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 354 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
353 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); | 355 | private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>(); |
354 | 356 | ||
355 | private string m_defaultScriptEngine; | 357 | private string m_defaultScriptEngine; |
356 | 358 | ||
@@ -359,6 +361,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
359 | /// </summary> | 361 | /// </summary> |
360 | private int m_LastLogin; | 362 | private int m_LastLogin; |
361 | 363 | ||
364 | private int m_lastIncoming; | ||
365 | private int m_lastOutgoing; | ||
366 | private int m_hbRestarts = 0; | ||
367 | |||
368 | |||
362 | /// <summary> | 369 | /// <summary> |
363 | /// Thread that runs the scene loop. | 370 | /// Thread that runs the scene loop. |
364 | /// </summary> | 371 | /// </summary> |
@@ -399,7 +406,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
399 | private volatile bool m_active; | 406 | private volatile bool m_active; |
400 | 407 | ||
401 | // private int m_lastUpdate; | 408 | // private int m_lastUpdate; |
402 | // private bool m_firstHeartbeat = true; | 409 | private bool m_firstHeartbeat = true; |
403 | 410 | ||
404 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 411 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
405 | private bool m_reprioritizationEnabled = true; | 412 | private bool m_reprioritizationEnabled = true; |
@@ -443,6 +450,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
443 | get { return m_sceneGridService; } | 450 | get { return m_sceneGridService; } |
444 | } | 451 | } |
445 | 452 | ||
453 | public ISnmpModule SnmpService | ||
454 | { | ||
455 | get | ||
456 | { | ||
457 | if (m_snmpService == null) | ||
458 | { | ||
459 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
460 | } | ||
461 | |||
462 | return m_snmpService; | ||
463 | } | ||
464 | } | ||
465 | |||
446 | public ISimulationDataService SimulationDataService | 466 | public ISimulationDataService SimulationDataService |
447 | { | 467 | { |
448 | get | 468 | get |
@@ -735,6 +755,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
735 | m_SimulationDataService = simDataService; | 755 | m_SimulationDataService = simDataService; |
736 | m_EstateDataService = estateDataService; | 756 | m_EstateDataService = estateDataService; |
737 | m_regionHandle = RegionInfo.RegionHandle; | 757 | m_regionHandle = RegionInfo.RegionHandle; |
758 | m_lastIncoming = 0; | ||
759 | m_lastOutgoing = 0; | ||
738 | 760 | ||
739 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 761 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
740 | m_asyncSceneObjectDeleter.Enabled = true; | 762 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -828,7 +850,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
828 | 850 | ||
829 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | 851 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); |
830 | 852 | ||
831 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | 853 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
832 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | 854 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
833 | if (!UseBackup) | 855 | if (!UseBackup) |
834 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 856 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
@@ -836,10 +858,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
836 | //Animation states | 858 | //Animation states |
837 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 859 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
838 | 860 | ||
839 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); | 861 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
840 | 862 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); | |
841 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | ||
842 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | ||
843 | 863 | ||
844 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | 864 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); |
845 | if (RegionInfo.NonphysPrimMin > 0) | 865 | if (RegionInfo.NonphysPrimMin > 0) |
@@ -860,11 +880,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
860 | } | 880 | } |
861 | 881 | ||
862 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 882 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
883 | |||
863 | if (RegionInfo.PhysPrimMax > 0) | 884 | if (RegionInfo.PhysPrimMax > 0) |
864 | { | 885 | { |
865 | m_maxPhys = RegionInfo.PhysPrimMax; | 886 | m_maxPhys = RegionInfo.PhysPrimMax; |
866 | } | 887 | } |
867 | 888 | ||
889 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | ||
890 | if (RegionInfo.LinksetCapacity > 0) | ||
891 | { | ||
892 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
893 | } | ||
894 | |||
895 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | ||
896 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | ||
897 | |||
868 | // Here, if clamping is requested in either global or | 898 | // Here, if clamping is requested in either global or |
869 | // local config, it will be used | 899 | // local config, it will be used |
870 | // | 900 | // |
@@ -874,13 +904,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
874 | m_clampPrimSize = true; | 904 | m_clampPrimSize = true; |
875 | } | 905 | } |
876 | 906 | ||
877 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 907 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
878 | if (RegionInfo.LinksetCapacity > 0) | ||
879 | { | ||
880 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
881 | } | ||
882 | |||
883 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); | ||
884 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 908 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
885 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 909 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
886 | m_dontPersistBefore = | 910 | m_dontPersistBefore = |
@@ -891,11 +915,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
891 | m_persistAfter *= 10000000; | 915 | m_persistAfter *= 10000000; |
892 | 916 | ||
893 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 917 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
894 | 918 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | |
895 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | ||
896 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | ||
897 | 919 | ||
898 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 920 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
921 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
922 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
899 | 923 | ||
900 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; | 924 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; |
901 | 925 | ||
@@ -940,7 +964,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
940 | 964 | ||
941 | if (grant.Length > 0) | 965 | if (grant.Length > 0) |
942 | { | 966 | { |
943 | foreach (string viewer in grant.Split('|')) | 967 | foreach (string viewer in grant.Split(',')) |
944 | { | 968 | { |
945 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | 969 | m_AllowedViewers.Add(viewer.Trim().ToLower()); |
946 | } | 970 | } |
@@ -952,7 +976,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
952 | 976 | ||
953 | if (grant.Length > 0) | 977 | if (grant.Length > 0) |
954 | { | 978 | { |
955 | foreach (string viewer in grant.Split('|')) | 979 | foreach (string viewer in grant.Split(',')) |
956 | { | 980 | { |
957 | m_BannedViewers.Add(viewer.Trim().ToLower()); | 981 | m_BannedViewers.Add(viewer.Trim().ToLower()); |
958 | } | 982 | } |
@@ -1012,6 +1036,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1012 | StatsReporter = new SimStatsReporter(this); | 1036 | StatsReporter = new SimStatsReporter(this); |
1013 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1037 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
1014 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1038 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1039 | |||
1040 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | ||
1015 | } | 1041 | } |
1016 | 1042 | ||
1017 | public Scene(RegionInfo regInfo) : base(regInfo) | 1043 | public Scene(RegionInfo regInfo) : base(regInfo) |
@@ -1307,8 +1333,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1307 | // Stop all client threads. | 1333 | // Stop all client threads. |
1308 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); | 1334 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); |
1309 | 1335 | ||
1310 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1336 | m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); |
1311 | EventManager.TriggerSceneShuttingDown(this); | 1337 | EventManager.TriggerSceneShuttingDown(this); |
1338 | |||
1339 | m_log.Debug("[SCENE]: Persisting changed objects"); | ||
1340 | |||
1312 | Backup(false); | 1341 | Backup(false); |
1313 | m_sceneGraph.Close(); | 1342 | m_sceneGraph.Close(); |
1314 | 1343 | ||
@@ -1322,6 +1351,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1322 | // attempt to reference a null or disposed physics scene. | 1351 | // attempt to reference a null or disposed physics scene. |
1323 | if (PhysicsScene != null) | 1352 | if (PhysicsScene != null) |
1324 | { | 1353 | { |
1354 | m_log.Debug("[SCENE]: Dispose Physics"); | ||
1325 | PhysicsScene phys = PhysicsScene; | 1355 | PhysicsScene phys = PhysicsScene; |
1326 | // remove the physics engine from both Scene and SceneGraph | 1356 | // remove the physics engine from both Scene and SceneGraph |
1327 | PhysicsScene = null; | 1357 | PhysicsScene = null; |
@@ -1344,11 +1374,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1344 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1374 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1345 | if (m_heartbeatThread != null) | 1375 | if (m_heartbeatThread != null) |
1346 | { | 1376 | { |
1377 | m_hbRestarts++; | ||
1378 | if(m_hbRestarts > 10) | ||
1379 | Environment.Exit(1); | ||
1380 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1381 | |||
1382 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1383 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1384 | //proc.EnableRaisingEvents=false; | ||
1385 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1386 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1387 | //proc.Start(); | ||
1388 | //proc.WaitForExit(); | ||
1389 | //Thread.Sleep(1000); | ||
1390 | //Environment.Exit(1); | ||
1347 | m_heartbeatThread.Abort(); | 1391 | m_heartbeatThread.Abort(); |
1392 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1348 | m_heartbeatThread = null; | 1393 | m_heartbeatThread = null; |
1349 | } | 1394 | } |
1350 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1395 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1351 | 1396 | ||
1397 | // m_sceneGraph.PreparePhysicsSimulation(); | ||
1398 | |||
1399 | |||
1352 | m_heartbeatThread | 1400 | m_heartbeatThread |
1353 | = Watchdog.StartThread( | 1401 | = Watchdog.StartThread( |
1354 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1402 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
@@ -1491,16 +1539,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1491 | endFrame = Frame + frames; | 1539 | endFrame = Frame + frames; |
1492 | 1540 | ||
1493 | float physicsFPS = 0f; | 1541 | float physicsFPS = 0f; |
1494 | int previousFrameTick, tmpMS; | 1542 | int tmpMS; |
1495 | int maintc = Util.EnvironmentTickCount(); | 1543 | int previousFrameTick; |
1544 | int maintc; | ||
1545 | int sleepMS; | ||
1546 | int framestart; | ||
1496 | 1547 | ||
1497 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1548 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1498 | { | 1549 | { |
1550 | framestart = Util.EnvironmentTickCount(); | ||
1499 | ++Frame; | 1551 | ++Frame; |
1500 | 1552 | ||
1501 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1553 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1502 | 1554 | ||
1503 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1555 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1504 | 1556 | ||
1505 | try | 1557 | try |
1506 | { | 1558 | { |
@@ -1552,6 +1604,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1552 | m_sceneGraph.UpdatePresences(); | 1604 | m_sceneGraph.UpdatePresences(); |
1553 | 1605 | ||
1554 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1606 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1607 | |||
1555 | 1608 | ||
1556 | // Delete temp-on-rez stuff | 1609 | // Delete temp-on-rez stuff |
1557 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1610 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
@@ -1633,34 +1686,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
1633 | 1686 | ||
1634 | Watchdog.UpdateThread(); | 1687 | Watchdog.UpdateThread(); |
1635 | 1688 | ||
1689 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1690 | |||
1691 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1692 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1693 | StatsReporter.AddFPS(1); | ||
1694 | |||
1695 | StatsReporter.addAgentMS(agentMS); | ||
1696 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1697 | StatsReporter.addOtherMS(otherMS); | ||
1698 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1699 | |||
1636 | previousFrameTick = m_lastFrameTick; | 1700 | previousFrameTick = m_lastFrameTick; |
1637 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1701 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1638 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1702 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); |
1639 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1703 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1640 | 1704 | ||
1705 | m_firstHeartbeat = false; | ||
1706 | |||
1707 | sleepMS = Util.EnvironmentTickCount(); | ||
1708 | |||
1641 | if (tmpMS > 0) | 1709 | if (tmpMS > 0) |
1642 | { | ||
1643 | Thread.Sleep(tmpMS); | 1710 | Thread.Sleep(tmpMS); |
1644 | spareMS += tmpMS; | ||
1645 | } | ||
1646 | |||
1647 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | ||
1648 | maintc = Util.EnvironmentTickCount(); | ||
1649 | 1711 | ||
1650 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1712 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); |
1713 | frameMS = Util.EnvironmentTickCountSubtract(framestart); | ||
1714 | StatsReporter.addSleepMS(sleepMS); | ||
1715 | StatsReporter.addFrameMS(frameMS); | ||
1651 | 1716 | ||
1652 | // if (Frame%m_update_avatars == 0) | 1717 | // if (Frame%m_update_avatars == 0) |
1653 | // UpdateInWorldTime(); | 1718 | // UpdateInWorldTime(); |
1654 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1655 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1656 | StatsReporter.AddFPS(1); | ||
1657 | 1719 | ||
1658 | StatsReporter.addFrameMS(frameMS); | ||
1659 | StatsReporter.addAgentMS(agentMS); | ||
1660 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1661 | StatsReporter.addOtherMS(otherMS); | ||
1662 | StatsReporter.AddSpareMS(spareMS); | ||
1663 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1664 | 1720 | ||
1665 | // Optionally warn if a frame takes double the amount of time that it should. | 1721 | // Optionally warn if a frame takes double the amount of time that it should. |
1666 | if (DebugUpdates | 1722 | if (DebugUpdates |
@@ -1677,7 +1733,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1677 | public void AddGroupTarget(SceneObjectGroup grp) | 1733 | public void AddGroupTarget(SceneObjectGroup grp) |
1678 | { | 1734 | { |
1679 | lock (m_groupsWithTargets) | 1735 | lock (m_groupsWithTargets) |
1680 | m_groupsWithTargets[grp.UUID] = grp; | 1736 | m_groupsWithTargets[grp.UUID] = 0; |
1681 | } | 1737 | } |
1682 | 1738 | ||
1683 | public void RemoveGroupTarget(SceneObjectGroup grp) | 1739 | public void RemoveGroupTarget(SceneObjectGroup grp) |
@@ -1688,18 +1744,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1688 | 1744 | ||
1689 | private void CheckAtTargets() | 1745 | private void CheckAtTargets() |
1690 | { | 1746 | { |
1691 | List<SceneObjectGroup> objs = null; | 1747 | List<UUID> objs = null; |
1692 | 1748 | ||
1693 | lock (m_groupsWithTargets) | 1749 | lock (m_groupsWithTargets) |
1694 | { | 1750 | { |
1695 | if (m_groupsWithTargets.Count != 0) | 1751 | if (m_groupsWithTargets.Count != 0) |
1696 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); | 1752 | objs = new List<UUID>(m_groupsWithTargets.Keys); |
1697 | } | 1753 | } |
1698 | 1754 | ||
1699 | if (objs != null) | 1755 | if (objs != null) |
1700 | { | 1756 | { |
1701 | foreach (SceneObjectGroup entry in objs) | 1757 | foreach (UUID entry in objs) |
1702 | entry.checkAtTargets(); | 1758 | { |
1759 | SceneObjectGroup grp = GetSceneObjectGroup(entry); | ||
1760 | if (grp == null) | ||
1761 | m_groupsWithTargets.Remove(entry); | ||
1762 | else | ||
1763 | grp.checkAtTargets(); | ||
1764 | } | ||
1703 | } | 1765 | } |
1704 | } | 1766 | } |
1705 | 1767 | ||
@@ -1778,7 +1840,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1778 | msg.fromAgentName = "Server"; | 1840 | msg.fromAgentName = "Server"; |
1779 | msg.dialog = (byte)19; // Object msg | 1841 | msg.dialog = (byte)19; // Object msg |
1780 | msg.fromGroup = false; | 1842 | msg.fromGroup = false; |
1781 | msg.offline = (byte)0; | 1843 | msg.offline = (byte)1; |
1782 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1844 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1783 | msg.Position = Vector3.Zero; | 1845 | msg.Position = Vector3.Zero; |
1784 | msg.RegionID = RegionInfo.RegionID.Guid; | 1846 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -2007,7 +2069,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2007 | return PhysicsScene.SupportsRaycastWorldFiltered(); | 2069 | return PhysicsScene.SupportsRaycastWorldFiltered(); |
2008 | } | 2070 | } |
2009 | 2071 | ||
2010 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | 2072 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) |
2011 | { | 2073 | { |
2012 | if (PhysicsScene == null) | 2074 | if (PhysicsScene == null) |
2013 | return null; | 2075 | return null; |
@@ -2029,14 +2091,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2029 | /// <returns></returns> | 2091 | /// <returns></returns> |
2030 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 2092 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
2031 | { | 2093 | { |
2094 | |||
2095 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
2096 | Vector3 wpos = Vector3.Zero; | ||
2097 | // Check for water surface intersection from above | ||
2098 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
2099 | { | ||
2100 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
2101 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
2102 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
2103 | wpos.Z = wheight; | ||
2104 | } | ||
2105 | |||
2032 | Vector3 pos = Vector3.Zero; | 2106 | Vector3 pos = Vector3.Zero; |
2033 | if (RayEndIsIntersection == (byte)1) | 2107 | if (RayEndIsIntersection == (byte)1) |
2034 | { | 2108 | { |
2035 | pos = RayEnd; | 2109 | pos = RayEnd; |
2036 | return pos; | ||
2037 | } | 2110 | } |
2038 | 2111 | else if (RayTargetID != UUID.Zero) | |
2039 | if (RayTargetID != UUID.Zero) | ||
2040 | { | 2112 | { |
2041 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2113 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2042 | 2114 | ||
@@ -2058,7 +2130,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2058 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 2130 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
2059 | 2131 | ||
2060 | // Un-comment out the following line to Get Raytrace results printed to the console. | 2132 | // Un-comment out the following line to Get Raytrace results printed to the console. |
2061 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 2133 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
2062 | float ScaleOffset = 0.5f; | 2134 | float ScaleOffset = 0.5f; |
2063 | 2135 | ||
2064 | // If we hit something | 2136 | // If we hit something |
@@ -2081,13 +2153,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2081 | //pos.Z -= 0.25F; | 2153 | //pos.Z -= 0.25F; |
2082 | 2154 | ||
2083 | } | 2155 | } |
2084 | |||
2085 | return pos; | ||
2086 | } | 2156 | } |
2087 | else | 2157 | else |
2088 | { | 2158 | { |
2089 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2159 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
2090 | |||
2091 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2160 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
2092 | 2161 | ||
2093 | // Un-comment the following line to print the raytrace results to the console. | 2162 | // Un-comment the following line to print the raytrace results to the console. |
@@ -2096,13 +2165,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2096 | if (ei.HitTF) | 2165 | if (ei.HitTF) |
2097 | { | 2166 | { |
2098 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2167 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
2099 | } else | 2168 | } |
2169 | else | ||
2100 | { | 2170 | { |
2101 | // fall back to our stupid functionality | 2171 | // fall back to our stupid functionality |
2102 | pos = RayEnd; | 2172 | pos = RayEnd; |
2103 | } | 2173 | } |
2104 | |||
2105 | return pos; | ||
2106 | } | 2174 | } |
2107 | } | 2175 | } |
2108 | else | 2176 | else |
@@ -2113,8 +2181,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2113 | //increase height so its above the ground. | 2181 | //increase height so its above the ground. |
2114 | //should be getting the normal of the ground at the rez point and using that? | 2182 | //should be getting the normal of the ground at the rez point and using that? |
2115 | pos.Z += scale.Z / 2f; | 2183 | pos.Z += scale.Z / 2f; |
2116 | return pos; | 2184 | // return pos; |
2117 | } | 2185 | } |
2186 | |||
2187 | // check against posible water intercept | ||
2188 | if (wpos.Z > pos.Z) pos = wpos; | ||
2189 | return pos; | ||
2118 | } | 2190 | } |
2119 | 2191 | ||
2120 | 2192 | ||
@@ -2205,12 +2277,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2205 | { | 2277 | { |
2206 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2278 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2207 | { | 2279 | { |
2280 | sceneObject.IsDeleted = false; | ||
2208 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2281 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2209 | return true; | 2282 | return true; |
2210 | } | 2283 | } |
2211 | 2284 | ||
2212 | return false; | 2285 | return false; |
2213 | |||
2214 | } | 2286 | } |
2215 | 2287 | ||
2216 | /// <summary> | 2288 | /// <summary> |
@@ -2302,6 +2374,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2302 | /// </summary> | 2374 | /// </summary> |
2303 | public void DeleteAllSceneObjects() | 2375 | public void DeleteAllSceneObjects() |
2304 | { | 2376 | { |
2377 | DeleteAllSceneObjects(false); | ||
2378 | } | ||
2379 | |||
2380 | /// <summary> | ||
2381 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2382 | /// </summary> | ||
2383 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2384 | { | ||
2385 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2305 | lock (Entities) | 2386 | lock (Entities) |
2306 | { | 2387 | { |
2307 | EntityBase[] entities = Entities.GetEntities(); | 2388 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2310,11 +2391,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2310 | if (e is SceneObjectGroup) | 2391 | if (e is SceneObjectGroup) |
2311 | { | 2392 | { |
2312 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2393 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2313 | if (!sog.IsAttachment) | 2394 | if (sog != null && !sog.IsAttachment) |
2314 | DeleteSceneObject((SceneObjectGroup)e, false); | 2395 | { |
2396 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2397 | { | ||
2398 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2399 | } | ||
2400 | else | ||
2401 | { | ||
2402 | toReturn.Add((SceneObjectGroup)e); | ||
2403 | } | ||
2404 | } | ||
2315 | } | 2405 | } |
2316 | } | 2406 | } |
2317 | } | 2407 | } |
2408 | if (toReturn.Count > 0) | ||
2409 | { | ||
2410 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2411 | } | ||
2318 | } | 2412 | } |
2319 | 2413 | ||
2320 | /// <summary> | 2414 | /// <summary> |
@@ -2349,6 +2443,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2349 | 2443 | ||
2350 | foreach (SceneObjectPart part in partList) | 2444 | foreach (SceneObjectPart part in partList) |
2351 | { | 2445 | { |
2446 | if (part.KeyframeMotion != null) | ||
2447 | { | ||
2448 | part.KeyframeMotion.Delete(); | ||
2449 | part.KeyframeMotion = null; | ||
2450 | } | ||
2451 | |||
2352 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) | 2452 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) |
2353 | { | 2453 | { |
2354 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? | 2454 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? |
@@ -2366,6 +2466,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2366 | } | 2466 | } |
2367 | 2467 | ||
2368 | group.DeleteGroupFromScene(silent); | 2468 | group.DeleteGroupFromScene(silent); |
2469 | if (!silent) | ||
2470 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2369 | 2471 | ||
2370 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2472 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2371 | } | 2473 | } |
@@ -2656,7 +2758,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2656 | // If the user is banned, we won't let any of their objects | 2758 | // If the user is banned, we won't let any of their objects |
2657 | // enter. Period. | 2759 | // enter. Period. |
2658 | // | 2760 | // |
2659 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) | 2761 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID, 36)) |
2660 | { | 2762 | { |
2661 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); | 2763 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); |
2662 | return false; | 2764 | return false; |
@@ -2691,6 +2793,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2691 | // before we restart the scripts, or else some functions won't work. | 2793 | // before we restart the scripts, or else some functions won't work. |
2692 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); | 2794 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); |
2693 | newObject.ResumeScripts(); | 2795 | newObject.ResumeScripts(); |
2796 | |||
2797 | if (newObject.RootPart.KeyframeMotion != null) | ||
2798 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2694 | } | 2799 | } |
2695 | 2800 | ||
2696 | // Do this as late as possible so that listeners have full access to the incoming object | 2801 | // Do this as late as possible so that listeners have full access to the incoming object |
@@ -2708,6 +2813,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2708 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2813 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2709 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2814 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2710 | { | 2815 | { |
2816 | if (sceneObject.OwnerID == UUID.Zero) | ||
2817 | { | ||
2818 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2819 | return false; | ||
2820 | } | ||
2821 | |||
2822 | // If the user is banned, we won't let any of their objects | ||
2823 | // enter. Period. | ||
2824 | // | ||
2825 | int flags = GetUserFlags(sceneObject.OwnerID); | ||
2826 | if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2827 | { | ||
2828 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | ||
2829 | |||
2830 | return false; | ||
2831 | } | ||
2832 | |||
2711 | // Force allocation of new LocalId | 2833 | // Force allocation of new LocalId |
2712 | // | 2834 | // |
2713 | SceneObjectPart[] parts = sceneObject.Parts; | 2835 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -2741,16 +2863,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2741 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2863 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2742 | 2864 | ||
2743 | if (AttachmentsModule != null) | 2865 | if (AttachmentsModule != null) |
2744 | AttachmentsModule.AttachObject(sp, grp, 0, false, false); | 2866 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false, true); |
2745 | } | 2867 | } |
2746 | else | 2868 | else |
2747 | { | 2869 | { |
2870 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2748 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2871 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2749 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2872 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2750 | } | 2873 | } |
2874 | if (sceneObject.OwnerID == UUID.Zero) | ||
2875 | { | ||
2876 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2877 | return false; | ||
2878 | } | ||
2751 | } | 2879 | } |
2752 | else | 2880 | else |
2753 | { | 2881 | { |
2882 | if (sceneObject.OwnerID == UUID.Zero) | ||
2883 | { | ||
2884 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2885 | return false; | ||
2886 | } | ||
2754 | AddRestoredSceneObject(sceneObject, true, false); | 2887 | AddRestoredSceneObject(sceneObject, true, false); |
2755 | } | 2888 | } |
2756 | 2889 | ||
@@ -2767,6 +2900,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2767 | return 2; // StateSource.PrimCrossing | 2900 | return 2; // StateSource.PrimCrossing |
2768 | } | 2901 | } |
2769 | 2902 | ||
2903 | public int GetUserFlags(UUID user) | ||
2904 | { | ||
2905 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2906 | /* | ||
2907 | ScenePresence sp; | ||
2908 | if (TryGetScenePresence(user, out sp)) | ||
2909 | { | ||
2910 | return sp.UserFlags; | ||
2911 | } | ||
2912 | else | ||
2913 | { | ||
2914 | */ | ||
2915 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2916 | if (uac == null) | ||
2917 | return 0; | ||
2918 | return uac.UserFlags; | ||
2919 | //} | ||
2920 | } | ||
2770 | #endregion | 2921 | #endregion |
2771 | 2922 | ||
2772 | #region Add/Remove Avatar Methods | 2923 | #region Add/Remove Avatar Methods |
@@ -2799,7 +2950,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2799 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2950 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2800 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2951 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2801 | 2952 | ||
2802 | // CheckHeartbeat(); | 2953 | CheckHeartbeat(); |
2803 | 2954 | ||
2804 | sp = GetScenePresence(client.AgentId); | 2955 | sp = GetScenePresence(client.AgentId); |
2805 | 2956 | ||
@@ -2817,6 +2968,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2817 | SubscribeToClientEvents(client); | 2968 | SubscribeToClientEvents(client); |
2818 | 2969 | ||
2819 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | 2970 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); |
2971 | InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46); | ||
2972 | if (cof == null) | ||
2973 | sp.COF = UUID.Zero; | ||
2974 | else | ||
2975 | sp.COF = cof.ID; | ||
2976 | |||
2977 | m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF); | ||
2820 | m_eventManager.TriggerOnNewPresence(sp); | 2978 | m_eventManager.TriggerOnNewPresence(sp); |
2821 | 2979 | ||
2822 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | 2980 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; |
@@ -2830,6 +2988,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2830 | // start the scripts again (since this is done in RezAttachments()). | 2988 | // start the scripts again (since this is done in RezAttachments()). |
2831 | // XXX: This is convoluted. | 2989 | // XXX: This is convoluted. |
2832 | sp.IsChildAgent = false; | 2990 | sp.IsChildAgent = false; |
2991 | sp.IsLoggingIn = true; | ||
2833 | 2992 | ||
2834 | if (AttachmentsModule != null) | 2993 | if (AttachmentsModule != null) |
2835 | Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); | 2994 | Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); |
@@ -2943,19 +3102,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2943 | // and the scene presence and the client, if they exist | 3102 | // and the scene presence and the client, if they exist |
2944 | try | 3103 | try |
2945 | { | 3104 | { |
2946 | // We need to wait for the client to make UDP contact first. | 3105 | ScenePresence sp = GetScenePresence(agentID); |
2947 | // It's the UDP contact that creates the scene presence | 3106 | |
2948 | ScenePresence sp = WaitGetScenePresence(agentID); | ||
2949 | if (sp != null) | 3107 | if (sp != null) |
2950 | { | 3108 | { |
2951 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 3109 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2952 | |||
2953 | sp.ControllingClient.Close(); | 3110 | sp.ControllingClient.Close(); |
2954 | } | 3111 | } |
2955 | else | 3112 | |
2956 | { | ||
2957 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2958 | } | ||
2959 | // BANG! SLASH! | 3113 | // BANG! SLASH! |
2960 | m_authenticateHandler.RemoveCircuit(agentID); | 3114 | m_authenticateHandler.RemoveCircuit(agentID); |
2961 | 3115 | ||
@@ -3000,6 +3154,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3000 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3154 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
3001 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 3155 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
3002 | 3156 | ||
3157 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
3158 | |||
3003 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3159 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
3004 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3160 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
3005 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3161 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3056,6 +3212,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3056 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3212 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
3057 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3213 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
3058 | client.OnCopyInventoryItem += CopyInventoryItem; | 3214 | client.OnCopyInventoryItem += CopyInventoryItem; |
3215 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
3059 | client.OnMoveInventoryItem += MoveInventoryItem; | 3216 | client.OnMoveInventoryItem += MoveInventoryItem; |
3060 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3217 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
3061 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3218 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3127,6 +3284,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3127 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3284 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
3128 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3285 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
3129 | 3286 | ||
3287 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3288 | |||
3130 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3289 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3131 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3290 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3132 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3291 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3229,7 +3388,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3229 | /// </summary> | 3388 | /// </summary> |
3230 | /// <param name="agentId">The avatar's Unique ID</param> | 3389 | /// <param name="agentId">The avatar's Unique ID</param> |
3231 | /// <param name="client">The IClientAPI for the client</param> | 3390 | /// <param name="client">The IClientAPI for the client</param> |
3232 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3391 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3233 | { | 3392 | { |
3234 | if (EntityTransferModule != null) | 3393 | if (EntityTransferModule != null) |
3235 | { | 3394 | { |
@@ -3240,6 +3399,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3240 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3399 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
3241 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3400 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3242 | } | 3401 | } |
3402 | return false; | ||
3243 | } | 3403 | } |
3244 | 3404 | ||
3245 | /// <summary> | 3405 | /// <summary> |
@@ -3349,6 +3509,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3349 | /// <param name="flags"></param> | 3509 | /// <param name="flags"></param> |
3350 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3510 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3351 | { | 3511 | { |
3512 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3513 | ScenePresence presence; | ||
3514 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3515 | { | ||
3516 | if (presence.Appearance != null) | ||
3517 | { | ||
3518 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3519 | } | ||
3520 | } | ||
3521 | |||
3352 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3522 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3353 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3523 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3354 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3524 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3450,7 +3620,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3450 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop | 3620 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3451 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | 3621 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI |
3452 | if (closeChildAgents && CapsModule != null) | 3622 | if (closeChildAgents && CapsModule != null) |
3453 | CapsModule.RemoveCaps(agentID); | 3623 | CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); |
3454 | 3624 | ||
3455 | // // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3625 | // // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3456 | // // this method is doing is HORRIBLE!!! | 3626 | // // this method is doing is HORRIBLE!!! |
@@ -3486,6 +3656,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3486 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3656 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3487 | if (AgentTransactionsModule != null) | 3657 | if (AgentTransactionsModule != null) |
3488 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3658 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3659 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3489 | } | 3660 | } |
3490 | catch (Exception e) | 3661 | catch (Exception e) |
3491 | { | 3662 | { |
@@ -3678,15 +3849,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
3678 | agent.firstname, agent.lastname, agent.Viewer); | 3849 | agent.firstname, agent.lastname, agent.Viewer); |
3679 | reason = "Access denied, your viewer is banned by the region owner"; | 3850 | reason = "Access denied, your viewer is banned by the region owner"; |
3680 | return false; | 3851 | return false; |
3681 | } | 3852 | } |
3682 | 3853 | ||
3683 | ILandObject land; | 3854 | ScenePresence sp = GetScenePresence(agent.AgentID); |
3684 | 3855 | ||
3685 | lock (agent) | 3856 | // If we have noo presence here or if that presence is a zombie root |
3857 | // presence that will be kicled, we need a new CAPS object. | ||
3858 | if (sp == null || (sp != null && !sp.IsChildAgent)) | ||
3686 | { | 3859 | { |
3687 | ScenePresence sp = GetScenePresence(agent.AgentID); | 3860 | if (CapsModule != null) |
3688 | 3861 | { | |
3689 | if (sp != null && !sp.IsChildAgent) | 3862 | lock (agent) |
3863 | { | ||
3864 | CapsModule.SetAgentCapsSeeds(agent); | ||
3865 | CapsModule.CreateCaps(agent.AgentID, agent.circuitcode); | ||
3866 | } | ||
3867 | } | ||
3868 | } | ||
3869 | |||
3870 | if (sp != null) | ||
3871 | { | ||
3872 | if (!sp.IsChildAgent) | ||
3690 | { | 3873 | { |
3691 | // We have a zombie from a crashed session. | 3874 | // We have a zombie from a crashed session. |
3692 | // Or the same user is trying to be root twice here, won't work. | 3875 | // Or the same user is trying to be root twice here, won't work. |
@@ -3694,22 +3877,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
3694 | m_log.WarnFormat( | 3877 | m_log.WarnFormat( |
3695 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | 3878 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", |
3696 | sp.Name, sp.UUID, RegionInfo.RegionName); | 3879 | sp.Name, sp.UUID, RegionInfo.RegionName); |
3697 | 3880 | ||
3698 | sp.ControllingClient.Close(true); | 3881 | sp.ControllingClient.Close(true, true); |
3699 | sp = null; | 3882 | sp = null; |
3700 | } | 3883 | } |
3701 | 3884 | } | |
3702 | land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | 3885 | |
3703 | 3886 | lock (agent) | |
3887 | { | ||
3704 | //On login test land permisions | 3888 | //On login test land permisions |
3705 | if (vialogin) | 3889 | if (vialogin) |
3706 | { | 3890 | { |
3707 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3891 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3892 | if (cache != null) | ||
3893 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3894 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3708 | { | 3895 | { |
3896 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3709 | return false; | 3897 | return false; |
3710 | } | 3898 | } |
3711 | } | 3899 | } |
3712 | 3900 | ||
3713 | if (sp == null) // We don't have an [child] agent here already | 3901 | if (sp == null) // We don't have an [child] agent here already |
3714 | { | 3902 | { |
3715 | if (requirePresenceLookup) | 3903 | if (requirePresenceLookup) |
@@ -3718,54 +3906,53 @@ namespace OpenSim.Region.Framework.Scenes | |||
3718 | { | 3906 | { |
3719 | if (!VerifyUserPresence(agent, out reason)) | 3907 | if (!VerifyUserPresence(agent, out reason)) |
3720 | return false; | 3908 | return false; |
3721 | } | 3909 | } catch (Exception e) |
3722 | catch (Exception e) | ||
3723 | { | 3910 | { |
3724 | m_log.ErrorFormat( | 3911 | m_log.ErrorFormat( |
3725 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3912 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3726 | |||
3727 | return false; | 3913 | return false; |
3728 | } | 3914 | } |
3729 | } | 3915 | } |
3730 | 3916 | ||
3731 | try | 3917 | try |
3732 | { | 3918 | { |
3733 | if (!AuthorizeUser(agent, out reason)) | 3919 | // Always check estate if this is a login. Always |
3734 | return false; | 3920 | // check if banned regions are to be blacked out. |
3921 | if (vialogin || (!m_seeIntoBannedRegion)) | ||
3922 | { | ||
3923 | if (!AuthorizeUser(agent, out reason)) | ||
3924 | { | ||
3925 | return false; | ||
3926 | } | ||
3927 | } | ||
3735 | } | 3928 | } |
3736 | catch (Exception e) | 3929 | catch (Exception e) |
3737 | { | 3930 | { |
3738 | m_log.ErrorFormat( | 3931 | m_log.ErrorFormat( |
3739 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3932 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3740 | |||
3741 | return false; | 3933 | return false; |
3742 | } | 3934 | } |
3743 | 3935 | ||
3744 | m_log.InfoFormat( | 3936 | m_log.InfoFormat( |
3745 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3937 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3746 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3938 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3747 | agent.AgentID, agent.circuitcode); | 3939 | agent.AgentID, agent.circuitcode); |
3748 | 3940 | ||
3749 | if (CapsModule != null) | ||
3750 | { | ||
3751 | CapsModule.SetAgentCapsSeeds(agent); | ||
3752 | CapsModule.CreateCaps(agent.AgentID); | ||
3753 | } | ||
3754 | } | 3941 | } |
3755 | else | 3942 | else |
3756 | { | 3943 | { |
3757 | // Let the SP know how we got here. This has a lot of interesting | 3944 | // Let the SP know how we got here. This has a lot of interesting |
3758 | // uses down the line. | 3945 | // uses down the line. |
3759 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3946 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3760 | 3947 | ||
3761 | if (sp.IsChildAgent) | 3948 | if (sp.IsChildAgent) |
3762 | { | 3949 | { |
3763 | m_log.DebugFormat( | 3950 | m_log.DebugFormat( |
3764 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3951 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3765 | agent.AgentID, RegionInfo.RegionName); | 3952 | agent.AgentID, RegionInfo.RegionName); |
3766 | 3953 | ||
3767 | sp.AdjustKnownSeeds(); | 3954 | sp.AdjustKnownSeeds(); |
3768 | 3955 | ||
3769 | if (CapsModule != null) | 3956 | if (CapsModule != null) |
3770 | CapsModule.SetAgentCapsSeeds(agent); | 3957 | CapsModule.SetAgentCapsSeeds(agent); |
3771 | } | 3958 | } |
@@ -3776,6 +3963,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3776 | agent.teleportFlags = teleportFlags; | 3963 | agent.teleportFlags = teleportFlags; |
3777 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | 3964 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); |
3778 | 3965 | ||
3966 | if (CapsModule != null) | ||
3967 | { | ||
3968 | CapsModule.ActivateCaps(agent.circuitcode); | ||
3969 | } | ||
3970 | |||
3779 | if (vialogin) | 3971 | if (vialogin) |
3780 | { | 3972 | { |
3781 | // CleanDroppedAttachments(); | 3973 | // CleanDroppedAttachments(); |
@@ -3867,6 +4059,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3867 | } | 4059 | } |
3868 | 4060 | ||
3869 | // Honor parcel landing type and position. | 4061 | // Honor parcel landing type and position. |
4062 | /* | ||
4063 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3870 | if (land != null) | 4064 | if (land != null) |
3871 | { | 4065 | { |
3872 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4066 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3874,25 +4068,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
3874 | agent.startpos = land.LandData.UserLocation; | 4068 | agent.startpos = land.LandData.UserLocation; |
3875 | } | 4069 | } |
3876 | } | 4070 | } |
4071 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3877 | } | 4072 | } |
3878 | 4073 | ||
3879 | return true; | 4074 | return true; |
3880 | } | 4075 | } |
3881 | 4076 | ||
3882 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 4077 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3883 | { | 4078 | { |
3884 | bool banned = land.IsBannedFromLand(agent.AgentID); | 4079 | if (posX < 0) |
3885 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 4080 | posX = 0; |
4081 | else if (posX >= 256) | ||
4082 | posX = 255.999f; | ||
4083 | if (posY < 0) | ||
4084 | posY = 0; | ||
4085 | else if (posY >= 256) | ||
4086 | posY = 255.999f; | ||
4087 | |||
4088 | reason = String.Empty; | ||
4089 | if (Permissions.IsGod(agentID)) | ||
4090 | return true; | ||
4091 | |||
4092 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
4093 | if (land == null) | ||
4094 | return false; | ||
4095 | |||
4096 | bool banned = land.IsBannedFromLand(agentID); | ||
4097 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3886 | 4098 | ||
3887 | if (banned || restricted) | 4099 | if (banned || restricted) |
3888 | { | 4100 | { |
3889 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 4101 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3890 | if (nearestParcel != null) | 4102 | if (nearestParcel != null) |
3891 | { | 4103 | { |
3892 | //Move agent to nearest allowed | 4104 | //Move agent to nearest allowed |
3893 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 4105 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3894 | agent.startpos.X = newPosition.X; | 4106 | posX = newPosition.X; |
3895 | agent.startpos.Y = newPosition.Y; | 4107 | posY = newPosition.Y; |
3896 | } | 4108 | } |
3897 | else | 4109 | else |
3898 | { | 4110 | { |
@@ -3954,7 +4166,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3954 | 4166 | ||
3955 | if (!m_strictAccessControl) return true; | 4167 | if (!m_strictAccessControl) return true; |
3956 | if (Permissions.IsGod(agent.AgentID)) return true; | 4168 | if (Permissions.IsGod(agent.AgentID)) return true; |
3957 | 4169 | ||
3958 | if (AuthorizationService != null) | 4170 | if (AuthorizationService != null) |
3959 | { | 4171 | { |
3960 | if (!AuthorizationService.IsAuthorizedForRegion( | 4172 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3969,7 +4181,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3969 | 4181 | ||
3970 | if (RegionInfo.EstateSettings != null) | 4182 | if (RegionInfo.EstateSettings != null) |
3971 | { | 4183 | { |
3972 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4184 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0)) |
3973 | { | 4185 | { |
3974 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4186 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3975 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4187 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -4159,6 +4371,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4159 | 4371 | ||
4160 | // XPTO: if this agent is not allowed here as root, always return false | 4372 | // XPTO: if this agent is not allowed here as root, always return false |
4161 | 4373 | ||
4374 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4375 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4376 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4377 | if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4378 | { | ||
4379 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4380 | return false; | ||
4381 | } | ||
4382 | |||
4162 | // TODO: This check should probably be in QueryAccess(). | 4383 | // TODO: This check should probably be in QueryAccess(). |
4163 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4384 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4164 | if (nearestParcel == null) | 4385 | if (nearestParcel == null) |
@@ -4223,7 +4444,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4223 | /// <param name='agentID'></param> | 4444 | /// <param name='agentID'></param> |
4224 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4445 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4225 | { | 4446 | { |
4226 | int ntimes = 10; | 4447 | int ntimes = 30; |
4227 | ScenePresence sp = null; | 4448 | ScenePresence sp = null; |
4228 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4449 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4229 | Thread.Sleep(1000); | 4450 | Thread.Sleep(1000); |
@@ -4253,6 +4474,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4253 | return false; | 4474 | return false; |
4254 | } | 4475 | } |
4255 | 4476 | ||
4477 | public bool IncomingCloseAgent(UUID agentID) | ||
4478 | { | ||
4479 | return IncomingCloseAgent(agentID, false); | ||
4480 | } | ||
4481 | |||
4482 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4483 | { | ||
4484 | return IncomingCloseAgent(agentID, true); | ||
4485 | } | ||
4486 | |||
4256 | /// <summary> | 4487 | /// <summary> |
4257 | /// Tell a single agent to disconnect from the region. | 4488 | /// Tell a single agent to disconnect from the region. |
4258 | /// </summary> | 4489 | /// </summary> |
@@ -4268,7 +4499,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4268 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4499 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4269 | if (presence != null) | 4500 | if (presence != null) |
4270 | { | 4501 | { |
4271 | presence.ControllingClient.Close(force); | 4502 | presence.ControllingClient.Close(force, force); |
4272 | return true; | 4503 | return true; |
4273 | } | 4504 | } |
4274 | 4505 | ||
@@ -4901,7 +5132,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4901 | { | 5132 | { |
4902 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) | 5133 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) |
4903 | { | 5134 | { |
4904 | if (grp.RootPart.Expires <= DateTime.Now) | 5135 | if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= DateTime.Now) |
4905 | DeleteSceneObject(grp, false); | 5136 | DeleteSceneObject(grp, false); |
4906 | } | 5137 | } |
4907 | } | 5138 | } |
@@ -4915,35 +5146,81 @@ namespace OpenSim.Region.Framework.Scenes | |||
4915 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); | 5146 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); |
4916 | } | 5147 | } |
4917 | 5148 | ||
4918 | public int GetHealth() | 5149 | public int GetHealth(out int flags, out string message) |
4919 | { | 5150 | { |
4920 | // Returns: | 5151 | // Returns: |
4921 | // 1 = sim is up and accepting http requests. The heartbeat has | 5152 | // 1 = sim is up and accepting http requests. The heartbeat has |
4922 | // stopped and the sim is probably locked up, but a remote | 5153 | // stopped and the sim is probably locked up, but a remote |
4923 | // admin restart may succeed | 5154 | // admin restart may succeed |
4924 | // | 5155 | // |
4925 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 5156 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4926 | // usable for people within and logins _may_ work | 5157 | // usable for people within |
5158 | // | ||
5159 | // 3 = Sim is up and one packet thread is running. Sim is | ||
5160 | // unstable and will not accept new logins | ||
4927 | // | 5161 | // |
4928 | // 3 = We have seen a new user enter within the past 4 minutes | 5162 | // 4 = Sim is up and both packet threads are running. Sim is |
5163 | // likely usable | ||
5164 | // | ||
5165 | // 5 = We have seen a new user enter within the past 4 minutes | ||
4929 | // which can be seen as positive confirmation of sim health | 5166 | // which can be seen as positive confirmation of sim health |
4930 | // | 5167 | // |
5168 | |||
5169 | flags = 0; | ||
5170 | message = String.Empty; | ||
5171 | |||
5172 | CheckHeartbeat(); | ||
5173 | |||
5174 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
5175 | { | ||
5176 | // We're still starting | ||
5177 | // 0 means "in startup", it can't happen another way, since | ||
5178 | // to get here, we must be able to accept http connections | ||
5179 | return 0; | ||
5180 | } | ||
5181 | |||
4931 | int health=1; // Start at 1, means we're up | 5182 | int health=1; // Start at 1, means we're up |
4932 | 5183 | ||
4933 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5184 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4934 | health += 1; | 5185 | { |
5186 | health+=1; | ||
5187 | flags |= 1; | ||
5188 | } | ||
5189 | |||
5190 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
5191 | { | ||
5192 | health+=1; | ||
5193 | flags |= 2; | ||
5194 | } | ||
5195 | |||
5196 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
5197 | { | ||
5198 | health+=1; | ||
5199 | flags |= 4; | ||
5200 | } | ||
4935 | else | 5201 | else |
5202 | { | ||
5203 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
5204 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
5205 | proc.EnableRaisingEvents=false; | ||
5206 | proc.StartInfo.FileName = "/bin/kill"; | ||
5207 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
5208 | proc.Start(); | ||
5209 | proc.WaitForExit(); | ||
5210 | Thread.Sleep(1000); | ||
5211 | Environment.Exit(1); | ||
5212 | } | ||
5213 | |||
5214 | if (flags != 7) | ||
4936 | return health; | 5215 | return health; |
4937 | 5216 | ||
4938 | // A login in the last 4 mins? We can't be doing too badly | 5217 | // A login in the last 4 mins? We can't be doing too badly |
4939 | // | 5218 | // |
4940 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5219 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4941 | health++; | 5220 | health++; |
4942 | else | 5221 | else |
4943 | return health; | 5222 | return health; |
4944 | 5223 | ||
4945 | // CheckHeartbeat(); | ||
4946 | |||
4947 | return health; | 5224 | return health; |
4948 | } | 5225 | } |
4949 | 5226 | ||
@@ -5031,7 +5308,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5031 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 5308 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
5032 | if (wasUsingPhysics) | 5309 | if (wasUsingPhysics) |
5033 | { | 5310 | { |
5034 | 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 | 5311 | 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 |
5035 | } | 5312 | } |
5036 | } | 5313 | } |
5037 | 5314 | ||
@@ -5130,14 +5407,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5130 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5407 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5131 | } | 5408 | } |
5132 | 5409 | ||
5133 | // private void CheckHeartbeat() | 5410 | private void CheckHeartbeat() |
5134 | // { | 5411 | { |
5135 | // if (m_firstHeartbeat) | 5412 | if (m_firstHeartbeat) |
5136 | // return; | 5413 | return; |
5137 | // | 5414 | |
5138 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5415 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
5139 | // StartTimer(); | 5416 | Start(); |
5140 | // } | 5417 | } |
5141 | 5418 | ||
5142 | public override ISceneObject DeserializeObject(string representation) | 5419 | public override ISceneObject DeserializeObject(string representation) |
5143 | { | 5420 | { |
@@ -5149,9 +5426,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5149 | get { return m_allowScriptCrossings; } | 5426 | get { return m_allowScriptCrossings; } |
5150 | } | 5427 | } |
5151 | 5428 | ||
5152 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 5429 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
5153 | { | 5430 | { |
5154 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 5431 | return GetNearestAllowedPosition(avatar, null); |
5432 | } | ||
5433 | |||
5434 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
5435 | { | ||
5436 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); | ||
5155 | 5437 | ||
5156 | if (nearestParcel != null) | 5438 | if (nearestParcel != null) |
5157 | { | 5439 | { |
@@ -5160,10 +5442,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5160 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5442 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5161 | if (nearestPoint != null) | 5443 | if (nearestPoint != null) |
5162 | { | 5444 | { |
5163 | // m_log.DebugFormat( | 5445 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
5164 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
5165 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
5166 | |||
5167 | return nearestPoint.Value; | 5446 | return nearestPoint.Value; |
5168 | } | 5447 | } |
5169 | 5448 | ||
@@ -5173,17 +5452,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
5173 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5452 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5174 | if (nearestPoint != null) | 5453 | if (nearestPoint != null) |
5175 | { | 5454 | { |
5176 | // m_log.DebugFormat( | 5455 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
5177 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
5178 | |||
5179 | return nearestPoint.Value; | 5456 | return nearestPoint.Value; |
5180 | } | 5457 | } |
5181 | 5458 | ||
5182 | //Ultimate backup if we have no idea where they are | 5459 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5183 | // m_log.DebugFormat( | 5460 | if (dest != excludeParcel) |
5184 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 5461 | { |
5462 | // Ultimate backup if we have no idea where they are and | ||
5463 | // the last allowed position was in another parcel | ||
5464 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
5465 | return avatar.lastKnownAllowedPosition; | ||
5466 | } | ||
5185 | 5467 | ||
5186 | return avatar.lastKnownAllowedPosition; | 5468 | // else fall through to region edge |
5187 | } | 5469 | } |
5188 | 5470 | ||
5189 | //Go to the edge, this happens in teleporting to a region with no available parcels | 5471 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -5217,13 +5499,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
5217 | 5499 | ||
5218 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 5500 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
5219 | { | 5501 | { |
5502 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
5503 | } | ||
5504 | |||
5505 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
5506 | { | ||
5220 | List<ILandObject> all = AllParcels(); | 5507 | List<ILandObject> all = AllParcels(); |
5221 | float minParcelDistance = float.MaxValue; | 5508 | float minParcelDistance = float.MaxValue; |
5222 | ILandObject nearestParcel = null; | 5509 | ILandObject nearestParcel = null; |
5223 | 5510 | ||
5224 | foreach (var parcel in all) | 5511 | foreach (var parcel in all) |
5225 | { | 5512 | { |
5226 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 5513 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
5227 | { | 5514 | { |
5228 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 5515 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
5229 | if (parcelDistance < minParcelDistance) | 5516 | if (parcelDistance < minParcelDistance) |
@@ -5439,7 +5726,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5439 | mapModule.GenerateMaptile(); | 5726 | mapModule.GenerateMaptile(); |
5440 | } | 5727 | } |
5441 | 5728 | ||
5442 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5729 | // public void CleanDroppedAttachments() |
5730 | // { | ||
5731 | // List<SceneObjectGroup> objectsToDelete = | ||
5732 | // new List<SceneObjectGroup>(); | ||
5733 | // | ||
5734 | // lock (m_cleaningAttachments) | ||
5735 | // { | ||
5736 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5737 | // { | ||
5738 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5739 | // { | ||
5740 | // UUID agentID = grp.OwnerID; | ||
5741 | // if (agentID == UUID.Zero) | ||
5742 | // { | ||
5743 | // objectsToDelete.Add(grp); | ||
5744 | // return; | ||
5745 | // } | ||
5746 | // | ||
5747 | // ScenePresence sp = GetScenePresence(agentID); | ||
5748 | // if (sp == null) | ||
5749 | // { | ||
5750 | // objectsToDelete.Add(grp); | ||
5751 | // return; | ||
5752 | // } | ||
5753 | // } | ||
5754 | // }); | ||
5755 | // } | ||
5756 | // | ||
5757 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5758 | // { | ||
5759 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5760 | // DeleteSceneObject(grp, true); | ||
5761 | // } | ||
5762 | // } | ||
5763 | |||
5764 | public void ThreadAlive(int threadCode) | ||
5765 | { | ||
5766 | switch(threadCode) | ||
5767 | { | ||
5768 | case 1: // Incoming | ||
5769 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5770 | break; | ||
5771 | case 2: // Incoming | ||
5772 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5773 | break; | ||
5774 | } | ||
5775 | } | ||
5776 | |||
5777 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5443 | { | 5778 | { |
5444 | RegenerateMaptile(); | 5779 | RegenerateMaptile(); |
5445 | 5780 | ||
@@ -5467,6 +5802,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5467 | /// <returns></returns> | 5802 | /// <returns></returns> |
5468 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5803 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5469 | { | 5804 | { |
5805 | reason = "You are banned from the region"; | ||
5806 | |||
5470 | if (EntityTransferModule.IsInTransit(agentID)) | 5807 | if (EntityTransferModule.IsInTransit(agentID)) |
5471 | { | 5808 | { |
5472 | reason = "Agent is still in transit from this region"; | 5809 | reason = "Agent is still in transit from this region"; |
@@ -5478,6 +5815,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5478 | return false; | 5815 | return false; |
5479 | } | 5816 | } |
5480 | 5817 | ||
5818 | if (Permissions.IsGod(agentID)) | ||
5819 | { | ||
5820 | reason = String.Empty; | ||
5821 | return true; | ||
5822 | } | ||
5823 | |||
5481 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5824 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5482 | // However, the long term fix is to make sure root agent count is always accurate. | 5825 | // However, the long term fix is to make sure root agent count is always accurate. |
5483 | m_sceneGraph.RecalculateStats(); | 5826 | m_sceneGraph.RecalculateStats(); |
@@ -5498,6 +5841,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5498 | } | 5841 | } |
5499 | } | 5842 | } |
5500 | 5843 | ||
5844 | ScenePresence presence = GetScenePresence(agentID); | ||
5845 | IClientAPI client = null; | ||
5846 | AgentCircuitData aCircuit = null; | ||
5847 | |||
5848 | if (presence != null) | ||
5849 | { | ||
5850 | client = presence.ControllingClient; | ||
5851 | if (client != null) | ||
5852 | aCircuit = client.RequestClientInfo(); | ||
5853 | } | ||
5854 | |||
5855 | // We may be called before there is a presence or a client. | ||
5856 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5857 | if (client == null) | ||
5858 | { | ||
5859 | aCircuit = new AgentCircuitData(); | ||
5860 | aCircuit.AgentID = agentID; | ||
5861 | aCircuit.firstname = String.Empty; | ||
5862 | aCircuit.lastname = String.Empty; | ||
5863 | } | ||
5864 | |||
5865 | try | ||
5866 | { | ||
5867 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5868 | { | ||
5869 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5870 | return false; | ||
5871 | } | ||
5872 | } | ||
5873 | catch (Exception e) | ||
5874 | { | ||
5875 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5876 | return false; | ||
5877 | } | ||
5878 | |||
5501 | if (position == Vector3.Zero) // Teleport | 5879 | if (position == Vector3.Zero) // Teleport |
5502 | { | 5880 | { |
5503 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5881 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5531,13 +5909,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5531 | } | 5909 | } |
5532 | } | 5910 | } |
5533 | } | 5911 | } |
5912 | |||
5913 | float posX = 128.0f; | ||
5914 | float posY = 128.0f; | ||
5915 | |||
5916 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5917 | { | ||
5918 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5919 | return false; | ||
5920 | } | ||
5921 | } | ||
5922 | else // Walking | ||
5923 | { | ||
5924 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5925 | if (land == null) | ||
5926 | return false; | ||
5927 | |||
5928 | bool banned = land.IsBannedFromLand(agentID); | ||
5929 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5930 | |||
5931 | if (banned || restricted) | ||
5932 | return false; | ||
5534 | } | 5933 | } |
5535 | 5934 | ||
5536 | reason = String.Empty; | 5935 | reason = String.Empty; |
5537 | return true; | 5936 | return true; |
5538 | } | 5937 | } |
5539 | 5938 | ||
5540 | /// <summary> | 5939 | public void StartTimerWatchdog() |
5940 | { | ||
5941 | m_timerWatchdog.Interval = 1000; | ||
5942 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5943 | m_timerWatchdog.AutoReset = true; | ||
5944 | m_timerWatchdog.Start(); | ||
5945 | } | ||
5946 | |||
5947 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5948 | { | ||
5949 | CheckHeartbeat(); | ||
5950 | } | ||
5951 | |||
5541 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5952 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5542 | /// autopilot that moves an avatar to a sit target!. | 5953 | /// autopilot that moves an avatar to a sit target!. |
5543 | /// </summary> | 5954 | /// </summary> |
@@ -5616,6 +6027,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5616 | return m_SpawnPoint - 1; | 6027 | return m_SpawnPoint - 1; |
5617 | } | 6028 | } |
5618 | 6029 | ||
6030 | private void HandleGcCollect(string module, string[] args) | ||
6031 | { | ||
6032 | GC.Collect(); | ||
6033 | } | ||
6034 | |||
5619 | /// <summary> | 6035 | /// <summary> |
5620 | /// Wrappers to get physics modules retrieve assets. | 6036 | /// Wrappers to get physics modules retrieve assets. |
5621 | /// </summary> | 6037 | /// </summary> |