aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs360
1 files changed, 194 insertions, 166 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2424194..e5c0f38 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -64,6 +64,8 @@ namespace OpenSim.Region.Framework.Scenes
64 64
65 #region Fields 65 #region Fields
66 66
67 public bool EmergencyMonitoring = false;
68
67 public SynchronizeSceneHandler SynchronizeScene; 69 public SynchronizeSceneHandler SynchronizeScene;
68 public SimStatsReporter StatsReporter; 70 public SimStatsReporter StatsReporter;
69 public List<Border> NorthBorders = new List<Border>(); 71 public List<Border> NorthBorders = new List<Border>();
@@ -81,6 +83,13 @@ namespace OpenSim.Region.Framework.Scenes
81 public bool m_useFlySlow; 83 public bool m_useFlySlow;
82 public bool m_usePreJump; 84 public bool m_usePreJump;
83 public bool m_seeIntoRegionFromNeighbor; 85 public bool m_seeIntoRegionFromNeighbor;
86
87 protected float m_defaultDrawDistance = 255.0f;
88 public float DefaultDrawDistance
89 {
90 get { return m_defaultDrawDistance; }
91 }
92
84 // TODO: need to figure out how allow client agents but deny 93 // TODO: need to figure out how allow client agents but deny
85 // root agents when ACL denies access to root agent 94 // root agents when ACL denies access to root agent
86 public bool m_strictAccessControl = true; 95 public bool m_strictAccessControl = true;
@@ -129,7 +138,16 @@ namespace OpenSim.Region.Framework.Scenes
129 protected ICapabilitiesModule m_capsModule; 138 protected ICapabilitiesModule m_capsModule;
130 // Central Update Loop 139 // Central Update Loop
131 protected int m_fps = 10; 140 protected int m_fps = 10;
132 protected uint m_frame; 141
142 /// <summary>
143 /// Current scene frame number
144 /// </summary>
145 public uint Frame
146 {
147 get;
148 protected set;
149 }
150
133 protected float m_timespan = 0.089f; 151 protected float m_timespan = 0.089f;
134 protected DateTime m_lastupdate = DateTime.UtcNow; 152 protected DateTime m_lastupdate = DateTime.UtcNow;
135 153
@@ -638,6 +656,8 @@ namespace OpenSim.Region.Framework.Scenes
638 // 656 //
639 IConfig startupConfig = m_config.Configs["Startup"]; 657 IConfig startupConfig = m_config.Configs["Startup"];
640 658
659 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
660
641 //Animation states 661 //Animation states
642 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 662 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
643 // TODO: Change default to true once the feature is supported 663 // TODO: Change default to true once the feature is supported
@@ -1209,7 +1229,8 @@ namespace OpenSim.Region.Framework.Scenes
1209 1229
1210 try 1230 try
1211 { 1231 {
1212 Update(); 1232 while (!shuttingdown)
1233 Update();
1213 } 1234 }
1214 catch (ThreadAbortException) 1235 catch (ThreadAbortException)
1215 { 1236 {
@@ -1223,190 +1244,180 @@ namespace OpenSim.Region.Framework.Scenes
1223 Watchdog.RemoveThread(); 1244 Watchdog.RemoveThread();
1224 } 1245 }
1225 1246
1226 /// <summary>
1227 /// Performs per-frame updates on the scene, this should be the central scene loop
1228 /// </summary>
1229 public override void Update() 1247 public override void Update()
1230 { 1248 {
1231 float physicsFPS; 1249 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
1232 int maintc; 1250 float physicsFPS = 0f;
1233 1251
1234 while (!shuttingdown) 1252 int maintc = Util.EnvironmentTickCount();
1253 int tmpFrameMS = maintc;
1254 tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1255
1256 // Increment the frame counter
1257 ++Frame;
1258
1259 try
1235 { 1260 {
1236 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; 1261 // Check if any objects have reached their targets
1237 physicsFPS = 0f; 1262 CheckAtTargets();
1238 1263
1239 maintc = Util.EnvironmentTickCount(); 1264 // Update SceneObjectGroups that have scheduled themselves for updates
1240 int tmpFrameMS = maintc; 1265 // Objects queue their updates onto all scene presences
1241 tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; 1266 if (Frame % m_update_objects == 0)
1267 m_sceneGraph.UpdateObjectGroups();
1242 1268
1243 // Increment the frame counter 1269 // Run through all ScenePresences looking for updates
1244 ++m_frame; 1270 // Presence updates and queued object updates for each presence are sent to clients
1271 if (Frame % m_update_presences == 0)
1272 m_sceneGraph.UpdatePresences();
1245 1273
1246 try 1274 // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client)
1275 if (Frame % m_update_coarse_locations == 0)
1247 { 1276 {
1248 // Check if any objects have reached their targets 1277 List<Vector3> coarseLocations;
1249 CheckAtTargets(); 1278 List<UUID> avatarUUIDs;
1250 1279 SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60);
1251 // Update SceneObjectGroups that have scheduled themselves for updates 1280 // Send coarse locations to clients
1252 // Objects queue their updates onto all scene presences 1281 ForEachScenePresence(delegate(ScenePresence presence)
1253 if (m_frame % m_update_objects == 0) 1282 {
1254 m_sceneGraph.UpdateObjectGroups(); 1283 presence.SendCoarseLocations(coarseLocations, avatarUUIDs);
1284 });
1285 }
1255 1286
1256 // Run through all ScenePresences looking for updates 1287 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1257 // Presence updates and queued object updates for each presence are sent to clients 1288 if ((Frame % m_update_physics == 0) && m_physics_enabled)
1258 if (m_frame % m_update_presences == 0) 1289 m_sceneGraph.UpdatePreparePhysics();
1259 m_sceneGraph.UpdatePresences(); 1290 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
1260 1291
1261 // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) 1292 // Apply any pending avatar force input to the avatar's velocity
1262 if (m_frame % m_update_coarse_locations == 0) 1293 if (Frame % m_update_entitymovement == 0)
1263 { 1294 m_sceneGraph.UpdateScenePresenceMovement();
1264 List<Vector3> coarseLocations;
1265 List<UUID> avatarUUIDs;
1266 SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60);
1267 // Send coarse locations to clients
1268 ForEachScenePresence(delegate(ScenePresence presence)
1269 {
1270 presence.SendCoarseLocations(coarseLocations, avatarUUIDs);
1271 });
1272 }
1273 1295
1274 int tmpPhysicsMS2 = Util.EnvironmentTickCount(); 1296 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
1275 if ((m_frame % m_update_physics == 0) && m_physics_enabled) 1297 // velocity
1276 m_sceneGraph.UpdatePreparePhysics(); 1298 int tmpPhysicsMS = Util.EnvironmentTickCount();
1277 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); 1299 if (Frame % m_update_physics == 0)
1300 {
1301 if (m_physics_enabled)
1302 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan));
1303 if (SynchronizeScene != null)
1304 SynchronizeScene(this);
1305 }
1306 physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
1278 1307
1279 // Apply any pending avatar force input to the avatar's velocity 1308 // Delete temp-on-rez stuff
1280 if (m_frame % m_update_entitymovement == 0) 1309 if (Frame % 1000 == 0 && !m_cleaningTemps)
1281 m_sceneGraph.UpdateScenePresenceMovement(); 1310 {
1311 int tmpTempOnRezMS = Util.EnvironmentTickCount();
1312 m_cleaningTemps = true;
1313 Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; });
1314 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
1315 }
1282 1316
1283 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their 1317 if (RegionStatus != RegionStatus.SlaveScene)
1284 // velocity 1318 {
1285 int tmpPhysicsMS = Util.EnvironmentTickCount(); 1319 if (Frame % m_update_events == 0)
1286 if (m_frame % m_update_physics == 0)
1287 { 1320 {
1288 if (m_physics_enabled) 1321 int evMS = Util.EnvironmentTickCount();
1289 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); 1322 UpdateEvents();
1290 if (SynchronizeScene != null) 1323 eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
1291 SynchronizeScene(this);
1292 } 1324 }
1293 physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
1294 1325
1295 // Delete temp-on-rez stuff 1326 if (Frame % m_update_backup == 0)
1296 if (m_frame % 1000 == 0 && !m_cleaningTemps)
1297 { 1327 {
1298 int tmpTempOnRezMS = Util.EnvironmentTickCount(); 1328 int backMS = Util.EnvironmentTickCount();
1299 m_cleaningTemps = true; 1329 UpdateStorageBackup();
1300 Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); 1330 backupMS = Util.EnvironmentTickCountSubtract(backMS);
1301 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
1302 } 1331 }
1303 1332
1304 if (RegionStatus != RegionStatus.SlaveScene) 1333 if (Frame % m_update_terrain == 0)
1305 { 1334 {
1306 if (m_frame % m_update_events == 0) 1335 int terMS = Util.EnvironmentTickCount();
1307 { 1336 UpdateTerrain();
1308 int evMS = Util.EnvironmentTickCount(); 1337 terrainMS = Util.EnvironmentTickCountSubtract(terMS);
1309 UpdateEvents();
1310 eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
1311 }
1312
1313 if (m_frame % m_update_backup == 0)
1314 {
1315 int backMS = Util.EnvironmentTickCount();
1316 UpdateStorageBackup();
1317 backupMS = Util.EnvironmentTickCountSubtract(backMS);
1318 }
1319
1320 if (m_frame % m_update_terrain == 0)
1321 {
1322 int terMS = Util.EnvironmentTickCount();
1323 UpdateTerrain();
1324 terrainMS = Util.EnvironmentTickCountSubtract(terMS);
1325 }
1326
1327 if (m_frame % m_update_land == 0)
1328 {
1329 int ldMS = Util.EnvironmentTickCount();
1330 UpdateLand();
1331 landMS = Util.EnvironmentTickCountSubtract(ldMS);
1332 }
1333
1334 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
1335 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1336 lastCompletedFrame = Util.EnvironmentTickCount();
1337
1338 // if (m_frame%m_update_avatars == 0)
1339 // UpdateInWorldTime();
1340 StatsReporter.AddPhysicsFPS(physicsFPS);
1341 StatsReporter.AddTimeDilation(TimeDilation);
1342 StatsReporter.AddFPS(1);
1343 StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount());
1344 StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
1345 StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
1346 StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
1347 StatsReporter.addFrameMS(frameMS);
1348 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1349 StatsReporter.addOtherMS(otherMS);
1350 StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
1351 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1352 } 1338 }
1353 1339
1354 if (LoginsDisabled && m_frame == 20) 1340 if (Frame % m_update_land == 0)
1355 { 1341 {
1356 // In 99.9% of cases it is a bad idea to manually force garbage collection. However, 1342 int ldMS = Util.EnvironmentTickCount();
1357 // this is a rare case where we know we have just went through a long cycle of heap 1343 UpdateLand();
1358 // allocations, and there is no more work to be done until someone logs in 1344 landMS = Util.EnvironmentTickCountSubtract(ldMS);
1359 GC.Collect(); 1345 }
1360 1346
1361 IConfig startupConfig = m_config.Configs["Startup"]; 1347 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
1362 if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false)) 1348 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1363 { 1349 lastCompletedFrame = Util.EnvironmentTickCount();
1364 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); 1350
1365 LoginsDisabled = false; 1351 // if (Frame%m_update_avatars == 0)
1366 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); 1352 // UpdateInWorldTime();
1367 } 1353 StatsReporter.AddPhysicsFPS(physicsFPS);
1354 StatsReporter.AddTimeDilation(TimeDilation);
1355 StatsReporter.AddFPS(1);
1356 StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount());
1357 StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
1358 StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
1359 StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
1360 StatsReporter.addFrameMS(frameMS);
1361 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1362 StatsReporter.addOtherMS(otherMS);
1363 StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
1364 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1365 }
1366
1367 if (LoginsDisabled && Frame == 20)
1368 {
1369 // In 99.9% of cases it is a bad idea to manually force garbage collection. However,
1370 // this is a rare case where we know we have just went through a long cycle of heap
1371 // allocations, and there is no more work to be done until someone logs in
1372 GC.Collect();
1373
1374 IConfig startupConfig = m_config.Configs["Startup"];
1375 if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
1376 {
1377 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1378 LoginsDisabled = false;
1379 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
1368 } 1380 }
1369 } 1381 }
1370 catch (NotImplementedException) 1382 }
1371 { 1383 catch (NotImplementedException)
1372 throw; 1384 {
1373 } 1385 throw;
1374 catch (AccessViolationException e) 1386 }
1375 { 1387 catch (AccessViolationException e)
1376 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); 1388 {
1377 } 1389 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1378 //catch (NullReferenceException e) 1390 }
1379 //{ 1391 //catch (NullReferenceException e)
1380 // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); 1392 //{
1381 //} 1393 // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1382 catch (InvalidOperationException e) 1394 //}
1383 { 1395 catch (InvalidOperationException e)
1384 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); 1396 {
1385 } 1397 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1386 catch (Exception e) 1398 }
1387 { 1399 catch (Exception e)
1388 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); 1400 {
1389 } 1401 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1390 finally 1402 }
1391 { 1403 finally
1392 m_lastupdate = DateTime.UtcNow; 1404 {
1393 } 1405 m_lastupdate = DateTime.UtcNow;
1406 }
1394 1407
1395 maintc = Util.EnvironmentTickCountSubtract(maintc); 1408 maintc = Util.EnvironmentTickCountSubtract(maintc);
1396 maintc = (int)(m_timespan * 1000) - maintc; 1409 maintc = (int)(m_timespan * 1000) - maintc;
1397 1410
1398 if (maintc > 0)
1399 Thread.Sleep(maintc);
1400 1411
1401 // Tell the watchdog that this thread is still alive 1412 m_lastUpdate = Util.EnvironmentTickCount();
1402 Watchdog.UpdateThread(); 1413 m_firstHeartbeat = false;
1403 1414
1404 m_lastUpdate = Util.EnvironmentTickCount(); 1415 if (maintc > 0)
1405 m_firstHeartbeat = false; 1416 Thread.Sleep(maintc);
1406 }
1407 }
1408 1417
1409 1418 // Tell the watchdog that this thread is still alive
1419 Watchdog.UpdateThread();
1420 }
1410 1421
1411 public void AddGroupTarget(SceneObjectGroup grp) 1422 public void AddGroupTarget(SceneObjectGroup grp)
1412 { 1423 {
@@ -3125,7 +3136,9 @@ namespace OpenSim.Region.Framework.Scenes
3125 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); 3136 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName);
3126 3137
3127 m_sceneGraph.removeUserCount(!childagentYN); 3138 m_sceneGraph.removeUserCount(!childagentYN);
3128 CapsModule.RemoveCapsHandler(agentID); 3139
3140 if (CapsModule != null)
3141 CapsModule.RemoveCapsHandler(agentID);
3129 3142
3130 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever 3143 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3131 // this method is doing is HORRIBLE!!! 3144 // this method is doing is HORRIBLE!!!
@@ -3329,7 +3342,7 @@ namespace OpenSim.Region.Framework.Scenes
3329 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport 3342 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
3330 3343
3331 // Don't disable this log message - it's too helpful 3344 // Don't disable this log message - it's too helpful
3332 m_log.InfoFormat( 3345 m_log.DebugFormat(
3333 "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", 3346 "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})",
3334 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3347 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
3335 agent.AgentID, agent.circuitcode, teleportFlags); 3348 agent.AgentID, agent.circuitcode, teleportFlags);
@@ -3403,8 +3416,11 @@ namespace OpenSim.Region.Framework.Scenes
3403 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3416 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
3404 agent.AgentID, agent.circuitcode); 3417 agent.AgentID, agent.circuitcode);
3405 3418
3406 CapsModule.NewUserConnection(agent); 3419 if (CapsModule != null)
3407 CapsModule.AddCapsHandler(agent.AgentID); 3420 {
3421 CapsModule.NewUserConnection(agent);
3422 CapsModule.AddCapsHandler(agent.AgentID);
3423 }
3408 } 3424 }
3409 else 3425 else
3410 { 3426 {
@@ -3419,7 +3435,9 @@ namespace OpenSim.Region.Framework.Scenes
3419 agent.AgentID, RegionInfo.RegionName); 3435 agent.AgentID, RegionInfo.RegionName);
3420 3436
3421 sp.AdjustKnownSeeds(); 3437 sp.AdjustKnownSeeds();
3422 CapsModule.NewUserConnection(agent); 3438
3439 if (CapsModule != null)
3440 CapsModule.NewUserConnection(agent);
3423 } 3441 }
3424 } 3442 }
3425 3443
@@ -3506,6 +3524,8 @@ namespace OpenSim.Region.Framework.Scenes
3506 private bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) 3524 private bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
3507 { 3525 {
3508 reason = String.Empty; 3526 reason = String.Empty;
3527 if (Permissions.IsGod(agentID))
3528 return true;
3509 3529
3510 ILandObject land = LandChannel.GetLandObject(posX, posY); 3530 ILandObject land = LandChannel.GetLandObject(posX, posY);
3511 if (land == null) 3531 if (land == null)
@@ -3931,15 +3951,15 @@ namespace OpenSim.Region.Framework.Scenes
3931 public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, 3951 public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position,
3932 Vector3 lookat, uint teleportFlags) 3952 Vector3 lookat, uint teleportFlags)
3933 { 3953 {
3934 GridRegion regionInfo = GridService.GetRegionByName(UUID.Zero, regionName); 3954 List<GridRegion> regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1);
3935 if (regionInfo == null) 3955 if (regions == null || regions.Count == 0)
3936 { 3956 {
3937 // can't find the region: Tell viewer and abort 3957 // can't find the region: Tell viewer and abort
3938 remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); 3958 remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found.");
3939 return; 3959 return;
3940 } 3960 }
3941 3961
3942 RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); 3962 RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags);
3943 } 3963 }
3944 3964
3945 /// <summary> 3965 /// <summary>
@@ -5143,9 +5163,15 @@ namespace OpenSim.Region.Framework.Scenes
5143 // from logging into the region, teleporting into the region 5163 // from logging into the region, teleporting into the region
5144 // or corssing the broder walking, but will NOT prevent 5164 // or corssing the broder walking, but will NOT prevent
5145 // child agent creation, thereby emulating the SL behavior. 5165 // child agent creation, thereby emulating the SL behavior.
5146 public bool QueryAccess(UUID agentID, Vector3 position) 5166 public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
5147 { 5167 {
5148 string reason; 5168 reason = "You are banned from the region";
5169
5170 if (Permissions.IsGod(agentID))
5171 {
5172 reason = String.Empty;
5173 return true;
5174 }
5149 5175
5150 if (!AuthorizeUser(agentID, out reason)) 5176 if (!AuthorizeUser(agentID, out reason))
5151 { 5177 {
@@ -5176,6 +5202,8 @@ namespace OpenSim.Region.Framework.Scenes
5176 if (banned || restricted) 5202 if (banned || restricted)
5177 return false; 5203 return false;
5178 } 5204 }
5205
5206 reason = String.Empty;
5179 return true; 5207 return true;
5180 } 5208 }
5181 } 5209 }