diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 676 |
1 files changed, 518 insertions, 158 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 76e632e..44a738e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -113,6 +113,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
113 | // TODO: need to figure out how allow client agents but deny | 113 | // TODO: need to figure out how allow client agents but deny |
114 | // root agents when ACL denies access to root agent | 114 | // root agents when ACL denies access to root agent |
115 | public bool m_strictAccessControl = true; | 115 | public bool m_strictAccessControl = true; |
116 | public bool m_seeIntoBannedRegion = false; | ||
116 | public int MaxUndoCount = 5; | 117 | public int MaxUndoCount = 5; |
117 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; | 118 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; |
118 | public bool LoginLock = false; | 119 | public bool LoginLock = false; |
@@ -128,12 +129,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
128 | 129 | ||
129 | protected int m_splitRegionID; | 130 | protected int m_splitRegionID; |
130 | protected Timer m_restartWaitTimer = new Timer(); | 131 | protected Timer m_restartWaitTimer = new Timer(); |
132 | protected Timer m_timerWatchdog = new Timer(); | ||
131 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 133 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
132 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 134 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
133 | protected string m_simulatorVersion = "OpenSimulator Server"; | 135 | protected string m_simulatorVersion = "OpenSimulator Server"; |
134 | protected ModuleLoader m_moduleLoader; | 136 | protected ModuleLoader m_moduleLoader; |
135 | protected AgentCircuitManager m_authenticateHandler; | 137 | protected AgentCircuitManager m_authenticateHandler; |
136 | protected SceneCommunicationService m_sceneGridService; | 138 | protected SceneCommunicationService m_sceneGridService; |
139 | protected ISnmpModule m_snmpService = null; | ||
137 | 140 | ||
138 | protected ISimulationDataService m_SimulationDataService; | 141 | protected ISimulationDataService m_SimulationDataService; |
139 | protected IEstateDataService m_EstateDataService; | 142 | protected IEstateDataService m_EstateDataService; |
@@ -186,7 +189,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
186 | private int m_update_events = 1; | 189 | private int m_update_events = 1; |
187 | private int m_update_backup = 200; | 190 | private int m_update_backup = 200; |
188 | private int m_update_terrain = 50; | 191 | private int m_update_terrain = 50; |
189 | // private int m_update_land = 1; | 192 | private int m_update_land = 10; |
190 | private int m_update_coarse_locations = 50; | 193 | private int m_update_coarse_locations = 50; |
191 | 194 | ||
192 | private int agentMS; | 195 | private int agentMS; |
@@ -205,6 +208,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
205 | /// </summary> | 208 | /// </summary> |
206 | private int m_lastFrameTick; | 209 | private int m_lastFrameTick; |
207 | 210 | ||
211 | public bool CombineRegions = false; | ||
208 | /// <summary> | 212 | /// <summary> |
209 | /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched | 213 | /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched |
210 | /// asynchronously from the update loop. | 214 | /// asynchronously from the update loop. |
@@ -227,12 +231,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
227 | private bool m_scripts_enabled = true; | 231 | private bool m_scripts_enabled = true; |
228 | private string m_defaultScriptEngine; | 232 | private string m_defaultScriptEngine; |
229 | private int m_LastLogin; | 233 | private int m_LastLogin; |
230 | private Thread HeartbeatThread; | 234 | private Thread HeartbeatThread = null; |
231 | private volatile bool shuttingdown; | 235 | private volatile bool shuttingdown; |
232 | 236 | ||
233 | private int m_lastUpdate; | 237 | private int m_lastUpdate; |
238 | private int m_lastIncoming; | ||
239 | private int m_lastOutgoing; | ||
234 | private bool m_firstHeartbeat = true; | 240 | private bool m_firstHeartbeat = true; |
235 | 241 | private int m_hbRestarts = 0; | |
242 | |||
236 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 243 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
237 | private bool m_reprioritizationEnabled = true; | 244 | private bool m_reprioritizationEnabled = true; |
238 | private double m_reprioritizationInterval = 5000.0; | 245 | private double m_reprioritizationInterval = 5000.0; |
@@ -276,6 +283,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
276 | get { return m_sceneGridService; } | 283 | get { return m_sceneGridService; } |
277 | } | 284 | } |
278 | 285 | ||
286 | public ISnmpModule SnmpService | ||
287 | { | ||
288 | get | ||
289 | { | ||
290 | if (m_snmpService == null) | ||
291 | { | ||
292 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
293 | } | ||
294 | |||
295 | return m_snmpService; | ||
296 | } | ||
297 | } | ||
298 | |||
279 | public ISimulationDataService SimulationDataService | 299 | public ISimulationDataService SimulationDataService |
280 | { | 300 | { |
281 | get | 301 | get |
@@ -557,6 +577,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
557 | m_EstateDataService = estateDataService; | 577 | m_EstateDataService = estateDataService; |
558 | m_regionHandle = m_regInfo.RegionHandle; | 578 | m_regionHandle = m_regInfo.RegionHandle; |
559 | m_regionName = m_regInfo.RegionName; | 579 | m_regionName = m_regInfo.RegionName; |
580 | m_lastUpdate = Util.EnvironmentTickCount(); | ||
581 | m_lastIncoming = 0; | ||
582 | m_lastOutgoing = 0; | ||
560 | 583 | ||
561 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 584 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
562 | m_asyncSceneObjectDeleter.Enabled = true; | 585 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -641,96 +664,106 @@ namespace OpenSim.Region.Framework.Scenes | |||
641 | 664 | ||
642 | // Region config overrides global config | 665 | // Region config overrides global config |
643 | // | 666 | // |
644 | if (m_config.Configs["Startup"] != null) | 667 | try |
645 | { | 668 | { |
646 | IConfig startupConfig = m_config.Configs["Startup"]; | 669 | if (m_config.Configs["Startup"] != null) |
670 | { | ||
671 | IConfig startupConfig = m_config.Configs["Startup"]; | ||
647 | 672 | ||
648 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); | 673 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
649 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); | 674 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); |
650 | if (!m_useBackup) | 675 | if (!m_useBackup) |
651 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | 676 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
652 | 677 | ||
653 | //Animation states | 678 | //Animation states |
654 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | 679 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); |
655 | 680 | ||
656 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); | 681 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
657 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); | 682 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
658 | 683 | ||
659 | m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); | 684 | m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); |
660 | if (RegionInfo.NonphysPrimMax > 0) | 685 | if (RegionInfo.NonphysPrimMax > 0) |
661 | { | 686 | { |
662 | m_maxNonphys = RegionInfo.NonphysPrimMax; | 687 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
663 | } | 688 | } |
664 | 689 | ||
665 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 690 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
666 | 691 | ||
667 | if (RegionInfo.PhysPrimMax > 0) | 692 | if (RegionInfo.PhysPrimMax > 0) |
668 | { | 693 | { |
669 | m_maxPhys = RegionInfo.PhysPrimMax; | 694 | m_maxPhys = RegionInfo.PhysPrimMax; |
670 | } | 695 | } |
671 | 696 | ||
672 | // Here, if clamping is requested in either global or | 697 | // Here, if clamping is requested in either global or |
673 | // local config, it will be used | 698 | // local config, it will be used |
674 | // | 699 | // |
675 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | 700 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); |
676 | if (RegionInfo.ClampPrimSize) | 701 | if (RegionInfo.ClampPrimSize) |
677 | { | 702 | { |
678 | m_clampPrimSize = true; | 703 | m_clampPrimSize = true; |
679 | } | 704 | } |
680 | 705 | ||
681 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 706 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); |
682 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 707 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); |
683 | m_dontPersistBefore = | 708 | m_dontPersistBefore = |
684 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 709 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); |
685 | m_dontPersistBefore *= 10000000; | 710 | m_dontPersistBefore *= 10000000; |
686 | m_persistAfter = | 711 | m_persistAfter = |
687 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | 712 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); |
688 | m_persistAfter *= 10000000; | 713 | m_persistAfter *= 10000000; |
689 | 714 | ||
690 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 715 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
716 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
691 | 717 | ||
692 | IConfig packetConfig = m_config.Configs["PacketPool"]; | 718 | IConfig packetConfig = m_config.Configs["PacketPool"]; |
693 | if (packetConfig != null) | 719 | if (packetConfig != null) |
694 | { | 720 | { |
695 | PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); | 721 | PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); |
696 | PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); | 722 | PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); |
697 | } | 723 | } |
698 | 724 | ||
699 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 725 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
726 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
727 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
700 | 728 | ||
701 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 729 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); |
702 | if (m_generateMaptiles) | 730 | if (m_generateMaptiles) |
703 | { | ||
704 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | ||
705 | if (maptileRefresh != 0) | ||
706 | { | 731 | { |
707 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | 732 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); |
708 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | 733 | if (maptileRefresh != 0) |
709 | m_mapGenerationTimer.AutoReset = true; | 734 | { |
710 | m_mapGenerationTimer.Start(); | 735 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; |
736 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
737 | m_mapGenerationTimer.AutoReset = true; | ||
738 | m_mapGenerationTimer.Start(); | ||
739 | } | ||
711 | } | 740 | } |
712 | } | 741 | else |
713 | else | ||
714 | { | ||
715 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
716 | UUID tileID; | ||
717 | |||
718 | if (UUID.TryParse(tile, out tileID)) | ||
719 | { | 742 | { |
720 | RegionInfo.RegionSettings.TerrainImageID = tileID; | 743 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); |
744 | UUID tileID; | ||
745 | |||
746 | if (UUID.TryParse(tile, out tileID)) | ||
747 | { | ||
748 | RegionInfo.RegionSettings.TerrainImageID = tileID; | ||
749 | } | ||
721 | } | 750 | } |
722 | } | ||
723 | 751 | ||
724 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); | 752 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); |
725 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 753 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); |
726 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 754 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
727 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 755 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
728 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 756 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); |
729 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 757 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); |
730 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 758 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); |
731 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 759 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); |
732 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 760 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); |
733 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | 761 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); |
762 | } | ||
763 | } | ||
764 | catch (Exception e) | ||
765 | { | ||
766 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | ||
734 | } | 767 | } |
735 | 768 | ||
736 | #endregion Region Config | 769 | #endregion Region Config |
@@ -1161,7 +1194,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1161 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1194 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1162 | if (HeartbeatThread != null) | 1195 | if (HeartbeatThread != null) |
1163 | { | 1196 | { |
1197 | m_hbRestarts++; | ||
1198 | if(m_hbRestarts > 10) | ||
1199 | Environment.Exit(1); | ||
1200 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1201 | |||
1202 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1203 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1204 | //proc.EnableRaisingEvents=false; | ||
1205 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1206 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1207 | //proc.Start(); | ||
1208 | //proc.WaitForExit(); | ||
1209 | //Thread.Sleep(1000); | ||
1210 | //Environment.Exit(1); | ||
1164 | HeartbeatThread.Abort(); | 1211 | HeartbeatThread.Abort(); |
1212 | Watchdog.AbortThread(HeartbeatThread.ManagedThreadId); | ||
1165 | HeartbeatThread = null; | 1213 | HeartbeatThread = null; |
1166 | } | 1214 | } |
1167 | m_lastUpdate = Util.EnvironmentTickCount(); | 1215 | m_lastUpdate = Util.EnvironmentTickCount(); |
@@ -1215,9 +1263,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1215 | 1263 | ||
1216 | while (!shuttingdown) | 1264 | while (!shuttingdown) |
1217 | Update(-1); | 1265 | Update(-1); |
1218 | |||
1219 | m_lastUpdate = Util.EnvironmentTickCount(); | ||
1220 | m_firstHeartbeat = false; | ||
1221 | } | 1266 | } |
1222 | finally | 1267 | finally |
1223 | { | 1268 | { |
@@ -1418,9 +1463,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1418 | maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1463 | maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); |
1419 | maintc = (int)(MinFrameTime * 1000) - maintc; | 1464 | maintc = (int)(MinFrameTime * 1000) - maintc; |
1420 | 1465 | ||
1466 | m_lastUpdate = Util.EnvironmentTickCount(); | ||
1467 | m_firstHeartbeat = false; | ||
1468 | |||
1421 | if (maintc > 0) | 1469 | if (maintc > 0) |
1422 | Thread.Sleep(maintc); | 1470 | Thread.Sleep(maintc); |
1423 | 1471 | ||
1472 | m_lastUpdate = Util.EnvironmentTickCount(); | ||
1473 | m_firstHeartbeat = false; | ||
1474 | |||
1424 | // Optionally warn if a frame takes double the amount of time that it should. | 1475 | // Optionally warn if a frame takes double the amount of time that it should. |
1425 | if (DebugUpdates | 1476 | if (DebugUpdates |
1426 | && Util.EnvironmentTickCountSubtract( | 1477 | && Util.EnvironmentTickCountSubtract( |
@@ -1447,9 +1498,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1447 | 1498 | ||
1448 | private void CheckAtTargets() | 1499 | private void CheckAtTargets() |
1449 | { | 1500 | { |
1450 | Dictionary<UUID, SceneObjectGroup>.ValueCollection objs; | 1501 | List<SceneObjectGroup> objs = new List<SceneObjectGroup>(); |
1451 | lock (m_groupsWithTargets) | 1502 | lock (m_groupsWithTargets) |
1452 | objs = m_groupsWithTargets.Values; | 1503 | objs = new List<SceneObjectGroup>(m_groupsWithTargets.Values); |
1453 | 1504 | ||
1454 | foreach (SceneObjectGroup entry in objs) | 1505 | foreach (SceneObjectGroup entry in objs) |
1455 | entry.checkAtTargets(); | 1506 | entry.checkAtTargets(); |
@@ -1530,7 +1581,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1530 | msg.fromAgentName = "Server"; | 1581 | msg.fromAgentName = "Server"; |
1531 | msg.dialog = (byte)19; // Object msg | 1582 | msg.dialog = (byte)19; // Object msg |
1532 | msg.fromGroup = false; | 1583 | msg.fromGroup = false; |
1533 | msg.offline = (byte)0; | 1584 | msg.offline = (byte)1; |
1534 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1585 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1535 | msg.Position = Vector3.Zero; | 1586 | msg.Position = Vector3.Zero; |
1536 | msg.RegionID = RegionInfo.RegionID.Guid; | 1587 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -1768,14 +1819,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1768 | /// <returns></returns> | 1819 | /// <returns></returns> |
1769 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 1820 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
1770 | { | 1821 | { |
1822 | |||
1823 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
1824 | Vector3 wpos = Vector3.Zero; | ||
1825 | // Check for water surface intersection from above | ||
1826 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
1827 | { | ||
1828 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
1829 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
1830 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
1831 | wpos.Z = wheight; | ||
1832 | } | ||
1833 | |||
1771 | Vector3 pos = Vector3.Zero; | 1834 | Vector3 pos = Vector3.Zero; |
1772 | if (RayEndIsIntersection == (byte)1) | 1835 | if (RayEndIsIntersection == (byte)1) |
1773 | { | 1836 | { |
1774 | pos = RayEnd; | 1837 | pos = RayEnd; |
1775 | return pos; | ||
1776 | } | 1838 | } |
1777 | 1839 | else if (RayTargetID != UUID.Zero) | |
1778 | if (RayTargetID != UUID.Zero) | ||
1779 | { | 1840 | { |
1780 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 1841 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
1781 | 1842 | ||
@@ -1797,7 +1858,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1797 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 1858 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
1798 | 1859 | ||
1799 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1860 | // Un-comment out the following line to Get Raytrace results printed to the console. |
1800 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 1861 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
1801 | float ScaleOffset = 0.5f; | 1862 | float ScaleOffset = 0.5f; |
1802 | 1863 | ||
1803 | // If we hit something | 1864 | // If we hit something |
@@ -1820,13 +1881,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1820 | //pos.Z -= 0.25F; | 1881 | //pos.Z -= 0.25F; |
1821 | 1882 | ||
1822 | } | 1883 | } |
1823 | |||
1824 | return pos; | ||
1825 | } | 1884 | } |
1826 | else | 1885 | else |
1827 | { | 1886 | { |
1828 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 1887 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
1829 | |||
1830 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 1888 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
1831 | 1889 | ||
1832 | // Un-comment the following line to print the raytrace results to the console. | 1890 | // Un-comment the following line to print the raytrace results to the console. |
@@ -1835,13 +1893,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1835 | if (ei.HitTF) | 1893 | if (ei.HitTF) |
1836 | { | 1894 | { |
1837 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 1895 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
1838 | } else | 1896 | } |
1897 | else | ||
1839 | { | 1898 | { |
1840 | // fall back to our stupid functionality | 1899 | // fall back to our stupid functionality |
1841 | pos = RayEnd; | 1900 | pos = RayEnd; |
1842 | } | 1901 | } |
1843 | |||
1844 | return pos; | ||
1845 | } | 1902 | } |
1846 | } | 1903 | } |
1847 | else | 1904 | else |
@@ -1852,8 +1909,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1852 | //increase height so its above the ground. | 1909 | //increase height so its above the ground. |
1853 | //should be getting the normal of the ground at the rez point and using that? | 1910 | //should be getting the normal of the ground at the rez point and using that? |
1854 | pos.Z += scale.Z / 2f; | 1911 | pos.Z += scale.Z / 2f; |
1855 | return pos; | 1912 | // return pos; |
1856 | } | 1913 | } |
1914 | |||
1915 | // check against posible water intercept | ||
1916 | if (wpos.Z > pos.Z) pos = wpos; | ||
1917 | return pos; | ||
1857 | } | 1918 | } |
1858 | 1919 | ||
1859 | 1920 | ||
@@ -1937,7 +1998,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1937 | public bool AddRestoredSceneObject( | 1998 | public bool AddRestoredSceneObject( |
1938 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 1999 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
1939 | { | 2000 | { |
1940 | return m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); | 2001 | bool result = m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates); |
2002 | if (result) | ||
2003 | sceneObject.IsDeleted = false; | ||
2004 | return result; | ||
1941 | } | 2005 | } |
1942 | 2006 | ||
1943 | /// <summary> | 2007 | /// <summary> |
@@ -2029,6 +2093,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2029 | /// </summary> | 2093 | /// </summary> |
2030 | public void DeleteAllSceneObjects() | 2094 | public void DeleteAllSceneObjects() |
2031 | { | 2095 | { |
2096 | DeleteAllSceneObjects(false); | ||
2097 | } | ||
2098 | |||
2099 | /// <summary> | ||
2100 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2101 | /// </summary> | ||
2102 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2103 | { | ||
2104 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2032 | lock (Entities) | 2105 | lock (Entities) |
2033 | { | 2106 | { |
2034 | EntityBase[] entities = Entities.GetEntities(); | 2107 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2037,11 +2110,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2037 | if (e is SceneObjectGroup) | 2110 | if (e is SceneObjectGroup) |
2038 | { | 2111 | { |
2039 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2112 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2040 | if (!sog.IsAttachment) | 2113 | if (sog != null && !sog.IsAttachment) |
2041 | DeleteSceneObject((SceneObjectGroup)e, false); | 2114 | { |
2115 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2116 | { | ||
2117 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2118 | } | ||
2119 | else | ||
2120 | { | ||
2121 | toReturn.Add((SceneObjectGroup)e); | ||
2122 | } | ||
2123 | } | ||
2042 | } | 2124 | } |
2043 | } | 2125 | } |
2044 | } | 2126 | } |
2127 | if (toReturn.Count > 0) | ||
2128 | { | ||
2129 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2130 | } | ||
2045 | } | 2131 | } |
2046 | 2132 | ||
2047 | /// <summary> | 2133 | /// <summary> |
@@ -2082,6 +2168,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2082 | } | 2168 | } |
2083 | 2169 | ||
2084 | group.DeleteGroupFromScene(silent); | 2170 | group.DeleteGroupFromScene(silent); |
2171 | if (!silent) | ||
2172 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2085 | 2173 | ||
2086 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2174 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2087 | } | 2175 | } |
@@ -2371,6 +2459,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2371 | 2459 | ||
2372 | if (newPosition != Vector3.Zero) | 2460 | if (newPosition != Vector3.Zero) |
2373 | newObject.RootPart.GroupPosition = newPosition; | 2461 | newObject.RootPart.GroupPosition = newPosition; |
2462 | if (newObject.RootPart.KeyframeMotion != null) | ||
2463 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2374 | 2464 | ||
2375 | if (!AddSceneObject(newObject)) | 2465 | if (!AddSceneObject(newObject)) |
2376 | { | 2466 | { |
@@ -2439,10 +2529,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2439 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2529 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2440 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2530 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2441 | { | 2531 | { |
2532 | if (sceneObject.OwnerID == UUID.Zero) | ||
2533 | { | ||
2534 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2535 | return false; | ||
2536 | } | ||
2537 | |||
2442 | // If the user is banned, we won't let any of their objects | 2538 | // If the user is banned, we won't let any of their objects |
2443 | // enter. Period. | 2539 | // enter. Period. |
2444 | // | 2540 | // |
2445 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID)) | 2541 | int flags = GetUserFlags(sceneObject.OwnerID); |
2542 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2446 | { | 2543 | { |
2447 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | 2544 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); |
2448 | 2545 | ||
@@ -2488,12 +2585,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2488 | } | 2585 | } |
2489 | else | 2586 | else |
2490 | { | 2587 | { |
2588 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2491 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2589 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2492 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2590 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2493 | } | 2591 | } |
2592 | if (sceneObject.OwnerID == UUID.Zero) | ||
2593 | { | ||
2594 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2595 | return false; | ||
2596 | } | ||
2494 | } | 2597 | } |
2495 | else | 2598 | else |
2496 | { | 2599 | { |
2600 | if (sceneObject.OwnerID == UUID.Zero) | ||
2601 | { | ||
2602 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2603 | return false; | ||
2604 | } | ||
2497 | AddRestoredSceneObject(sceneObject, true, false); | 2605 | AddRestoredSceneObject(sceneObject, true, false); |
2498 | 2606 | ||
2499 | if (!Permissions.CanObjectEntry(sceneObject.UUID, | 2607 | if (!Permissions.CanObjectEntry(sceneObject.UUID, |
@@ -2522,6 +2630,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2522 | return 2; // StateSource.PrimCrossing | 2630 | return 2; // StateSource.PrimCrossing |
2523 | } | 2631 | } |
2524 | 2632 | ||
2633 | public int GetUserFlags(UUID user) | ||
2634 | { | ||
2635 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2636 | /* | ||
2637 | ScenePresence sp; | ||
2638 | if (TryGetScenePresence(user, out sp)) | ||
2639 | { | ||
2640 | return sp.UserFlags; | ||
2641 | } | ||
2642 | else | ||
2643 | { | ||
2644 | */ | ||
2645 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2646 | if (uac == null) | ||
2647 | return 0; | ||
2648 | return uac.UserFlags; | ||
2649 | //} | ||
2650 | } | ||
2525 | #endregion | 2651 | #endregion |
2526 | 2652 | ||
2527 | #region Add/Remove Avatar Methods | 2653 | #region Add/Remove Avatar Methods |
@@ -2536,6 +2662,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2536 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2662 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2537 | 2663 | ||
2538 | CheckHeartbeat(); | 2664 | CheckHeartbeat(); |
2665 | ScenePresence presence; | ||
2539 | 2666 | ||
2540 | ScenePresence sp = GetScenePresence(client.AgentId); | 2667 | ScenePresence sp = GetScenePresence(client.AgentId); |
2541 | 2668 | ||
@@ -2584,7 +2711,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2584 | 2711 | ||
2585 | EventManager.TriggerOnNewClient(client); | 2712 | EventManager.TriggerOnNewClient(client); |
2586 | if (vialogin) | 2713 | if (vialogin) |
2714 | { | ||
2587 | EventManager.TriggerOnClientLogin(client); | 2715 | EventManager.TriggerOnClientLogin(client); |
2716 | // Send initial parcel data | ||
2717 | Vector3 pos = sp.AbsolutePosition; | ||
2718 | ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); | ||
2719 | land.SendLandUpdateToClient(client); | ||
2720 | } | ||
2588 | 2721 | ||
2589 | return sp; | 2722 | return sp; |
2590 | } | 2723 | } |
@@ -2674,19 +2807,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2674 | // and the scene presence and the client, if they exist | 2807 | // and the scene presence and the client, if they exist |
2675 | try | 2808 | try |
2676 | { | 2809 | { |
2677 | // We need to wait for the client to make UDP contact first. | 2810 | ScenePresence sp = GetScenePresence(agentID); |
2678 | // It's the UDP contact that creates the scene presence | 2811 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2679 | ScenePresence sp = WaitGetScenePresence(agentID); | 2812 | |
2680 | if (sp != null) | 2813 | if (sp != null) |
2681 | { | ||
2682 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | ||
2683 | |||
2684 | sp.ControllingClient.Close(); | 2814 | sp.ControllingClient.Close(); |
2685 | } | 2815 | |
2686 | else | ||
2687 | { | ||
2688 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2689 | } | ||
2690 | // BANG! SLASH! | 2816 | // BANG! SLASH! |
2691 | m_authenticateHandler.RemoveCircuit(agentID); | 2817 | m_authenticateHandler.RemoveCircuit(agentID); |
2692 | 2818 | ||
@@ -2731,6 +2857,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2731 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 2857 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2732 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 2858 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2733 | 2859 | ||
2860 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
2861 | |||
2734 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 2862 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2735 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 2863 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2736 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 2864 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -2787,6 +2915,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2787 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 2915 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
2788 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 2916 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
2789 | client.OnCopyInventoryItem += CopyInventoryItem; | 2917 | client.OnCopyInventoryItem += CopyInventoryItem; |
2918 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
2790 | client.OnMoveInventoryItem += MoveInventoryItem; | 2919 | client.OnMoveInventoryItem += MoveInventoryItem; |
2791 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 2920 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
2792 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 2921 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -2858,6 +2987,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2858 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 2987 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
2859 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 2988 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
2860 | 2989 | ||
2990 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
2991 | |||
2861 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 2992 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
2862 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 2993 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
2863 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 2994 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -2960,15 +3091,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2960 | /// </summary> | 3091 | /// </summary> |
2961 | /// <param name="agentId">The avatar's Unique ID</param> | 3092 | /// <param name="agentId">The avatar's Unique ID</param> |
2962 | /// <param name="client">The IClientAPI for the client</param> | 3093 | /// <param name="client">The IClientAPI for the client</param> |
2963 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3094 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
2964 | { | 3095 | { |
2965 | if (m_teleportModule != null) | 3096 | if (m_teleportModule != null) |
2966 | m_teleportModule.TeleportHome(agentId, client); | 3097 | return m_teleportModule.TeleportHome(agentId, client); |
2967 | else | 3098 | else |
2968 | { | 3099 | { |
2969 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3100 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
2970 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3101 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
2971 | } | 3102 | } |
3103 | return false; | ||
2972 | } | 3104 | } |
2973 | 3105 | ||
2974 | /// <summary> | 3106 | /// <summary> |
@@ -3078,6 +3210,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3078 | /// <param name="flags"></param> | 3210 | /// <param name="flags"></param> |
3079 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3211 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3080 | { | 3212 | { |
3213 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3214 | ScenePresence presence; | ||
3215 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3216 | { | ||
3217 | if (presence.Appearance != null) | ||
3218 | { | ||
3219 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3220 | } | ||
3221 | } | ||
3222 | |||
3081 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3223 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3082 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3224 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3083 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3225 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3146,8 +3288,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3146 | regions.Remove(RegionInfo.RegionHandle); | 3288 | regions.Remove(RegionInfo.RegionHandle); |
3147 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3289 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3148 | } | 3290 | } |
3149 | 3291 | m_log.Debug("[Scene] Beginning ClientClosed"); | |
3150 | m_eventManager.TriggerClientClosed(agentID, this); | 3292 | m_eventManager.TriggerClientClosed(agentID, this); |
3293 | m_log.Debug("[Scene] Finished ClientClosed"); | ||
3151 | } | 3294 | } |
3152 | catch (NullReferenceException) | 3295 | catch (NullReferenceException) |
3153 | { | 3296 | { |
@@ -3209,9 +3352,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3209 | { | 3352 | { |
3210 | m_log.ErrorFormat("[SCENE] Scene.cs:RemoveClient exception {0}{1}", e.Message, e.StackTrace); | 3353 | m_log.ErrorFormat("[SCENE] Scene.cs:RemoveClient exception {0}{1}", e.Message, e.StackTrace); |
3211 | } | 3354 | } |
3212 | 3355 | m_log.Debug("[Scene] Done. Firing RemoveCircuit"); | |
3213 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); | 3356 | m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); |
3214 | // CleanDroppedAttachments(); | 3357 | // CleanDroppedAttachments(); |
3358 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3215 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 3359 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
3216 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 3360 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
3217 | } | 3361 | } |
@@ -3333,13 +3477,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3333 | sp = null; | 3477 | sp = null; |
3334 | } | 3478 | } |
3335 | 3479 | ||
3336 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3337 | 3480 | ||
3338 | //On login test land permisions | 3481 | //On login test land permisions |
3339 | if (vialogin) | 3482 | if (vialogin) |
3340 | { | 3483 | { |
3341 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3484 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3485 | if (cache != null) | ||
3486 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3487 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3342 | { | 3488 | { |
3489 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3343 | return false; | 3490 | return false; |
3344 | } | 3491 | } |
3345 | } | 3492 | } |
@@ -3363,8 +3510,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3363 | 3510 | ||
3364 | try | 3511 | try |
3365 | { | 3512 | { |
3366 | if (!AuthorizeUser(agent, out reason)) | 3513 | // Always check estate if this is a login. Always |
3367 | return false; | 3514 | // check if banned regions are to be blacked out. |
3515 | if (vialogin || (!m_seeIntoBannedRegion)) | ||
3516 | { | ||
3517 | if (!AuthorizeUser(agent, out reason)) | ||
3518 | return false; | ||
3519 | } | ||
3368 | } | 3520 | } |
3369 | catch (Exception e) | 3521 | catch (Exception e) |
3370 | { | 3522 | { |
@@ -3490,6 +3642,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3490 | } | 3642 | } |
3491 | 3643 | ||
3492 | // Honor parcel landing type and position. | 3644 | // Honor parcel landing type and position. |
3645 | /* | ||
3646 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3493 | if (land != null) | 3647 | if (land != null) |
3494 | { | 3648 | { |
3495 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 3649 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3497,26 +3651,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
3497 | agent.startpos = land.LandData.UserLocation; | 3651 | agent.startpos = land.LandData.UserLocation; |
3498 | } | 3652 | } |
3499 | } | 3653 | } |
3654 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3500 | } | 3655 | } |
3501 | 3656 | ||
3502 | return true; | 3657 | return true; |
3503 | } | 3658 | } |
3504 | 3659 | ||
3505 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 3660 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3506 | { | 3661 | { |
3507 | 3662 | reason = String.Empty; | |
3508 | bool banned = land.IsBannedFromLand(agent.AgentID); | 3663 | if (Permissions.IsGod(agentID)) |
3509 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 3664 | return true; |
3665 | |||
3666 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
3667 | if (land == null) | ||
3668 | return false; | ||
3669 | |||
3670 | bool banned = land.IsBannedFromLand(agentID); | ||
3671 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3510 | 3672 | ||
3511 | if (banned || restricted) | 3673 | if (banned || restricted) |
3512 | { | 3674 | { |
3513 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 3675 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3514 | if (nearestParcel != null) | 3676 | if (nearestParcel != null) |
3515 | { | 3677 | { |
3516 | //Move agent to nearest allowed | 3678 | //Move agent to nearest allowed |
3517 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 3679 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3518 | agent.startpos.X = newPosition.X; | 3680 | posX = newPosition.X; |
3519 | agent.startpos.Y = newPosition.Y; | 3681 | posY = newPosition.Y; |
3520 | } | 3682 | } |
3521 | else | 3683 | else |
3522 | { | 3684 | { |
@@ -3578,7 +3740,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3578 | 3740 | ||
3579 | if (!m_strictAccessControl) return true; | 3741 | if (!m_strictAccessControl) return true; |
3580 | if (Permissions.IsGod(agent.AgentID)) return true; | 3742 | if (Permissions.IsGod(agent.AgentID)) return true; |
3581 | 3743 | ||
3582 | if (AuthorizationService != null) | 3744 | if (AuthorizationService != null) |
3583 | { | 3745 | { |
3584 | if (!AuthorizationService.IsAuthorizedForRegion( | 3746 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3593,7 +3755,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3593 | 3755 | ||
3594 | if (m_regInfo.EstateSettings != null) | 3756 | if (m_regInfo.EstateSettings != null) |
3595 | { | 3757 | { |
3596 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) | 3758 | if (m_regInfo.EstateSettings.IsBanned(agent.AgentID,0)) |
3597 | { | 3759 | { |
3598 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 3760 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3599 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 3761 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -3785,6 +3947,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3785 | 3947 | ||
3786 | // We have to wait until the viewer contacts this region after receiving EAC. | 3948 | // We have to wait until the viewer contacts this region after receiving EAC. |
3787 | // That calls AddNewClient, which finally creates the ScenePresence | 3949 | // That calls AddNewClient, which finally creates the ScenePresence |
3950 | int flags = GetUserFlags(cAgentData.AgentID); | ||
3951 | if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
3952 | { | ||
3953 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
3954 | return false; | ||
3955 | } | ||
3956 | |||
3788 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 3957 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
3789 | if (nearestParcel == null) | 3958 | if (nearestParcel == null) |
3790 | { | 3959 | { |
@@ -3866,12 +4035,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3866 | return false; | 4035 | return false; |
3867 | } | 4036 | } |
3868 | 4037 | ||
4038 | public bool IncomingCloseAgent(UUID agentID) | ||
4039 | { | ||
4040 | return IncomingCloseAgent(agentID, false); | ||
4041 | } | ||
4042 | |||
4043 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4044 | { | ||
4045 | return IncomingCloseAgent(agentID, true); | ||
4046 | } | ||
4047 | |||
3869 | /// <summary> | 4048 | /// <summary> |
3870 | /// Tell a single agent to disconnect from the region. | 4049 | /// Tell a single agent to disconnect from the region. |
3871 | /// </summary> | 4050 | /// </summary> |
3872 | /// <param name="regionHandle"></param> | ||
3873 | /// <param name="agentID"></param> | 4051 | /// <param name="agentID"></param> |
3874 | public bool IncomingCloseAgent(UUID agentID) | 4052 | /// <param name="childOnly"></param> |
4053 | public bool IncomingCloseAgent(UUID agentID, bool childOnly) | ||
3875 | { | 4054 | { |
3876 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); | 4055 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); |
3877 | 4056 | ||
@@ -3883,7 +4062,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3883 | { | 4062 | { |
3884 | m_sceneGraph.removeUserCount(false); | 4063 | m_sceneGraph.removeUserCount(false); |
3885 | } | 4064 | } |
3886 | else | 4065 | else if (!childOnly) |
3887 | { | 4066 | { |
3888 | m_sceneGraph.removeUserCount(true); | 4067 | m_sceneGraph.removeUserCount(true); |
3889 | } | 4068 | } |
@@ -3899,9 +4078,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3899 | } | 4078 | } |
3900 | else | 4079 | else |
3901 | presence.ControllingClient.SendShutdownConnectionNotice(); | 4080 | presence.ControllingClient.SendShutdownConnectionNotice(); |
4081 | presence.ControllingClient.Close(false); | ||
4082 | } | ||
4083 | else if (!childOnly) | ||
4084 | { | ||
4085 | presence.ControllingClient.Close(true); | ||
3902 | } | 4086 | } |
3903 | |||
3904 | presence.ControllingClient.Close(); | ||
3905 | return true; | 4087 | return true; |
3906 | } | 4088 | } |
3907 | 4089 | ||
@@ -4483,34 +4665,78 @@ namespace OpenSim.Region.Framework.Scenes | |||
4483 | SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); | 4665 | SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); |
4484 | } | 4666 | } |
4485 | 4667 | ||
4486 | public int GetHealth() | 4668 | public int GetHealth(out int flags, out string message) |
4487 | { | 4669 | { |
4488 | // Returns: | 4670 | // Returns: |
4489 | // 1 = sim is up and accepting http requests. The heartbeat has | 4671 | // 1 = sim is up and accepting http requests. The heartbeat has |
4490 | // stopped and the sim is probably locked up, but a remote | 4672 | // stopped and the sim is probably locked up, but a remote |
4491 | // admin restart may succeed | 4673 | // admin restart may succeed |
4492 | // | 4674 | // |
4493 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 4675 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4494 | // usable for people within and logins _may_ work | 4676 | // usable for people within |
4677 | // | ||
4678 | // 3 = Sim is up and one packet thread is running. Sim is | ||
4679 | // unstable and will not accept new logins | ||
4680 | // | ||
4681 | // 4 = Sim is up and both packet threads are running. Sim is | ||
4682 | // likely usable | ||
4495 | // | 4683 | // |
4496 | // 3 = We have seen a new user enter within the past 4 minutes | 4684 | // 5 = We have seen a new user enter within the past 4 minutes |
4497 | // which can be seen as positive confirmation of sim health | 4685 | // which can be seen as positive confirmation of sim health |
4498 | // | 4686 | // |
4687 | |||
4688 | flags = 0; | ||
4689 | message = String.Empty; | ||
4690 | |||
4691 | CheckHeartbeat(); | ||
4692 | |||
4693 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
4694 | { | ||
4695 | // We're still starting | ||
4696 | // 0 means "in startup", it can't happen another way, since | ||
4697 | // to get here, we must be able to accept http connections | ||
4698 | return 0; | ||
4699 | } | ||
4700 | |||
4499 | int health=1; // Start at 1, means we're up | 4701 | int health=1; // Start at 1, means we're up |
4500 | 4702 | ||
4501 | if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) | 4703 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) < 1000) |
4704 | { | ||
4502 | health+=1; | 4705 | health+=1; |
4706 | flags |= 1; | ||
4707 | } | ||
4708 | |||
4709 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
4710 | { | ||
4711 | health+=1; | ||
4712 | flags |= 2; | ||
4713 | } | ||
4714 | |||
4715 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
4716 | { | ||
4717 | health+=1; | ||
4718 | flags |= 4; | ||
4719 | } | ||
4503 | else | 4720 | else |
4721 | { | ||
4722 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
4723 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
4724 | proc.EnableRaisingEvents=false; | ||
4725 | proc.StartInfo.FileName = "/bin/kill"; | ||
4726 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
4727 | proc.Start(); | ||
4728 | proc.WaitForExit(); | ||
4729 | Thread.Sleep(1000); | ||
4730 | Environment.Exit(1); | ||
4731 | } | ||
4732 | |||
4733 | if (flags != 7) | ||
4504 | return health; | 4734 | return health; |
4505 | 4735 | ||
4506 | // A login in the last 4 mins? We can't be doing too badly | 4736 | // A login in the last 4 mins? We can't be doing too badly |
4507 | // | 4737 | // |
4508 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 4738 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4509 | health++; | 4739 | health++; |
4510 | else | ||
4511 | return health; | ||
4512 | |||
4513 | CheckHeartbeat(); | ||
4514 | 4740 | ||
4515 | return health; | 4741 | return health; |
4516 | } | 4742 | } |
@@ -4599,7 +4825,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4599 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 4825 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
4600 | if (wasUsingPhysics) | 4826 | if (wasUsingPhysics) |
4601 | { | 4827 | { |
4602 | 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 | 4828 | 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 |
4603 | } | 4829 | } |
4604 | } | 4830 | } |
4605 | 4831 | ||
@@ -4703,7 +4929,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4703 | if (m_firstHeartbeat) | 4929 | if (m_firstHeartbeat) |
4704 | return; | 4930 | return; |
4705 | 4931 | ||
4706 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) | 4932 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 5000) |
4707 | StartTimer(); | 4933 | StartTimer(); |
4708 | } | 4934 | } |
4709 | 4935 | ||
@@ -4717,9 +4943,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4717 | get { return m_allowScriptCrossings; } | 4943 | get { return m_allowScriptCrossings; } |
4718 | } | 4944 | } |
4719 | 4945 | ||
4720 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 4946 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
4721 | { | 4947 | { |
4722 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 4948 | return GetNearestAllowedPosition(avatar, null); |
4949 | } | ||
4950 | |||
4951 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
4952 | { | ||
4953 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); | ||
4723 | 4954 | ||
4724 | if (nearestParcel != null) | 4955 | if (nearestParcel != null) |
4725 | { | 4956 | { |
@@ -4728,10 +4959,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4728 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 4959 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
4729 | if (nearestPoint != null) | 4960 | if (nearestPoint != null) |
4730 | { | 4961 | { |
4731 | // m_log.DebugFormat( | 4962 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
4732 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
4733 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
4734 | |||
4735 | return nearestPoint.Value; | 4963 | return nearestPoint.Value; |
4736 | } | 4964 | } |
4737 | 4965 | ||
@@ -4741,17 +4969,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
4741 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 4969 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
4742 | if (nearestPoint != null) | 4970 | if (nearestPoint != null) |
4743 | { | 4971 | { |
4744 | // m_log.DebugFormat( | 4972 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
4745 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
4746 | |||
4747 | return nearestPoint.Value; | 4973 | return nearestPoint.Value; |
4748 | } | 4974 | } |
4749 | 4975 | ||
4750 | //Ultimate backup if we have no idea where they are | 4976 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
4751 | // m_log.DebugFormat( | 4977 | if (dest != excludeParcel) |
4752 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 4978 | { |
4979 | // Ultimate backup if we have no idea where they are and | ||
4980 | // the last allowed position was in another parcel | ||
4981 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
4982 | return avatar.lastKnownAllowedPosition; | ||
4983 | } | ||
4753 | 4984 | ||
4754 | return avatar.lastKnownAllowedPosition; | 4985 | // else fall through to region edge |
4755 | } | 4986 | } |
4756 | 4987 | ||
4757 | //Go to the edge, this happens in teleporting to a region with no available parcels | 4988 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -4785,13 +5016,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
4785 | 5016 | ||
4786 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 5017 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
4787 | { | 5018 | { |
5019 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
5020 | } | ||
5021 | |||
5022 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
5023 | { | ||
4788 | List<ILandObject> all = AllParcels(); | 5024 | List<ILandObject> all = AllParcels(); |
4789 | float minParcelDistance = float.MaxValue; | 5025 | float minParcelDistance = float.MaxValue; |
4790 | ILandObject nearestParcel = null; | 5026 | ILandObject nearestParcel = null; |
4791 | 5027 | ||
4792 | foreach (var parcel in all) | 5028 | foreach (var parcel in all) |
4793 | { | 5029 | { |
4794 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 5030 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
4795 | { | 5031 | { |
4796 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 5032 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
4797 | if (parcelDistance < minParcelDistance) | 5033 | if (parcelDistance < minParcelDistance) |
@@ -5033,7 +5269,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5033 | mapModule.GenerateMaptile(); | 5269 | mapModule.GenerateMaptile(); |
5034 | } | 5270 | } |
5035 | 5271 | ||
5036 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5272 | // public void CleanDroppedAttachments() |
5273 | // { | ||
5274 | // List<SceneObjectGroup> objectsToDelete = | ||
5275 | // new List<SceneObjectGroup>(); | ||
5276 | // | ||
5277 | // lock (m_cleaningAttachments) | ||
5278 | // { | ||
5279 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5280 | // { | ||
5281 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5282 | // { | ||
5283 | // UUID agentID = grp.OwnerID; | ||
5284 | // if (agentID == UUID.Zero) | ||
5285 | // { | ||
5286 | // objectsToDelete.Add(grp); | ||
5287 | // return; | ||
5288 | // } | ||
5289 | // | ||
5290 | // ScenePresence sp = GetScenePresence(agentID); | ||
5291 | // if (sp == null) | ||
5292 | // { | ||
5293 | // objectsToDelete.Add(grp); | ||
5294 | // return; | ||
5295 | // } | ||
5296 | // } | ||
5297 | // }); | ||
5298 | // } | ||
5299 | // | ||
5300 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5301 | // { | ||
5302 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5303 | // DeleteSceneObject(grp, true); | ||
5304 | // } | ||
5305 | // } | ||
5306 | |||
5307 | public void ThreadAlive(int threadCode) | ||
5308 | { | ||
5309 | switch(threadCode) | ||
5310 | { | ||
5311 | case 1: // Incoming | ||
5312 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5313 | break; | ||
5314 | case 2: // Incoming | ||
5315 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5316 | break; | ||
5317 | } | ||
5318 | } | ||
5319 | |||
5320 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5037 | { | 5321 | { |
5038 | RegenerateMaptile(); | 5322 | RegenerateMaptile(); |
5039 | 5323 | ||
@@ -5052,6 +5336,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5052 | // child agent creation, thereby emulating the SL behavior. | 5336 | // child agent creation, thereby emulating the SL behavior. |
5053 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5337 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5054 | { | 5338 | { |
5339 | reason = "You are banned from the region"; | ||
5340 | |||
5341 | if (Permissions.IsGod(agentID)) | ||
5342 | { | ||
5343 | reason = String.Empty; | ||
5344 | return true; | ||
5345 | } | ||
5346 | |||
5055 | int num = m_sceneGraph.GetNumberOfScenePresences(); | 5347 | int num = m_sceneGraph.GetNumberOfScenePresences(); |
5056 | 5348 | ||
5057 | if (num >= RegionInfo.RegionSettings.AgentLimit) | 5349 | if (num >= RegionInfo.RegionSettings.AgentLimit) |
@@ -5063,6 +5355,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5063 | } | 5355 | } |
5064 | } | 5356 | } |
5065 | 5357 | ||
5358 | ScenePresence presence = GetScenePresence(agentID); | ||
5359 | IClientAPI client = null; | ||
5360 | AgentCircuitData aCircuit = null; | ||
5361 | |||
5362 | if (presence != null) | ||
5363 | { | ||
5364 | client = presence.ControllingClient; | ||
5365 | if (client != null) | ||
5366 | aCircuit = client.RequestClientInfo(); | ||
5367 | } | ||
5368 | |||
5369 | // We may be called before there is a presence or a client. | ||
5370 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5371 | if (client == null) | ||
5372 | { | ||
5373 | aCircuit = new AgentCircuitData(); | ||
5374 | aCircuit.AgentID = agentID; | ||
5375 | aCircuit.firstname = String.Empty; | ||
5376 | aCircuit.lastname = String.Empty; | ||
5377 | } | ||
5378 | |||
5379 | try | ||
5380 | { | ||
5381 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5382 | { | ||
5383 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5384 | return false; | ||
5385 | } | ||
5386 | } | ||
5387 | catch (Exception e) | ||
5388 | { | ||
5389 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5390 | return false; | ||
5391 | } | ||
5392 | |||
5066 | if (position == Vector3.Zero) // Teleport | 5393 | if (position == Vector3.Zero) // Teleport |
5067 | { | 5394 | { |
5068 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5395 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5091,13 +5418,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5091 | } | 5418 | } |
5092 | } | 5419 | } |
5093 | } | 5420 | } |
5421 | |||
5422 | float posX = 128.0f; | ||
5423 | float posY = 128.0f; | ||
5424 | |||
5425 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5426 | { | ||
5427 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5428 | return false; | ||
5429 | } | ||
5430 | } | ||
5431 | else // Walking | ||
5432 | { | ||
5433 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5434 | if (land == null) | ||
5435 | return false; | ||
5436 | |||
5437 | bool banned = land.IsBannedFromLand(agentID); | ||
5438 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5439 | |||
5440 | if (banned || restricted) | ||
5441 | return false; | ||
5094 | } | 5442 | } |
5095 | 5443 | ||
5096 | reason = String.Empty; | 5444 | reason = String.Empty; |
5097 | return true; | 5445 | return true; |
5098 | } | 5446 | } |
5099 | 5447 | ||
5100 | /// <summary> | 5448 | public void StartTimerWatchdog() |
5449 | { | ||
5450 | m_timerWatchdog.Interval = 1000; | ||
5451 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5452 | m_timerWatchdog.AutoReset = true; | ||
5453 | m_timerWatchdog.Start(); | ||
5454 | } | ||
5455 | |||
5456 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5457 | { | ||
5458 | CheckHeartbeat(); | ||
5459 | } | ||
5460 | |||
5101 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5461 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5102 | /// autopilot that moves an avatar to a sit target!. | 5462 | /// autopilot that moves an avatar to a sit target!. |
5103 | /// </summary> | 5463 | /// </summary> |