aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs81
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs103
2 files changed, 146 insertions, 38 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3d2213a..2a2830f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -569,6 +569,15 @@ namespace OpenSim.Region.Framework.Scenes
569 get { return m_sceneGraph.Entities; } 569 get { return m_sceneGraph.Entities; }
570 } 570 }
571 571
572 // can be closest/random/sequence
573 private string m_SpawnPointRouting = "closest";
574 // used in sequence see: SpawnPoint()
575 private int m_SpawnPoint;
576 public string SpawnPointRouting
577 {
578 get { return m_SpawnPointRouting; }
579 }
580
572 #endregion Properties 581 #endregion Properties
573 582
574 #region Constructors 583 #region Constructors
@@ -586,7 +595,7 @@ namespace OpenSim.Region.Framework.Scenes
586 595
587 Random random = new Random(); 596 Random random = new Random();
588 597
589 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); 598 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4);
590 m_moduleLoader = moduleLoader; 599 m_moduleLoader = moduleLoader;
591 m_authenticateHandler = authen; 600 m_authenticateHandler = authen;
592 m_sceneGridService = sceneGridService; 601 m_sceneGridService = sceneGridService;
@@ -678,7 +687,7 @@ namespace OpenSim.Region.Framework.Scenes
678 { 687 {
679 IConfig startupConfig = m_config.Configs["Startup"]; 688 IConfig startupConfig = m_config.Configs["Startup"];
680 689
681 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); 690 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance);
682 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); 691 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
683 if (!m_useBackup) 692 if (!m_useBackup)
684 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); 693 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
@@ -711,7 +720,7 @@ namespace OpenSim.Region.Framework.Scenes
711 m_clampPrimSize = true; 720 m_clampPrimSize = true;
712 } 721 }
713 722
714 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); 723 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete);
715 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); 724 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
716 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); 725 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
717 m_dontPersistBefore = 726 m_dontPersistBefore =
@@ -723,6 +732,8 @@ namespace OpenSim.Region.Framework.Scenes
723 732
724 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); 733 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
725 734
735 m_SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
736
726 IConfig packetConfig = m_config.Configs["PacketPool"]; 737 IConfig packetConfig = m_config.Configs["PacketPool"];
727 if (packetConfig != null) 738 if (packetConfig != null)
728 { 739 {
@@ -3389,7 +3400,7 @@ namespace OpenSim.Region.Framework.Scenes
3389 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) 3400 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup)
3390 { 3401 {
3391 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || 3402 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 ||
3392 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); 3403 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0);
3393 bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); 3404 bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0);
3394 bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); 3405 bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0);
3395 3406
@@ -3405,8 +3416,17 @@ namespace OpenSim.Region.Framework.Scenes
3405 // Don't disable this log message - it's too helpful 3416 // Don't disable this log message - it's too helpful
3406 m_log.DebugFormat( 3417 m_log.DebugFormat(
3407 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", 3418 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})",
3408 RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname, 3419 RegionInfo.RegionName,
3409 agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, ((TPFlags)teleportFlags).ToString(), agent.startpos); 3420 (agent.child ? "child" : "root"),
3421 agent.firstname,
3422 agent.lastname,
3423 agent.AgentID,
3424 agent.circuitcode,
3425 agent.IPAddress,
3426 agent.Viewer,
3427 ((TPFlags)teleportFlags).ToString(),
3428 agent.startpos
3429 );
3410 3430
3411 if (LoginsDisabled) 3431 if (LoginsDisabled)
3412 { 3432 {
@@ -3421,7 +3441,11 @@ namespace OpenSim.Region.Framework.Scenes
3421 // We have a zombie from a crashed session. 3441 // We have a zombie from a crashed session.
3422 // Or the same user is trying to be root twice here, won't work. 3442 // Or the same user is trying to be root twice here, won't work.
3423 // Kill it. 3443 // Kill it.
3424 m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); 3444 m_log.DebugFormat(
3445 "[SCENE]: Zombie scene presence detected for {0} in {1}",
3446 agent.AgentID,
3447 RegionInfo.RegionName
3448 );
3425 sp.ControllingClient.Close(); 3449 sp.ControllingClient.Close();
3426 sp = null; 3450 sp = null;
3427 } 3451 }
@@ -3445,8 +3469,7 @@ namespace OpenSim.Region.Framework.Scenes
3445 { 3469 {
3446 if (!VerifyUserPresence(agent, out reason)) 3470 if (!VerifyUserPresence(agent, out reason))
3447 return false; 3471 return false;
3448 } 3472 } catch (Exception e)
3449 catch (Exception e)
3450 { 3473 {
3451 m_log.ErrorFormat( 3474 m_log.ErrorFormat(
3452 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); 3475 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace);
@@ -3458,8 +3481,7 @@ namespace OpenSim.Region.Framework.Scenes
3458 { 3481 {
3459 if (!AuthorizeUser(agent, out reason)) 3482 if (!AuthorizeUser(agent, out reason))
3460 return false; 3483 return false;
3461 } 3484 } catch (Exception e)
3462 catch (Exception e)
3463 { 3485 {
3464 m_log.ErrorFormat( 3486 m_log.ErrorFormat(
3465 "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); 3487 "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace);
@@ -3476,8 +3498,7 @@ namespace OpenSim.Region.Framework.Scenes
3476 CapsModule.SetAgentCapsSeeds(agent); 3498 CapsModule.SetAgentCapsSeeds(agent);
3477 CapsModule.CreateCaps(agent.AgentID); 3499 CapsModule.CreateCaps(agent.AgentID);
3478 } 3500 }
3479 } 3501 } else
3480 else
3481 { 3502 {
3482 // Let the SP know how we got here. This has a lot of interesting 3503 // Let the SP know how we got here. This has a lot of interesting
3483 // uses down the line. 3504 // uses down the line.
@@ -3500,7 +3521,7 @@ namespace OpenSim.Region.Framework.Scenes
3500 agent.teleportFlags = teleportFlags; 3521 agent.teleportFlags = teleportFlags;
3501 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3522 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
3502 3523
3503 if (vialogin) 3524 if (vialogin)
3504 { 3525 {
3505// CleanDroppedAttachments(); 3526// CleanDroppedAttachments();
3506 3527
@@ -3541,8 +3562,7 @@ namespace OpenSim.Region.Framework.Scenes
3541 agent.startpos.Z = 720; 3562 agent.startpos.Z = 720;
3542 } 3563 }
3543 } 3564 }
3544 } 3565 } else
3545 else
3546 { 3566 {
3547 if (agent.startpos.X > EastBorders[0].BorderLine.Z) 3567 if (agent.startpos.X > EastBorders[0].BorderLine.Z)
3548 { 3568 {
@@ -3568,10 +3588,19 @@ namespace OpenSim.Region.Framework.Scenes
3568 SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); 3588 SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject);
3569 // Can have multiple SpawnPoints 3589 // Can have multiple SpawnPoints
3570 List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); 3590 List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints();
3571 if ( spawnpoints.Count > 1) 3591 if (spawnpoints.Count > 1)
3572 { 3592 {
3573 // We have multiple SpawnPoints, Route the agent to a random one 3593 // We have multiple SpawnPoints, Route the agent to a random or sequential one
3574 agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); 3594 if (SpawnPointRouting == "random")
3595 agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation(
3596 telehub.AbsolutePosition,
3597 telehub.GroupRotation
3598 );
3599 else
3600 agent.startpos = spawnpoints[SpawnPoint()].GetLocation(
3601 telehub.AbsolutePosition,
3602 telehub.GroupRotation
3603 );
3575 } 3604 }
3576 else 3605 else
3577 { 3606 {
@@ -5257,5 +5286,19 @@ namespace OpenSim.Region.Framework.Scenes
5257 } 5286 }
5258 } 5287 }
5259 } 5288 }
5289
5290 // manage and select spawn points in sequence
5291 public int SpawnPoint()
5292 {
5293 int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count;
5294
5295 if (spawnpoints == 0)
5296 return 0;
5297
5298 m_SpawnPoint++;
5299 if (m_SpawnPoint > spawnpoints)
5300 m_SpawnPoint = 1;
5301 return m_SpawnPoint - 1;
5302 }
5260 } 5303 }
5261} 5304}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b737f91..bdcef71 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3934,28 +3934,93 @@ namespace OpenSim.Region.Framework.Scenes
3934 if (spawnPoints.Length == 0) 3934 if (spawnPoints.Length == 0)
3935 return; 3935 return;
3936 3936
3937 float distance = 9999; 3937 int index;
3938 int closest = -1; 3938 bool selected = false;
3939 3939
3940 for (int i = 0 ; i < spawnPoints.Length ; i++) 3940 switch (m_scene.SpawnPointRouting)
3941 { 3941 {
3942 Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); 3942 case "closest":
3943 Vector3 offset = spawnPosition - pos;
3944 float d = Vector3.Mag(offset);
3945 if (d >= distance)
3946 continue;
3947 ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
3948 if (land == null)
3949 continue;
3950 if (land.IsEitherBannedOrRestricted(UUID))
3951 continue;
3952 distance = d;
3953 closest = i;
3954 }
3955 if (closest == -1)
3956 return;
3957 3943
3958 pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); 3944 float distance = 9999;
3945 int closest = -1;
3946
3947 for (int i = 0; i < spawnPoints.Length; i++)
3948 {
3949 Vector3 spawnPosition = spawnPoints[i].GetLocation(
3950 telehub.AbsolutePosition,
3951 telehub.GroupRotation
3952 );
3953 Vector3 offset = spawnPosition - pos;
3954 float d = Vector3.Mag(offset);
3955 if (d >= distance)
3956 continue;
3957 ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
3958 if (land == null)
3959 continue;
3960 if (land.IsEitherBannedOrRestricted(UUID))
3961 continue;
3962 distance = d;
3963 closest = i;
3964 }
3965 if (closest == -1)
3966 return;
3967
3968 pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
3969 return;
3970
3971 case "random":
3972
3973 do
3974 {
3975 index = Util.RandomClass.Next(spawnPoints.Length - 1);
3976
3977 Vector3 spawnPosition = spawnPoints[index].GetLocation(
3978 telehub.AbsolutePosition,
3979 telehub.GroupRotation
3980 );
3981 // SpawnPoint sp = spawnPoints[index];
3982
3983 ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
3984 if (land == null || land.IsEitherBannedOrRestricted(UUID))
3985 selected = false;
3986 else
3987 selected = true;
3988
3989 } while ( selected == false);
3990
3991 pos = spawnPoints[index].GetLocation(
3992 telehub.AbsolutePosition,
3993 telehub.GroupRotation
3994 );
3995 return;
3996
3997 case "sequence":
3998
3999 do
4000 {
4001 index = m_scene.SpawnPoint();
4002
4003 Vector3 spawnPosition = spawnPoints[index].GetLocation(
4004 telehub.AbsolutePosition,
4005 telehub.GroupRotation
4006 );
4007 // SpawnPoint sp = spawnPoints[index];
4008
4009 ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
4010 if (land == null || land.IsEitherBannedOrRestricted(UUID))
4011 selected = false;
4012 else
4013 selected = true;
4014
4015 } while (selected == false);
4016
4017 pos = spawnPoints[index].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
4018 ;
4019 return;
4020
4021 default:
4022 return;
4023 }
3959 } 4024 }
3960 } 4025 }
3961 } 4026 }