diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 721 |
1 files changed, 568 insertions, 153 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 911a3e4..28fce53 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -227,8 +227,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
227 | // TODO: need to figure out how allow client agents but deny | 227 | // TODO: need to figure out how allow client agents but deny |
228 | // root agents when ACL denies access to root agent | 228 | // root agents when ACL denies access to root agent |
229 | public bool m_strictAccessControl = true; | 229 | public bool m_strictAccessControl = true; |
230 | 230 | public bool m_seeIntoBannedRegion = false; | |
231 | public int MaxUndoCount { get; set; } | 231 | public int MaxUndoCount = 5; |
232 | 232 | ||
233 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; | 233 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; |
234 | public bool LoginLock = false; | 234 | public bool LoginLock = false; |
@@ -244,11 +244,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
244 | 244 | ||
245 | protected int m_splitRegionID; | 245 | protected int m_splitRegionID; |
246 | protected Timer m_restartWaitTimer = new Timer(); | 246 | protected Timer m_restartWaitTimer = new Timer(); |
247 | protected Timer m_timerWatchdog = new Timer(); | ||
247 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 248 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
248 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 249 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
249 | protected string m_simulatorVersion = "OpenSimulator Server"; | 250 | protected string m_simulatorVersion = "OpenSimulator Server"; |
250 | protected AgentCircuitManager m_authenticateHandler; | 251 | protected AgentCircuitManager m_authenticateHandler; |
251 | protected SceneCommunicationService m_sceneGridService; | 252 | protected SceneCommunicationService m_sceneGridService; |
253 | protected ISnmpModule m_snmpService = null; | ||
252 | 254 | ||
253 | protected ISimulationDataService m_SimulationDataService; | 255 | protected ISimulationDataService m_SimulationDataService; |
254 | protected IEstateDataService m_EstateDataService; | 256 | protected IEstateDataService m_EstateDataService; |
@@ -311,8 +313,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
311 | private int m_update_presences = 1; // Update scene presence movements | 313 | private int m_update_presences = 1; // Update scene presence movements |
312 | private int m_update_events = 1; | 314 | private int m_update_events = 1; |
313 | private int m_update_backup = 200; | 315 | private int m_update_backup = 200; |
314 | private int m_update_terrain = 50; | 316 | private int m_update_terrain = 1000; |
315 | // private int m_update_land = 1; | 317 | private int m_update_land = 10; |
316 | private int m_update_coarse_locations = 50; | 318 | private int m_update_coarse_locations = 50; |
317 | 319 | ||
318 | private int agentMS; | 320 | private int agentMS; |
@@ -325,13 +327,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
325 | private int backupMS; | 327 | private int backupMS; |
326 | private int terrainMS; | 328 | private int terrainMS; |
327 | private int landMS; | 329 | private int landMS; |
328 | private int spareMS; | ||
329 | 330 | ||
330 | /// <summary> | 331 | /// <summary> |
331 | /// Tick at which the last frame was processed. | 332 | /// Tick at which the last frame was processed. |
332 | /// </summary> | 333 | /// </summary> |
333 | private int m_lastFrameTick; | 334 | private int m_lastFrameTick; |
334 | 335 | ||
336 | public bool CombineRegions = false; | ||
335 | /// <summary> | 337 | /// <summary> |
336 | /// Tick at which the last maintenance run occurred. | 338 | /// Tick at which the last maintenance run occurred. |
337 | /// </summary> | 339 | /// </summary> |
@@ -351,7 +353,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
351 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing | 353 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
352 | private volatile bool m_backingup; | 354 | private volatile bool m_backingup; |
353 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 355 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
354 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); | 356 | private Dictionary<UUID, int> m_groupsWithTargets = new Dictionary<UUID, int>(); |
355 | 357 | ||
356 | private string m_defaultScriptEngine; | 358 | private string m_defaultScriptEngine; |
357 | 359 | ||
@@ -360,6 +362,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
360 | /// </summary> | 362 | /// </summary> |
361 | private int m_LastLogin; | 363 | private int m_LastLogin; |
362 | 364 | ||
365 | private int m_lastIncoming; | ||
366 | private int m_lastOutgoing; | ||
367 | private int m_hbRestarts = 0; | ||
368 | |||
369 | |||
363 | /// <summary> | 370 | /// <summary> |
364 | /// Thread that runs the scene loop. | 371 | /// Thread that runs the scene loop. |
365 | /// </summary> | 372 | /// </summary> |
@@ -400,7 +407,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
400 | private volatile bool m_active; | 407 | private volatile bool m_active; |
401 | 408 | ||
402 | // private int m_lastUpdate; | 409 | // private int m_lastUpdate; |
403 | // private bool m_firstHeartbeat = true; | 410 | private bool m_firstHeartbeat = true; |
404 | 411 | ||
405 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 412 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
406 | private bool m_reprioritizationEnabled = true; | 413 | private bool m_reprioritizationEnabled = true; |
@@ -444,6 +451,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
444 | get { return m_sceneGridService; } | 451 | get { return m_sceneGridService; } |
445 | } | 452 | } |
446 | 453 | ||
454 | public ISnmpModule SnmpService | ||
455 | { | ||
456 | get | ||
457 | { | ||
458 | if (m_snmpService == null) | ||
459 | { | ||
460 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
461 | } | ||
462 | |||
463 | return m_snmpService; | ||
464 | } | ||
465 | } | ||
466 | |||
447 | public ISimulationDataService SimulationDataService | 467 | public ISimulationDataService SimulationDataService |
448 | { | 468 | { |
449 | get | 469 | get |
@@ -736,6 +756,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
736 | m_SimulationDataService = simDataService; | 756 | m_SimulationDataService = simDataService; |
737 | m_EstateDataService = estateDataService; | 757 | m_EstateDataService = estateDataService; |
738 | m_regionHandle = RegionInfo.RegionHandle; | 758 | m_regionHandle = RegionInfo.RegionHandle; |
759 | m_lastIncoming = 0; | ||
760 | m_lastOutgoing = 0; | ||
739 | 761 | ||
740 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 762 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
741 | m_asyncSceneObjectDeleter.Enabled = true; | 763 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -829,7 +851,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
829 | 851 | ||
830 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | 852 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); |
831 | 853 | ||
832 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | 854 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
833 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); | 855 | UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); |
834 | if (!UseBackup) | 856 | if (!UseBackup) |
835 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 857 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
@@ -837,10 +859,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
837 | //Animation states | 859 | //Animation states |
838 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 860 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
839 | 861 | ||
840 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); | 862 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
841 | 863 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); | |
842 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | ||
843 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | ||
844 | 864 | ||
845 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | 865 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); |
846 | if (RegionInfo.NonphysPrimMin > 0) | 866 | if (RegionInfo.NonphysPrimMin > 0) |
@@ -861,11 +881,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
861 | } | 881 | } |
862 | 882 | ||
863 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 883 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
884 | |||
864 | if (RegionInfo.PhysPrimMax > 0) | 885 | if (RegionInfo.PhysPrimMax > 0) |
865 | { | 886 | { |
866 | m_maxPhys = RegionInfo.PhysPrimMax; | 887 | m_maxPhys = RegionInfo.PhysPrimMax; |
867 | } | 888 | } |
868 | 889 | ||
890 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | ||
891 | if (RegionInfo.LinksetCapacity > 0) | ||
892 | { | ||
893 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
894 | } | ||
895 | |||
896 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | ||
897 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | ||
898 | |||
869 | // Here, if clamping is requested in either global or | 899 | // Here, if clamping is requested in either global or |
870 | // local config, it will be used | 900 | // local config, it will be used |
871 | // | 901 | // |
@@ -875,13 +905,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
875 | m_clampPrimSize = true; | 905 | m_clampPrimSize = true; |
876 | } | 906 | } |
877 | 907 | ||
878 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 908 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
879 | if (RegionInfo.LinksetCapacity > 0) | ||
880 | { | ||
881 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
882 | } | ||
883 | |||
884 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); | ||
885 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 909 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
886 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 910 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
887 | m_dontPersistBefore = | 911 | m_dontPersistBefore = |
@@ -892,11 +916,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
892 | m_persistAfter *= 10000000; | 916 | m_persistAfter *= 10000000; |
893 | 917 | ||
894 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 918 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
895 | 919 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | |
896 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | ||
897 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | ||
898 | 920 | ||
899 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 921 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
922 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
923 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
900 | 924 | ||
901 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; | 925 | string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; |
902 | 926 | ||
@@ -941,7 +965,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
941 | 965 | ||
942 | if (grant.Length > 0) | 966 | if (grant.Length > 0) |
943 | { | 967 | { |
944 | foreach (string viewer in grant.Split('|')) | 968 | foreach (string viewer in grant.Split(',')) |
945 | { | 969 | { |
946 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | 970 | m_AllowedViewers.Add(viewer.Trim().ToLower()); |
947 | } | 971 | } |
@@ -953,7 +977,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
953 | 977 | ||
954 | if (grant.Length > 0) | 978 | if (grant.Length > 0) |
955 | { | 979 | { |
956 | foreach (string viewer in grant.Split('|')) | 980 | foreach (string viewer in grant.Split(',')) |
957 | { | 981 | { |
958 | m_BannedViewers.Add(viewer.Trim().ToLower()); | 982 | m_BannedViewers.Add(viewer.Trim().ToLower()); |
959 | } | 983 | } |
@@ -1013,6 +1037,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1013 | StatsReporter = new SimStatsReporter(this); | 1037 | StatsReporter = new SimStatsReporter(this); |
1014 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1038 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
1015 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1039 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1040 | |||
1041 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | ||
1016 | } | 1042 | } |
1017 | 1043 | ||
1018 | public Scene(RegionInfo regInfo) : base(regInfo) | 1044 | public Scene(RegionInfo regInfo) : base(regInfo) |
@@ -1308,8 +1334,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1308 | // Stop all client threads. | 1334 | // Stop all client threads. |
1309 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); | 1335 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); |
1310 | 1336 | ||
1311 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1337 | m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); |
1312 | EventManager.TriggerSceneShuttingDown(this); | 1338 | EventManager.TriggerSceneShuttingDown(this); |
1339 | |||
1340 | m_log.Debug("[SCENE]: Persisting changed objects"); | ||
1341 | |||
1313 | Backup(false); | 1342 | Backup(false); |
1314 | m_sceneGraph.Close(); | 1343 | m_sceneGraph.Close(); |
1315 | 1344 | ||
@@ -1323,6 +1352,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1323 | // attempt to reference a null or disposed physics scene. | 1352 | // attempt to reference a null or disposed physics scene. |
1324 | if (PhysicsScene != null) | 1353 | if (PhysicsScene != null) |
1325 | { | 1354 | { |
1355 | m_log.Debug("[SCENE]: Dispose Physics"); | ||
1326 | PhysicsScene phys = PhysicsScene; | 1356 | PhysicsScene phys = PhysicsScene; |
1327 | // remove the physics engine from both Scene and SceneGraph | 1357 | // remove the physics engine from both Scene and SceneGraph |
1328 | PhysicsScene = null; | 1358 | PhysicsScene = null; |
@@ -1345,11 +1375,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1345 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1375 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1346 | if (m_heartbeatThread != null) | 1376 | if (m_heartbeatThread != null) |
1347 | { | 1377 | { |
1378 | m_hbRestarts++; | ||
1379 | if(m_hbRestarts > 10) | ||
1380 | Environment.Exit(1); | ||
1381 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1382 | |||
1383 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1384 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1385 | //proc.EnableRaisingEvents=false; | ||
1386 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1387 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1388 | //proc.Start(); | ||
1389 | //proc.WaitForExit(); | ||
1390 | //Thread.Sleep(1000); | ||
1391 | //Environment.Exit(1); | ||
1348 | m_heartbeatThread.Abort(); | 1392 | m_heartbeatThread.Abort(); |
1393 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1349 | m_heartbeatThread = null; | 1394 | m_heartbeatThread = null; |
1350 | } | 1395 | } |
1351 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1396 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1352 | 1397 | ||
1398 | // m_sceneGraph.PreparePhysicsSimulation(); | ||
1399 | |||
1400 | |||
1353 | m_heartbeatThread | 1401 | m_heartbeatThread |
1354 | = Watchdog.StartThread( | 1402 | = Watchdog.StartThread( |
1355 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1403 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
@@ -1492,16 +1540,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1492 | endFrame = Frame + frames; | 1540 | endFrame = Frame + frames; |
1493 | 1541 | ||
1494 | float physicsFPS = 0f; | 1542 | float physicsFPS = 0f; |
1495 | int previousFrameTick, tmpMS; | 1543 | int tmpMS; |
1496 | int maintc = Util.EnvironmentTickCount(); | 1544 | int previousFrameTick; |
1545 | int maintc; | ||
1546 | int sleepMS; | ||
1547 | int framestart; | ||
1497 | 1548 | ||
1498 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1549 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1499 | { | 1550 | { |
1551 | framestart = Util.EnvironmentTickCount(); | ||
1500 | ++Frame; | 1552 | ++Frame; |
1501 | 1553 | ||
1502 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1554 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1503 | 1555 | ||
1504 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1556 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1505 | 1557 | ||
1506 | try | 1558 | try |
1507 | { | 1559 | { |
@@ -1553,6 +1605,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1553 | m_sceneGraph.UpdatePresences(); | 1605 | m_sceneGraph.UpdatePresences(); |
1554 | 1606 | ||
1555 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1607 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1608 | |||
1556 | 1609 | ||
1557 | // Delete temp-on-rez stuff | 1610 | // Delete temp-on-rez stuff |
1558 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1611 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
@@ -1634,34 +1687,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
1634 | 1687 | ||
1635 | Watchdog.UpdateThread(); | 1688 | Watchdog.UpdateThread(); |
1636 | 1689 | ||
1690 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1691 | |||
1692 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1693 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1694 | StatsReporter.AddFPS(1); | ||
1695 | |||
1696 | StatsReporter.addAgentMS(agentMS); | ||
1697 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1698 | StatsReporter.addOtherMS(otherMS); | ||
1699 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1700 | |||
1637 | previousFrameTick = m_lastFrameTick; | 1701 | previousFrameTick = m_lastFrameTick; |
1638 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1702 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1639 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1703 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); |
1640 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1704 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1641 | 1705 | ||
1706 | m_firstHeartbeat = false; | ||
1707 | |||
1708 | sleepMS = Util.EnvironmentTickCount(); | ||
1709 | |||
1642 | if (tmpMS > 0) | 1710 | if (tmpMS > 0) |
1643 | { | ||
1644 | Thread.Sleep(tmpMS); | 1711 | Thread.Sleep(tmpMS); |
1645 | spareMS += tmpMS; | ||
1646 | } | ||
1647 | |||
1648 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | ||
1649 | maintc = Util.EnvironmentTickCount(); | ||
1650 | 1712 | ||
1651 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1713 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); |
1714 | frameMS = Util.EnvironmentTickCountSubtract(framestart); | ||
1715 | StatsReporter.addSleepMS(sleepMS); | ||
1716 | StatsReporter.addFrameMS(frameMS); | ||
1652 | 1717 | ||
1653 | // if (Frame%m_update_avatars == 0) | 1718 | // if (Frame%m_update_avatars == 0) |
1654 | // UpdateInWorldTime(); | 1719 | // UpdateInWorldTime(); |
1655 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1656 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1657 | StatsReporter.AddFPS(1); | ||
1658 | 1720 | ||
1659 | StatsReporter.addFrameMS(frameMS); | ||
1660 | StatsReporter.addAgentMS(agentMS); | ||
1661 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1662 | StatsReporter.addOtherMS(otherMS); | ||
1663 | StatsReporter.AddSpareMS(spareMS); | ||
1664 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1665 | 1721 | ||
1666 | // Optionally warn if a frame takes double the amount of time that it should. | 1722 | // Optionally warn if a frame takes double the amount of time that it should. |
1667 | if (DebugUpdates | 1723 | if (DebugUpdates |
@@ -1678,7 +1734,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1678 | public void AddGroupTarget(SceneObjectGroup grp) | 1734 | public void AddGroupTarget(SceneObjectGroup grp) |
1679 | { | 1735 | { |
1680 | lock (m_groupsWithTargets) | 1736 | lock (m_groupsWithTargets) |
1681 | m_groupsWithTargets[grp.UUID] = grp; | 1737 | m_groupsWithTargets[grp.UUID] = 0; |
1682 | } | 1738 | } |
1683 | 1739 | ||
1684 | public void RemoveGroupTarget(SceneObjectGroup grp) | 1740 | public void RemoveGroupTarget(SceneObjectGroup grp) |
@@ -1689,18 +1745,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1689 | 1745 | ||
1690 | private void CheckAtTargets() | 1746 | private void CheckAtTargets() |
1691 | { | 1747 | { |
1692 | List<SceneObjectGroup> objs = null; | 1748 | List<UUID> objs = null; |
1693 | 1749 | ||
1694 | lock (m_groupsWithTargets) | 1750 | lock (m_groupsWithTargets) |
1695 | { | 1751 | { |
1696 | if (m_groupsWithTargets.Count != 0) | 1752 | if (m_groupsWithTargets.Count != 0) |
1697 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); | 1753 | objs = new List<UUID>(m_groupsWithTargets.Keys); |
1698 | } | 1754 | } |
1699 | 1755 | ||
1700 | if (objs != null) | 1756 | if (objs != null) |
1701 | { | 1757 | { |
1702 | foreach (SceneObjectGroup entry in objs) | 1758 | foreach (UUID entry in objs) |
1703 | entry.checkAtTargets(); | 1759 | { |
1760 | SceneObjectGroup grp = GetSceneObjectGroup(entry); | ||
1761 | if (grp == null) | ||
1762 | m_groupsWithTargets.Remove(entry); | ||
1763 | else | ||
1764 | grp.checkAtTargets(); | ||
1765 | } | ||
1704 | } | 1766 | } |
1705 | } | 1767 | } |
1706 | 1768 | ||
@@ -1779,7 +1841,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1779 | msg.fromAgentName = "Server"; | 1841 | msg.fromAgentName = "Server"; |
1780 | msg.dialog = (byte)19; // Object msg | 1842 | msg.dialog = (byte)19; // Object msg |
1781 | msg.fromGroup = false; | 1843 | msg.fromGroup = false; |
1782 | msg.offline = (byte)0; | 1844 | msg.offline = (byte)1; |
1783 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1845 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1784 | msg.Position = Vector3.Zero; | 1846 | msg.Position = Vector3.Zero; |
1785 | msg.RegionID = RegionInfo.RegionID.Guid; | 1847 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -2008,7 +2070,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2008 | return PhysicsScene.SupportsRaycastWorldFiltered(); | 2070 | return PhysicsScene.SupportsRaycastWorldFiltered(); |
2009 | } | 2071 | } |
2010 | 2072 | ||
2011 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | 2073 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) |
2012 | { | 2074 | { |
2013 | if (PhysicsScene == null) | 2075 | if (PhysicsScene == null) |
2014 | return null; | 2076 | return null; |
@@ -2030,14 +2092,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2030 | /// <returns></returns> | 2092 | /// <returns></returns> |
2031 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 2093 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
2032 | { | 2094 | { |
2095 | |||
2096 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
2097 | Vector3 wpos = Vector3.Zero; | ||
2098 | // Check for water surface intersection from above | ||
2099 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
2100 | { | ||
2101 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
2102 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
2103 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
2104 | wpos.Z = wheight; | ||
2105 | } | ||
2106 | |||
2033 | Vector3 pos = Vector3.Zero; | 2107 | Vector3 pos = Vector3.Zero; |
2034 | if (RayEndIsIntersection == (byte)1) | 2108 | if (RayEndIsIntersection == (byte)1) |
2035 | { | 2109 | { |
2036 | pos = RayEnd; | 2110 | pos = RayEnd; |
2037 | return pos; | ||
2038 | } | 2111 | } |
2039 | 2112 | else if (RayTargetID != UUID.Zero) | |
2040 | if (RayTargetID != UUID.Zero) | ||
2041 | { | 2113 | { |
2042 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2114 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2043 | 2115 | ||
@@ -2059,7 +2131,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2059 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 2131 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
2060 | 2132 | ||
2061 | // Un-comment out the following line to Get Raytrace results printed to the console. | 2133 | // Un-comment out the following line to Get Raytrace results printed to the console. |
2062 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 2134 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
2063 | float ScaleOffset = 0.5f; | 2135 | float ScaleOffset = 0.5f; |
2064 | 2136 | ||
2065 | // If we hit something | 2137 | // If we hit something |
@@ -2082,13 +2154,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2082 | //pos.Z -= 0.25F; | 2154 | //pos.Z -= 0.25F; |
2083 | 2155 | ||
2084 | } | 2156 | } |
2085 | |||
2086 | return pos; | ||
2087 | } | 2157 | } |
2088 | else | 2158 | else |
2089 | { | 2159 | { |
2090 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2160 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
2091 | |||
2092 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2161 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
2093 | 2162 | ||
2094 | // Un-comment the following line to print the raytrace results to the console. | 2163 | // Un-comment the following line to print the raytrace results to the console. |
@@ -2097,13 +2166,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2097 | if (ei.HitTF) | 2166 | if (ei.HitTF) |
2098 | { | 2167 | { |
2099 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2168 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
2100 | } else | 2169 | } |
2170 | else | ||
2101 | { | 2171 | { |
2102 | // fall back to our stupid functionality | 2172 | // fall back to our stupid functionality |
2103 | pos = RayEnd; | 2173 | pos = RayEnd; |
2104 | } | 2174 | } |
2105 | |||
2106 | return pos; | ||
2107 | } | 2175 | } |
2108 | } | 2176 | } |
2109 | else | 2177 | else |
@@ -2114,8 +2182,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2114 | //increase height so its above the ground. | 2182 | //increase height so its above the ground. |
2115 | //should be getting the normal of the ground at the rez point and using that? | 2183 | //should be getting the normal of the ground at the rez point and using that? |
2116 | pos.Z += scale.Z / 2f; | 2184 | pos.Z += scale.Z / 2f; |
2117 | return pos; | 2185 | // return pos; |
2118 | } | 2186 | } |
2187 | |||
2188 | // check against posible water intercept | ||
2189 | if (wpos.Z > pos.Z) pos = wpos; | ||
2190 | return pos; | ||
2119 | } | 2191 | } |
2120 | 2192 | ||
2121 | 2193 | ||
@@ -2206,12 +2278,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2206 | { | 2278 | { |
2207 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2279 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2208 | { | 2280 | { |
2281 | sceneObject.IsDeleted = false; | ||
2209 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2282 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2210 | return true; | 2283 | return true; |
2211 | } | 2284 | } |
2212 | 2285 | ||
2213 | return false; | 2286 | return false; |
2214 | |||
2215 | } | 2287 | } |
2216 | 2288 | ||
2217 | /// <summary> | 2289 | /// <summary> |
@@ -2303,6 +2375,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2303 | /// </summary> | 2375 | /// </summary> |
2304 | public void DeleteAllSceneObjects() | 2376 | public void DeleteAllSceneObjects() |
2305 | { | 2377 | { |
2378 | DeleteAllSceneObjects(false); | ||
2379 | } | ||
2380 | |||
2381 | /// <summary> | ||
2382 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2383 | /// </summary> | ||
2384 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2385 | { | ||
2386 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2306 | lock (Entities) | 2387 | lock (Entities) |
2307 | { | 2388 | { |
2308 | EntityBase[] entities = Entities.GetEntities(); | 2389 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2311,11 +2392,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2311 | if (e is SceneObjectGroup) | 2392 | if (e is SceneObjectGroup) |
2312 | { | 2393 | { |
2313 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2394 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2314 | if (!sog.IsAttachment) | 2395 | if (sog != null && !sog.IsAttachment) |
2315 | DeleteSceneObject((SceneObjectGroup)e, false); | 2396 | { |
2397 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2398 | { | ||
2399 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2400 | } | ||
2401 | else | ||
2402 | { | ||
2403 | toReturn.Add((SceneObjectGroup)e); | ||
2404 | } | ||
2405 | } | ||
2316 | } | 2406 | } |
2317 | } | 2407 | } |
2318 | } | 2408 | } |
2409 | if (toReturn.Count > 0) | ||
2410 | { | ||
2411 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2412 | } | ||
2319 | } | 2413 | } |
2320 | 2414 | ||
2321 | /// <summary> | 2415 | /// <summary> |
@@ -2350,6 +2444,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2350 | 2444 | ||
2351 | foreach (SceneObjectPart part in partList) | 2445 | foreach (SceneObjectPart part in partList) |
2352 | { | 2446 | { |
2447 | if (part.KeyframeMotion != null) | ||
2448 | { | ||
2449 | part.KeyframeMotion.Delete(); | ||
2450 | part.KeyframeMotion = null; | ||
2451 | } | ||
2452 | |||
2353 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) | 2453 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) |
2354 | { | 2454 | { |
2355 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? | 2455 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? |
@@ -2367,6 +2467,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2367 | } | 2467 | } |
2368 | 2468 | ||
2369 | group.DeleteGroupFromScene(silent); | 2469 | group.DeleteGroupFromScene(silent); |
2470 | if (!silent) | ||
2471 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2370 | 2472 | ||
2371 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2473 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2372 | } | 2474 | } |
@@ -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; |
@@ -2744,16 +2866,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2744 | // information that this is due to a teleport/border cross rather than an ordinary attachment. | 2866 | // information that this is due to a teleport/border cross rather than an ordinary attachment. |
2745 | // We currently do this in Scene.MakeRootAgent() instead. | 2867 | // We currently do this in Scene.MakeRootAgent() instead. |
2746 | if (AttachmentsModule != null) | 2868 | if (AttachmentsModule != null) |
2747 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); | 2869 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false, true); |
2748 | } | 2870 | } |
2749 | else | 2871 | else |
2750 | { | 2872 | { |
2873 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2751 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2874 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2752 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2875 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2753 | } | 2876 | } |
2877 | if (sceneObject.OwnerID == UUID.Zero) | ||
2878 | { | ||
2879 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2880 | return false; | ||
2881 | } | ||
2754 | } | 2882 | } |
2755 | else | 2883 | else |
2756 | { | 2884 | { |
2885 | if (sceneObject.OwnerID == UUID.Zero) | ||
2886 | { | ||
2887 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2888 | return false; | ||
2889 | } | ||
2757 | AddRestoredSceneObject(sceneObject, true, false); | 2890 | AddRestoredSceneObject(sceneObject, true, false); |
2758 | } | 2891 | } |
2759 | 2892 | ||
@@ -2770,6 +2903,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2770 | return 2; // StateSource.PrimCrossing | 2903 | return 2; // StateSource.PrimCrossing |
2771 | } | 2904 | } |
2772 | 2905 | ||
2906 | public int GetUserFlags(UUID user) | ||
2907 | { | ||
2908 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2909 | /* | ||
2910 | ScenePresence sp; | ||
2911 | if (TryGetScenePresence(user, out sp)) | ||
2912 | { | ||
2913 | return sp.UserFlags; | ||
2914 | } | ||
2915 | else | ||
2916 | { | ||
2917 | */ | ||
2918 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2919 | if (uac == null) | ||
2920 | return 0; | ||
2921 | return uac.UserFlags; | ||
2922 | //} | ||
2923 | } | ||
2773 | #endregion | 2924 | #endregion |
2774 | 2925 | ||
2775 | #region Add/Remove Avatar Methods | 2926 | #region Add/Remove Avatar Methods |
@@ -2802,7 +2953,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2802 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2953 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2803 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2954 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2804 | 2955 | ||
2805 | // CheckHeartbeat(); | 2956 | CheckHeartbeat(); |
2806 | 2957 | ||
2807 | sp = GetScenePresence(client.AgentId); | 2958 | sp = GetScenePresence(client.AgentId); |
2808 | 2959 | ||
@@ -2820,6 +2971,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2820 | SubscribeToClientEvents(client); | 2971 | SubscribeToClientEvents(client); |
2821 | 2972 | ||
2822 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | 2973 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); |
2974 | InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46); | ||
2975 | if (cof == null) | ||
2976 | sp.COF = UUID.Zero; | ||
2977 | else | ||
2978 | sp.COF = cof.ID; | ||
2979 | |||
2980 | m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF); | ||
2823 | m_eventManager.TriggerOnNewPresence(sp); | 2981 | m_eventManager.TriggerOnNewPresence(sp); |
2824 | 2982 | ||
2825 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | 2983 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; |
@@ -2932,19 +3090,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2932 | // and the scene presence and the client, if they exist | 3090 | // and the scene presence and the client, if they exist |
2933 | try | 3091 | try |
2934 | { | 3092 | { |
2935 | // We need to wait for the client to make UDP contact first. | 3093 | ScenePresence sp = GetScenePresence(agentID); |
2936 | // It's the UDP contact that creates the scene presence | 3094 | |
2937 | ScenePresence sp = WaitGetScenePresence(agentID); | ||
2938 | if (sp != null) | 3095 | if (sp != null) |
2939 | { | 3096 | { |
2940 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 3097 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2941 | |||
2942 | sp.ControllingClient.Close(); | 3098 | sp.ControllingClient.Close(); |
2943 | } | 3099 | } |
2944 | else | 3100 | |
2945 | { | ||
2946 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2947 | } | ||
2948 | // BANG! SLASH! | 3101 | // BANG! SLASH! |
2949 | m_authenticateHandler.RemoveCircuit(agentID); | 3102 | m_authenticateHandler.RemoveCircuit(agentID); |
2950 | 3103 | ||
@@ -2989,6 +3142,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2989 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3142 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2990 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 3143 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2991 | 3144 | ||
3145 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
3146 | |||
2992 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3147 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2993 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3148 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2994 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3149 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3045,6 +3200,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3045 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3200 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
3046 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3201 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
3047 | client.OnCopyInventoryItem += CopyInventoryItem; | 3202 | client.OnCopyInventoryItem += CopyInventoryItem; |
3203 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
3048 | client.OnMoveInventoryItem += MoveInventoryItem; | 3204 | client.OnMoveInventoryItem += MoveInventoryItem; |
3049 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3205 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
3050 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3206 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3116,6 +3272,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3116 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3272 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
3117 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3273 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
3118 | 3274 | ||
3275 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3276 | |||
3119 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3277 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3120 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3278 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3121 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3279 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3218,7 +3376,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3218 | /// </summary> | 3376 | /// </summary> |
3219 | /// <param name="agentId">The avatar's Unique ID</param> | 3377 | /// <param name="agentId">The avatar's Unique ID</param> |
3220 | /// <param name="client">The IClientAPI for the client</param> | 3378 | /// <param name="client">The IClientAPI for the client</param> |
3221 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3379 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3222 | { | 3380 | { |
3223 | if (EntityTransferModule != null) | 3381 | if (EntityTransferModule != null) |
3224 | { | 3382 | { |
@@ -3229,6 +3387,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3229 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3387 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
3230 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3388 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3231 | } | 3389 | } |
3390 | return false; | ||
3232 | } | 3391 | } |
3233 | 3392 | ||
3234 | /// <summary> | 3393 | /// <summary> |
@@ -3338,6 +3497,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3338 | /// <param name="flags"></param> | 3497 | /// <param name="flags"></param> |
3339 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3498 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3340 | { | 3499 | { |
3500 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3501 | ScenePresence presence; | ||
3502 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3503 | { | ||
3504 | if (presence.Appearance != null) | ||
3505 | { | ||
3506 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3507 | } | ||
3508 | } | ||
3509 | |||
3341 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3510 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3342 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3511 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3343 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3512 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3439,7 +3608,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3439 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop | 3608 | // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop |
3440 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI | 3609 | // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI |
3441 | if (closeChildAgents && CapsModule != null) | 3610 | if (closeChildAgents && CapsModule != null) |
3442 | CapsModule.RemoveCaps(agentID); | 3611 | CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); |
3443 | 3612 | ||
3444 | // // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever | 3613 | // // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever |
3445 | // // this method is doing is HORRIBLE!!! | 3614 | // // this method is doing is HORRIBLE!!! |
@@ -3475,6 +3644,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3475 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3644 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3476 | if (AgentTransactionsModule != null) | 3645 | if (AgentTransactionsModule != null) |
3477 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3646 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3647 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3478 | } | 3648 | } |
3479 | catch (Exception e) | 3649 | catch (Exception e) |
3480 | { | 3650 | { |
@@ -3667,15 +3837,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
3667 | agent.firstname, agent.lastname, agent.Viewer); | 3837 | agent.firstname, agent.lastname, agent.Viewer); |
3668 | reason = "Access denied, your viewer is banned by the region owner"; | 3838 | reason = "Access denied, your viewer is banned by the region owner"; |
3669 | return false; | 3839 | return false; |
3670 | } | 3840 | } |
3671 | 3841 | ||
3672 | ILandObject land; | 3842 | ScenePresence sp = GetScenePresence(agent.AgentID); |
3673 | 3843 | ||
3674 | lock (agent) | 3844 | // If we have noo presence here or if that presence is a zombie root |
3845 | // presence that will be kicled, we need a new CAPS object. | ||
3846 | if (sp == null || (sp != null && !sp.IsChildAgent)) | ||
3675 | { | 3847 | { |
3676 | ScenePresence sp = GetScenePresence(agent.AgentID); | 3848 | if (CapsModule != null) |
3677 | 3849 | { | |
3678 | if (sp != null && !sp.IsChildAgent) | 3850 | lock (agent) |
3851 | { | ||
3852 | CapsModule.SetAgentCapsSeeds(agent); | ||
3853 | CapsModule.CreateCaps(agent.AgentID, agent.circuitcode); | ||
3854 | } | ||
3855 | } | ||
3856 | } | ||
3857 | |||
3858 | if (sp != null) | ||
3859 | { | ||
3860 | if (!sp.IsChildAgent) | ||
3679 | { | 3861 | { |
3680 | // We have a zombie from a crashed session. | 3862 | // We have a zombie from a crashed session. |
3681 | // Or the same user is trying to be root twice here, won't work. | 3863 | // Or the same user is trying to be root twice here, won't work. |
@@ -3683,22 +3865,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
3683 | m_log.WarnFormat( | 3865 | m_log.WarnFormat( |
3684 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | 3866 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", |
3685 | sp.Name, sp.UUID, RegionInfo.RegionName); | 3867 | sp.Name, sp.UUID, RegionInfo.RegionName); |
3686 | 3868 | ||
3687 | sp.ControllingClient.Close(true); | 3869 | sp.ControllingClient.Close(true, true); |
3688 | sp = null; | 3870 | sp = null; |
3689 | } | 3871 | } |
3690 | 3872 | } | |
3691 | land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | 3873 | |
3692 | 3874 | lock (agent) | |
3875 | { | ||
3693 | //On login test land permisions | 3876 | //On login test land permisions |
3694 | if (vialogin) | 3877 | if (vialogin) |
3695 | { | 3878 | { |
3696 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3879 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3880 | if (cache != null) | ||
3881 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3882 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3697 | { | 3883 | { |
3884 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3698 | return false; | 3885 | return false; |
3699 | } | 3886 | } |
3700 | } | 3887 | } |
3701 | 3888 | ||
3702 | if (sp == null) // We don't have an [child] agent here already | 3889 | if (sp == null) // We don't have an [child] agent here already |
3703 | { | 3890 | { |
3704 | if (requirePresenceLookup) | 3891 | if (requirePresenceLookup) |
@@ -3707,54 +3894,53 @@ namespace OpenSim.Region.Framework.Scenes | |||
3707 | { | 3894 | { |
3708 | if (!VerifyUserPresence(agent, out reason)) | 3895 | if (!VerifyUserPresence(agent, out reason)) |
3709 | return false; | 3896 | return false; |
3710 | } | 3897 | } catch (Exception e) |
3711 | catch (Exception e) | ||
3712 | { | 3898 | { |
3713 | m_log.ErrorFormat( | 3899 | m_log.ErrorFormat( |
3714 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3900 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3715 | |||
3716 | return false; | 3901 | return false; |
3717 | } | 3902 | } |
3718 | } | 3903 | } |
3719 | 3904 | ||
3720 | try | 3905 | try |
3721 | { | 3906 | { |
3722 | if (!AuthorizeUser(agent, out reason)) | 3907 | // Always check estate if this is a login. Always |
3723 | return false; | 3908 | // check if banned regions are to be blacked out. |
3909 | if (vialogin || (!m_seeIntoBannedRegion)) | ||
3910 | { | ||
3911 | if (!AuthorizeUser(agent, out reason)) | ||
3912 | { | ||
3913 | return false; | ||
3914 | } | ||
3915 | } | ||
3724 | } | 3916 | } |
3725 | catch (Exception e) | 3917 | catch (Exception e) |
3726 | { | 3918 | { |
3727 | m_log.ErrorFormat( | 3919 | m_log.ErrorFormat( |
3728 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3920 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3729 | |||
3730 | return false; | 3921 | return false; |
3731 | } | 3922 | } |
3732 | 3923 | ||
3733 | m_log.InfoFormat( | 3924 | m_log.InfoFormat( |
3734 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3925 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3735 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3926 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3736 | agent.AgentID, agent.circuitcode); | 3927 | agent.AgentID, agent.circuitcode); |
3737 | 3928 | ||
3738 | if (CapsModule != null) | ||
3739 | { | ||
3740 | CapsModule.SetAgentCapsSeeds(agent); | ||
3741 | CapsModule.CreateCaps(agent.AgentID); | ||
3742 | } | ||
3743 | } | 3929 | } |
3744 | else | 3930 | else |
3745 | { | 3931 | { |
3746 | // Let the SP know how we got here. This has a lot of interesting | 3932 | // Let the SP know how we got here. This has a lot of interesting |
3747 | // uses down the line. | 3933 | // uses down the line. |
3748 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3934 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3749 | 3935 | ||
3750 | if (sp.IsChildAgent) | 3936 | if (sp.IsChildAgent) |
3751 | { | 3937 | { |
3752 | m_log.DebugFormat( | 3938 | m_log.DebugFormat( |
3753 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3939 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3754 | agent.AgentID, RegionInfo.RegionName); | 3940 | agent.AgentID, RegionInfo.RegionName); |
3755 | 3941 | ||
3756 | sp.AdjustKnownSeeds(); | 3942 | sp.AdjustKnownSeeds(); |
3757 | 3943 | ||
3758 | if (CapsModule != null) | 3944 | if (CapsModule != null) |
3759 | CapsModule.SetAgentCapsSeeds(agent); | 3945 | CapsModule.SetAgentCapsSeeds(agent); |
3760 | } | 3946 | } |
@@ -3765,6 +3951,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3765 | agent.teleportFlags = teleportFlags; | 3951 | agent.teleportFlags = teleportFlags; |
3766 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | 3952 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); |
3767 | 3953 | ||
3954 | if (CapsModule != null) | ||
3955 | { | ||
3956 | CapsModule.ActivateCaps(agent.circuitcode); | ||
3957 | } | ||
3958 | |||
3768 | if (vialogin) | 3959 | if (vialogin) |
3769 | { | 3960 | { |
3770 | // CleanDroppedAttachments(); | 3961 | // CleanDroppedAttachments(); |
@@ -3856,6 +4047,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3856 | } | 4047 | } |
3857 | 4048 | ||
3858 | // Honor parcel landing type and position. | 4049 | // Honor parcel landing type and position. |
4050 | /* | ||
4051 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3859 | if (land != null) | 4052 | if (land != null) |
3860 | { | 4053 | { |
3861 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4054 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3863,25 +4056,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
3863 | agent.startpos = land.LandData.UserLocation; | 4056 | agent.startpos = land.LandData.UserLocation; |
3864 | } | 4057 | } |
3865 | } | 4058 | } |
4059 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3866 | } | 4060 | } |
3867 | 4061 | ||
3868 | return true; | 4062 | return true; |
3869 | } | 4063 | } |
3870 | 4064 | ||
3871 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 4065 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3872 | { | 4066 | { |
3873 | bool banned = land.IsBannedFromLand(agent.AgentID); | 4067 | if (posX < 0) |
3874 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 4068 | posX = 0; |
4069 | else if (posX >= 256) | ||
4070 | posX = 255.999f; | ||
4071 | if (posY < 0) | ||
4072 | posY = 0; | ||
4073 | else if (posY >= 256) | ||
4074 | posY = 255.999f; | ||
4075 | |||
4076 | reason = String.Empty; | ||
4077 | if (Permissions.IsGod(agentID)) | ||
4078 | return true; | ||
4079 | |||
4080 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
4081 | if (land == null) | ||
4082 | return false; | ||
4083 | |||
4084 | bool banned = land.IsBannedFromLand(agentID); | ||
4085 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3875 | 4086 | ||
3876 | if (banned || restricted) | 4087 | if (banned || restricted) |
3877 | { | 4088 | { |
3878 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 4089 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3879 | if (nearestParcel != null) | 4090 | if (nearestParcel != null) |
3880 | { | 4091 | { |
3881 | //Move agent to nearest allowed | 4092 | //Move agent to nearest allowed |
3882 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 4093 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3883 | agent.startpos.X = newPosition.X; | 4094 | posX = newPosition.X; |
3884 | agent.startpos.Y = newPosition.Y; | 4095 | posY = newPosition.Y; |
3885 | } | 4096 | } |
3886 | else | 4097 | else |
3887 | { | 4098 | { |
@@ -3943,7 +4154,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3943 | 4154 | ||
3944 | if (!m_strictAccessControl) return true; | 4155 | if (!m_strictAccessControl) return true; |
3945 | if (Permissions.IsGod(agent.AgentID)) return true; | 4156 | if (Permissions.IsGod(agent.AgentID)) return true; |
3946 | 4157 | ||
3947 | if (AuthorizationService != null) | 4158 | if (AuthorizationService != null) |
3948 | { | 4159 | { |
3949 | if (!AuthorizationService.IsAuthorizedForRegion( | 4160 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3958,7 +4169,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3958 | 4169 | ||
3959 | if (RegionInfo.EstateSettings != null) | 4170 | if (RegionInfo.EstateSettings != null) |
3960 | { | 4171 | { |
3961 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4172 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0)) |
3962 | { | 4173 | { |
3963 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4174 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3964 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4175 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -4148,6 +4359,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4148 | 4359 | ||
4149 | // XPTO: if this agent is not allowed here as root, always return false | 4360 | // XPTO: if this agent is not allowed here as root, always return false |
4150 | 4361 | ||
4362 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4363 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4364 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4365 | if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4366 | { | ||
4367 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4368 | return false; | ||
4369 | } | ||
4370 | |||
4151 | // TODO: This check should probably be in QueryAccess(). | 4371 | // TODO: This check should probably be in QueryAccess(). |
4152 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4372 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4153 | if (nearestParcel == null) | 4373 | if (nearestParcel == null) |
@@ -4212,7 +4432,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4212 | /// <param name='agentID'></param> | 4432 | /// <param name='agentID'></param> |
4213 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4433 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4214 | { | 4434 | { |
4215 | int ntimes = 10; | 4435 | int ntimes = 30; |
4216 | ScenePresence sp = null; | 4436 | ScenePresence sp = null; |
4217 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4437 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4218 | Thread.Sleep(1000); | 4438 | Thread.Sleep(1000); |
@@ -4242,6 +4462,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4242 | return false; | 4462 | return false; |
4243 | } | 4463 | } |
4244 | 4464 | ||
4465 | public bool IncomingCloseAgent(UUID agentID) | ||
4466 | { | ||
4467 | return IncomingCloseAgent(agentID, false); | ||
4468 | } | ||
4469 | |||
4470 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4471 | { | ||
4472 | return IncomingCloseAgent(agentID, true); | ||
4473 | } | ||
4474 | |||
4245 | /// <summary> | 4475 | /// <summary> |
4246 | /// Tell a single agent to disconnect from the region. | 4476 | /// Tell a single agent to disconnect from the region. |
4247 | /// </summary> | 4477 | /// </summary> |
@@ -4257,7 +4487,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4257 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4487 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4258 | if (presence != null) | 4488 | if (presence != null) |
4259 | { | 4489 | { |
4260 | presence.ControllingClient.Close(force); | 4490 | presence.ControllingClient.Close(force, force); |
4261 | return true; | 4491 | return true; |
4262 | } | 4492 | } |
4263 | 4493 | ||
@@ -4890,7 +5120,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4890 | { | 5120 | { |
4891 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) | 5121 | if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) |
4892 | { | 5122 | { |
4893 | if (grp.RootPart.Expires <= DateTime.Now) | 5123 | if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= DateTime.Now) |
4894 | DeleteSceneObject(grp, false); | 5124 | DeleteSceneObject(grp, false); |
4895 | } | 5125 | } |
4896 | } | 5126 | } |
@@ -4904,35 +5134,81 @@ namespace OpenSim.Region.Framework.Scenes | |||
4904 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); | 5134 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); |
4905 | } | 5135 | } |
4906 | 5136 | ||
4907 | public int GetHealth() | 5137 | public int GetHealth(out int flags, out string message) |
4908 | { | 5138 | { |
4909 | // Returns: | 5139 | // Returns: |
4910 | // 1 = sim is up and accepting http requests. The heartbeat has | 5140 | // 1 = sim is up and accepting http requests. The heartbeat has |
4911 | // stopped and the sim is probably locked up, but a remote | 5141 | // stopped and the sim is probably locked up, but a remote |
4912 | // admin restart may succeed | 5142 | // admin restart may succeed |
4913 | // | 5143 | // |
4914 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 5144 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4915 | // usable for people within and logins _may_ work | 5145 | // usable for people within |
4916 | // | 5146 | // |
4917 | // 3 = We have seen a new user enter within the past 4 minutes | 5147 | // 3 = Sim is up and one packet thread is running. Sim is |
5148 | // unstable and will not accept new logins | ||
5149 | // | ||
5150 | // 4 = Sim is up and both packet threads are running. Sim is | ||
5151 | // likely usable | ||
5152 | // | ||
5153 | // 5 = We have seen a new user enter within the past 4 minutes | ||
4918 | // which can be seen as positive confirmation of sim health | 5154 | // which can be seen as positive confirmation of sim health |
4919 | // | 5155 | // |
5156 | |||
5157 | flags = 0; | ||
5158 | message = String.Empty; | ||
5159 | |||
5160 | CheckHeartbeat(); | ||
5161 | |||
5162 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
5163 | { | ||
5164 | // We're still starting | ||
5165 | // 0 means "in startup", it can't happen another way, since | ||
5166 | // to get here, we must be able to accept http connections | ||
5167 | return 0; | ||
5168 | } | ||
5169 | |||
4920 | int health=1; // Start at 1, means we're up | 5170 | int health=1; // Start at 1, means we're up |
4921 | 5171 | ||
4922 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5172 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4923 | health += 1; | 5173 | { |
5174 | health+=1; | ||
5175 | flags |= 1; | ||
5176 | } | ||
5177 | |||
5178 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
5179 | { | ||
5180 | health+=1; | ||
5181 | flags |= 2; | ||
5182 | } | ||
5183 | |||
5184 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
5185 | { | ||
5186 | health+=1; | ||
5187 | flags |= 4; | ||
5188 | } | ||
4924 | else | 5189 | else |
5190 | { | ||
5191 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
5192 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
5193 | proc.EnableRaisingEvents=false; | ||
5194 | proc.StartInfo.FileName = "/bin/kill"; | ||
5195 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
5196 | proc.Start(); | ||
5197 | proc.WaitForExit(); | ||
5198 | Thread.Sleep(1000); | ||
5199 | Environment.Exit(1); | ||
5200 | } | ||
5201 | |||
5202 | if (flags != 7) | ||
4925 | return health; | 5203 | return health; |
4926 | 5204 | ||
4927 | // A login in the last 4 mins? We can't be doing too badly | 5205 | // A login in the last 4 mins? We can't be doing too badly |
4928 | // | 5206 | // |
4929 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5207 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4930 | health++; | 5208 | health++; |
4931 | else | 5209 | else |
4932 | return health; | 5210 | return health; |
4933 | 5211 | ||
4934 | // CheckHeartbeat(); | ||
4935 | |||
4936 | return health; | 5212 | return health; |
4937 | } | 5213 | } |
4938 | 5214 | ||
@@ -5020,7 +5296,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5020 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 5296 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
5021 | if (wasUsingPhysics) | 5297 | if (wasUsingPhysics) |
5022 | { | 5298 | { |
5023 | 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 | 5299 | 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 |
5024 | } | 5300 | } |
5025 | } | 5301 | } |
5026 | 5302 | ||
@@ -5119,14 +5395,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5119 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5395 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5120 | } | 5396 | } |
5121 | 5397 | ||
5122 | // private void CheckHeartbeat() | 5398 | private void CheckHeartbeat() |
5123 | // { | 5399 | { |
5124 | // if (m_firstHeartbeat) | 5400 | if (m_firstHeartbeat) |
5125 | // return; | 5401 | return; |
5126 | // | 5402 | |
5127 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5403 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
5128 | // StartTimer(); | 5404 | Start(); |
5129 | // } | 5405 | } |
5130 | 5406 | ||
5131 | public override ISceneObject DeserializeObject(string representation) | 5407 | public override ISceneObject DeserializeObject(string representation) |
5132 | { | 5408 | { |
@@ -5138,9 +5414,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5138 | get { return m_allowScriptCrossings; } | 5414 | get { return m_allowScriptCrossings; } |
5139 | } | 5415 | } |
5140 | 5416 | ||
5141 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 5417 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
5142 | { | 5418 | { |
5143 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 5419 | return GetNearestAllowedPosition(avatar, null); |
5420 | } | ||
5421 | |||
5422 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
5423 | { | ||
5424 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); | ||
5144 | 5425 | ||
5145 | if (nearestParcel != null) | 5426 | if (nearestParcel != null) |
5146 | { | 5427 | { |
@@ -5149,10 +5430,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5149 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5430 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5150 | if (nearestPoint != null) | 5431 | if (nearestPoint != null) |
5151 | { | 5432 | { |
5152 | // m_log.DebugFormat( | 5433 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
5153 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
5154 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
5155 | |||
5156 | return nearestPoint.Value; | 5434 | return nearestPoint.Value; |
5157 | } | 5435 | } |
5158 | 5436 | ||
@@ -5162,17 +5440,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
5162 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5440 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5163 | if (nearestPoint != null) | 5441 | if (nearestPoint != null) |
5164 | { | 5442 | { |
5165 | // m_log.DebugFormat( | 5443 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
5166 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
5167 | |||
5168 | return nearestPoint.Value; | 5444 | return nearestPoint.Value; |
5169 | } | 5445 | } |
5170 | 5446 | ||
5171 | //Ultimate backup if we have no idea where they are | 5447 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5172 | // m_log.DebugFormat( | 5448 | if (dest != excludeParcel) |
5173 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 5449 | { |
5450 | // Ultimate backup if we have no idea where they are and | ||
5451 | // the last allowed position was in another parcel | ||
5452 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
5453 | return avatar.lastKnownAllowedPosition; | ||
5454 | } | ||
5174 | 5455 | ||
5175 | return avatar.lastKnownAllowedPosition; | 5456 | // else fall through to region edge |
5176 | } | 5457 | } |
5177 | 5458 | ||
5178 | //Go to the edge, this happens in teleporting to a region with no available parcels | 5459 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -5206,13 +5487,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
5206 | 5487 | ||
5207 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 5488 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
5208 | { | 5489 | { |
5490 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
5491 | } | ||
5492 | |||
5493 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
5494 | { | ||
5209 | List<ILandObject> all = AllParcels(); | 5495 | List<ILandObject> all = AllParcels(); |
5210 | float minParcelDistance = float.MaxValue; | 5496 | float minParcelDistance = float.MaxValue; |
5211 | ILandObject nearestParcel = null; | 5497 | ILandObject nearestParcel = null; |
5212 | 5498 | ||
5213 | foreach (var parcel in all) | 5499 | foreach (var parcel in all) |
5214 | { | 5500 | { |
5215 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 5501 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
5216 | { | 5502 | { |
5217 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 5503 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
5218 | if (parcelDistance < minParcelDistance) | 5504 | if (parcelDistance < minParcelDistance) |
@@ -5428,7 +5714,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5428 | mapModule.GenerateMaptile(); | 5714 | mapModule.GenerateMaptile(); |
5429 | } | 5715 | } |
5430 | 5716 | ||
5431 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5717 | // public void CleanDroppedAttachments() |
5718 | // { | ||
5719 | // List<SceneObjectGroup> objectsToDelete = | ||
5720 | // new List<SceneObjectGroup>(); | ||
5721 | // | ||
5722 | // lock (m_cleaningAttachments) | ||
5723 | // { | ||
5724 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5725 | // { | ||
5726 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5727 | // { | ||
5728 | // UUID agentID = grp.OwnerID; | ||
5729 | // if (agentID == UUID.Zero) | ||
5730 | // { | ||
5731 | // objectsToDelete.Add(grp); | ||
5732 | // return; | ||
5733 | // } | ||
5734 | // | ||
5735 | // ScenePresence sp = GetScenePresence(agentID); | ||
5736 | // if (sp == null) | ||
5737 | // { | ||
5738 | // objectsToDelete.Add(grp); | ||
5739 | // return; | ||
5740 | // } | ||
5741 | // } | ||
5742 | // }); | ||
5743 | // } | ||
5744 | // | ||
5745 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5746 | // { | ||
5747 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5748 | // DeleteSceneObject(grp, true); | ||
5749 | // } | ||
5750 | // } | ||
5751 | |||
5752 | public void ThreadAlive(int threadCode) | ||
5753 | { | ||
5754 | switch(threadCode) | ||
5755 | { | ||
5756 | case 1: // Incoming | ||
5757 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5758 | break; | ||
5759 | case 2: // Incoming | ||
5760 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5761 | break; | ||
5762 | } | ||
5763 | } | ||
5764 | |||
5765 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5432 | { | 5766 | { |
5433 | RegenerateMaptile(); | 5767 | RegenerateMaptile(); |
5434 | 5768 | ||
@@ -5456,6 +5790,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5456 | /// <returns></returns> | 5790 | /// <returns></returns> |
5457 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5791 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5458 | { | 5792 | { |
5793 | reason = "You are banned from the region"; | ||
5794 | |||
5459 | if (EntityTransferModule.IsInTransit(agentID)) | 5795 | if (EntityTransferModule.IsInTransit(agentID)) |
5460 | { | 5796 | { |
5461 | reason = "Agent is still in transit from this region"; | 5797 | reason = "Agent is still in transit from this region"; |
@@ -5467,6 +5803,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5467 | return false; | 5803 | return false; |
5468 | } | 5804 | } |
5469 | 5805 | ||
5806 | if (Permissions.IsGod(agentID)) | ||
5807 | { | ||
5808 | reason = String.Empty; | ||
5809 | return true; | ||
5810 | } | ||
5811 | |||
5470 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5812 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5471 | // However, the long term fix is to make sure root agent count is always accurate. | 5813 | // However, the long term fix is to make sure root agent count is always accurate. |
5472 | m_sceneGraph.RecalculateStats(); | 5814 | m_sceneGraph.RecalculateStats(); |
@@ -5487,6 +5829,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5487 | } | 5829 | } |
5488 | } | 5830 | } |
5489 | 5831 | ||
5832 | ScenePresence presence = GetScenePresence(agentID); | ||
5833 | IClientAPI client = null; | ||
5834 | AgentCircuitData aCircuit = null; | ||
5835 | |||
5836 | if (presence != null) | ||
5837 | { | ||
5838 | client = presence.ControllingClient; | ||
5839 | if (client != null) | ||
5840 | aCircuit = client.RequestClientInfo(); | ||
5841 | } | ||
5842 | |||
5843 | // We may be called before there is a presence or a client. | ||
5844 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5845 | if (client == null) | ||
5846 | { | ||
5847 | aCircuit = new AgentCircuitData(); | ||
5848 | aCircuit.AgentID = agentID; | ||
5849 | aCircuit.firstname = String.Empty; | ||
5850 | aCircuit.lastname = String.Empty; | ||
5851 | } | ||
5852 | |||
5853 | try | ||
5854 | { | ||
5855 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5856 | { | ||
5857 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5858 | return false; | ||
5859 | } | ||
5860 | } | ||
5861 | catch (Exception e) | ||
5862 | { | ||
5863 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5864 | return false; | ||
5865 | } | ||
5866 | |||
5490 | if (position == Vector3.Zero) // Teleport | 5867 | if (position == Vector3.Zero) // Teleport |
5491 | { | 5868 | { |
5492 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5869 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5520,13 +5897,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5520 | } | 5897 | } |
5521 | } | 5898 | } |
5522 | } | 5899 | } |
5900 | |||
5901 | float posX = 128.0f; | ||
5902 | float posY = 128.0f; | ||
5903 | |||
5904 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5905 | { | ||
5906 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5907 | return false; | ||
5908 | } | ||
5909 | } | ||
5910 | else // Walking | ||
5911 | { | ||
5912 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5913 | if (land == null) | ||
5914 | return false; | ||
5915 | |||
5916 | bool banned = land.IsBannedFromLand(agentID); | ||
5917 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5918 | |||
5919 | if (banned || restricted) | ||
5920 | return false; | ||
5523 | } | 5921 | } |
5524 | 5922 | ||
5525 | reason = String.Empty; | 5923 | reason = String.Empty; |
5526 | return true; | 5924 | return true; |
5527 | } | 5925 | } |
5528 | 5926 | ||
5529 | /// <summary> | 5927 | public void StartTimerWatchdog() |
5928 | { | ||
5929 | m_timerWatchdog.Interval = 1000; | ||
5930 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5931 | m_timerWatchdog.AutoReset = true; | ||
5932 | m_timerWatchdog.Start(); | ||
5933 | } | ||
5934 | |||
5935 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5936 | { | ||
5937 | CheckHeartbeat(); | ||
5938 | } | ||
5939 | |||
5530 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5940 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5531 | /// autopilot that moves an avatar to a sit target!. | 5941 | /// autopilot that moves an avatar to a sit target!. |
5532 | /// </summary> | 5942 | /// </summary> |
@@ -5605,6 +6015,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5605 | return m_SpawnPoint - 1; | 6015 | return m_SpawnPoint - 1; |
5606 | } | 6016 | } |
5607 | 6017 | ||
6018 | private void HandleGcCollect(string module, string[] args) | ||
6019 | { | ||
6020 | GC.Collect(); | ||
6021 | } | ||
6022 | |||
5608 | /// <summary> | 6023 | /// <summary> |
5609 | /// Wrappers to get physics modules retrieve assets. | 6024 | /// Wrappers to get physics modules retrieve assets. |
5610 | /// </summary> | 6025 | /// </summary> |