diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 82 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 103 |
2 files changed, 147 insertions, 38 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 89cde05..3e11db3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -591,6 +591,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
591 | get { return m_sceneGraph.Entities; } | 591 | get { return m_sceneGraph.Entities; } |
592 | } | 592 | } |
593 | 593 | ||
594 | // can be closest/random/sequence | ||
595 | private string m_SpawnPointRouting = "closest"; | ||
596 | // used in sequence see: SpawnPoint() | ||
597 | private int m_SpawnPoint; | ||
598 | public string SpawnPointRouting | ||
599 | { | ||
600 | get { return m_SpawnPointRouting; } | ||
601 | } | ||
602 | |||
594 | #endregion Properties | 603 | #endregion Properties |
595 | 604 | ||
596 | #region Constructors | 605 | #region Constructors |
@@ -608,7 +617,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
608 | 617 | ||
609 | Random random = new Random(); | 618 | Random random = new Random(); |
610 | 619 | ||
611 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); | 620 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); |
612 | m_moduleLoader = moduleLoader; | 621 | m_moduleLoader = moduleLoader; |
613 | m_authenticateHandler = authen; | 622 | m_authenticateHandler = authen; |
614 | m_sceneGridService = sceneGridService; | 623 | m_sceneGridService = sceneGridService; |
@@ -728,6 +737,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
728 | m_maxPhys = RegionInfo.PhysPrimMax; | 737 | m_maxPhys = RegionInfo.PhysPrimMax; |
729 | } | 738 | } |
730 | 739 | ||
740 | m_SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | ||
741 | |||
731 | // Here, if clamping is requested in either global or | 742 | // Here, if clamping is requested in either global or |
732 | // local config, it will be used | 743 | // local config, it will be used |
733 | // | 744 | // |
@@ -2684,10 +2695,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2684 | { | 2695 | { |
2685 | SceneObjectGroup grp = sceneObject; | 2696 | SceneObjectGroup grp = sceneObject; |
2686 | 2697 | ||
2687 | m_log.DebugFormat( | 2698 | // m_log.DebugFormat( |
2688 | "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); | 2699 | // "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); |
2689 | m_log.DebugFormat( | 2700 | // m_log.DebugFormat( |
2690 | "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 2701 | // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2691 | 2702 | ||
2692 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2703 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2693 | 2704 | ||
@@ -3554,7 +3565,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3554 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) | 3565 | public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) |
3555 | { | 3566 | { |
3556 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || | 3567 | bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || |
3557 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); | 3568 | (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); |
3558 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); | 3569 | bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); |
3559 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); | 3570 | bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); |
3560 | 3571 | ||
@@ -3570,8 +3581,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3570 | // Don't disable this log message - it's too helpful | 3581 | // Don't disable this log message - it's too helpful |
3571 | m_log.DebugFormat( | 3582 | m_log.DebugFormat( |
3572 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", | 3583 | "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", |
3573 | RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname, | 3584 | RegionInfo.RegionName, |
3574 | agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, ((TPFlags)teleportFlags).ToString(), agent.startpos); | 3585 | (agent.child ? "child" : "root"), |
3586 | agent.firstname, | ||
3587 | agent.lastname, | ||
3588 | agent.AgentID, | ||
3589 | agent.circuitcode, | ||
3590 | agent.IPAddress, | ||
3591 | agent.Viewer, | ||
3592 | ((TPFlags)teleportFlags).ToString(), | ||
3593 | agent.startpos | ||
3594 | ); | ||
3575 | 3595 | ||
3576 | if (LoginsDisabled) | 3596 | if (LoginsDisabled) |
3577 | { | 3597 | { |
@@ -3586,7 +3606,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3586 | // We have a zombie from a crashed session. | 3606 | // We have a zombie from a crashed session. |
3587 | // Or the same user is trying to be root twice here, won't work. | 3607 | // Or the same user is trying to be root twice here, won't work. |
3588 | // Kill it. | 3608 | // Kill it. |
3589 | m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); | 3609 | m_log.DebugFormat( |
3610 | "[SCENE]: Zombie scene presence detected for {0} in {1}", | ||
3611 | agent.AgentID, | ||
3612 | RegionInfo.RegionName | ||
3613 | ); | ||
3590 | sp.ControllingClient.Close(); | 3614 | sp.ControllingClient.Close(); |
3591 | sp = null; | 3615 | sp = null; |
3592 | } | 3616 | } |
@@ -3613,8 +3637,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3613 | { | 3637 | { |
3614 | if (!VerifyUserPresence(agent, out reason)) | 3638 | if (!VerifyUserPresence(agent, out reason)) |
3615 | return false; | 3639 | return false; |
3616 | } | 3640 | } catch (Exception e) |
3617 | catch (Exception e) | ||
3618 | { | 3641 | { |
3619 | m_log.ErrorFormat( | 3642 | m_log.ErrorFormat( |
3620 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3643 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
@@ -3649,8 +3672,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3649 | CapsModule.SetAgentCapsSeeds(agent); | 3672 | CapsModule.SetAgentCapsSeeds(agent); |
3650 | CapsModule.CreateCaps(agent.AgentID); | 3673 | CapsModule.CreateCaps(agent.AgentID); |
3651 | } | 3674 | } |
3652 | } | 3675 | } else |
3653 | else | ||
3654 | { | 3676 | { |
3655 | // Let the SP know how we got here. This has a lot of interesting | 3677 | // Let the SP know how we got here. This has a lot of interesting |
3656 | // uses down the line. | 3678 | // uses down the line. |
@@ -3673,7 +3695,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3673 | agent.teleportFlags = teleportFlags; | 3695 | agent.teleportFlags = teleportFlags; |
3674 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); | 3696 | m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); |
3675 | 3697 | ||
3676 | if (vialogin) | 3698 | if (vialogin) |
3677 | { | 3699 | { |
3678 | // CleanDroppedAttachments(); | 3700 | // CleanDroppedAttachments(); |
3679 | 3701 | ||
@@ -3714,8 +3736,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3714 | agent.startpos.Z = 720; | 3736 | agent.startpos.Z = 720; |
3715 | } | 3737 | } |
3716 | } | 3738 | } |
3717 | } | 3739 | } else |
3718 | else | ||
3719 | { | 3740 | { |
3720 | if (agent.startpos.X > EastBorders[0].BorderLine.Z) | 3741 | if (agent.startpos.X > EastBorders[0].BorderLine.Z) |
3721 | { | 3742 | { |
@@ -3741,10 +3762,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3741 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); | 3762 | SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); |
3742 | // Can have multiple SpawnPoints | 3763 | // Can have multiple SpawnPoints |
3743 | List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); | 3764 | List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); |
3744 | if ( spawnpoints.Count > 1) | 3765 | if (spawnpoints.Count > 1) |
3745 | { | 3766 | { |
3746 | // We have multiple SpawnPoints, Route the agent to a random one | 3767 | // We have multiple SpawnPoints, Route the agent to a random or sequential one |
3747 | agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 3768 | if (SpawnPointRouting == "random") |
3769 | agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation( | ||
3770 | telehub.AbsolutePosition, | ||
3771 | telehub.GroupRotation | ||
3772 | ); | ||
3773 | else | ||
3774 | agent.startpos = spawnpoints[SpawnPoint()].GetLocation( | ||
3775 | telehub.AbsolutePosition, | ||
3776 | telehub.GroupRotation | ||
3777 | ); | ||
3748 | } | 3778 | } |
3749 | else | 3779 | else |
3750 | { | 3780 | { |
@@ -5640,5 +5670,19 @@ Environment.Exit(1); | |||
5640 | } | 5670 | } |
5641 | } | 5671 | } |
5642 | } | 5672 | } |
5673 | |||
5674 | // manage and select spawn points in sequence | ||
5675 | public int SpawnPoint() | ||
5676 | { | ||
5677 | int spawnpoints = RegionInfo.RegionSettings.SpawnPoints().Count; | ||
5678 | |||
5679 | if (spawnpoints == 0) | ||
5680 | return 0; | ||
5681 | |||
5682 | m_SpawnPoint++; | ||
5683 | if (m_SpawnPoint > spawnpoints) | ||
5684 | m_SpawnPoint = 1; | ||
5685 | return m_SpawnPoint - 1; | ||
5686 | } | ||
5643 | } | 5687 | } |
5644 | } | 5688 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1a8caae..34362bf 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -4134,28 +4134,93 @@ namespace OpenSim.Region.Framework.Scenes | |||
4134 | if (spawnPoints.Length == 0) | 4134 | if (spawnPoints.Length == 0) |
4135 | return; | 4135 | return; |
4136 | 4136 | ||
4137 | float distance = 9999; | 4137 | int index; |
4138 | int closest = -1; | 4138 | bool selected = false; |
4139 | 4139 | ||
4140 | for (int i = 0 ; i < spawnPoints.Length ; i++) | 4140 | switch (m_scene.SpawnPointRouting) |
4141 | { | 4141 | { |
4142 | Vector3 spawnPosition = spawnPoints[i].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 4142 | case "closest": |
4143 | Vector3 offset = spawnPosition - pos; | ||
4144 | float d = Vector3.Mag(offset); | ||
4145 | if (d >= distance) | ||
4146 | continue; | ||
4147 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4148 | if (land == null) | ||
4149 | continue; | ||
4150 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
4151 | continue; | ||
4152 | distance = d; | ||
4153 | closest = i; | ||
4154 | } | ||
4155 | if (closest == -1) | ||
4156 | return; | ||
4157 | 4143 | ||
4158 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | 4144 | float distance = 9999; |
4145 | int closest = -1; | ||
4146 | |||
4147 | for (int i = 0; i < spawnPoints.Length; i++) | ||
4148 | { | ||
4149 | Vector3 spawnPosition = spawnPoints[i].GetLocation( | ||
4150 | telehub.AbsolutePosition, | ||
4151 | telehub.GroupRotation | ||
4152 | ); | ||
4153 | Vector3 offset = spawnPosition - pos; | ||
4154 | float d = Vector3.Mag(offset); | ||
4155 | if (d >= distance) | ||
4156 | continue; | ||
4157 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4158 | if (land == null) | ||
4159 | continue; | ||
4160 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
4161 | continue; | ||
4162 | distance = d; | ||
4163 | closest = i; | ||
4164 | } | ||
4165 | if (closest == -1) | ||
4166 | return; | ||
4167 | |||
4168 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4169 | return; | ||
4170 | |||
4171 | case "random": | ||
4172 | |||
4173 | do | ||
4174 | { | ||
4175 | index = Util.RandomClass.Next(spawnPoints.Length - 1); | ||
4176 | |||
4177 | Vector3 spawnPosition = spawnPoints[index].GetLocation( | ||
4178 | telehub.AbsolutePosition, | ||
4179 | telehub.GroupRotation | ||
4180 | ); | ||
4181 | // SpawnPoint sp = spawnPoints[index]; | ||
4182 | |||
4183 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4184 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | ||
4185 | selected = false; | ||
4186 | else | ||
4187 | selected = true; | ||
4188 | |||
4189 | } while ( selected == false); | ||
4190 | |||
4191 | pos = spawnPoints[index].GetLocation( | ||
4192 | telehub.AbsolutePosition, | ||
4193 | telehub.GroupRotation | ||
4194 | ); | ||
4195 | return; | ||
4196 | |||
4197 | case "sequence": | ||
4198 | |||
4199 | do | ||
4200 | { | ||
4201 | index = m_scene.SpawnPoint(); | ||
4202 | |||
4203 | Vector3 spawnPosition = spawnPoints[index].GetLocation( | ||
4204 | telehub.AbsolutePosition, | ||
4205 | telehub.GroupRotation | ||
4206 | ); | ||
4207 | // SpawnPoint sp = spawnPoints[index]; | ||
4208 | |||
4209 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4210 | if (land == null || land.IsEitherBannedOrRestricted(UUID)) | ||
4211 | selected = false; | ||
4212 | else | ||
4213 | selected = true; | ||
4214 | |||
4215 | } while (selected == false); | ||
4216 | |||
4217 | pos = spawnPoints[index].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4218 | ; | ||
4219 | return; | ||
4220 | |||
4221 | default: | ||
4222 | return; | ||
4223 | } | ||
4159 | } | 4224 | } |
4160 | } | 4225 | } |
4161 | } | 4226 | } |