diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 558fd9c..0c66e49 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3948,35 +3948,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3948 | 3948 | ||
3949 | switch (m_scene.SpawnPointRouting) | 3949 | switch (m_scene.SpawnPointRouting) |
3950 | { | 3950 | { |
3951 | case "closest": | ||
3952 | |||
3953 | float distance = 9999; | ||
3954 | int closest = -1; | ||
3955 | |||
3956 | for (int i = 0; i < spawnPoints.Length; i++) | ||
3957 | { | ||
3958 | Vector3 spawnPosition = spawnPoints[i].GetLocation( | ||
3959 | telehub.AbsolutePosition, | ||
3960 | telehub.GroupRotation | ||
3961 | ); | ||
3962 | Vector3 offset = spawnPosition - pos; | ||
3963 | float d = Vector3.Mag(offset); | ||
3964 | if (d >= distance) | ||
3965 | continue; | ||
3966 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
3967 | if (land == null) | ||
3968 | continue; | ||
3969 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
3970 | continue; | ||
3971 | distance = d; | ||
3972 | closest = i; | ||
3973 | } | ||
3974 | if (closest == -1) | ||
3975 | return; | ||
3976 | |||
3977 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
3978 | return; | ||
3979 | |||
3980 | case "random": | 3951 | case "random": |
3981 | 3952 | ||
3982 | do | 3953 | do |
@@ -4028,7 +3999,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
4028 | return; | 3999 | return; |
4029 | 4000 | ||
4030 | default: | 4001 | default: |
4002 | case "closest": | ||
4003 | |||
4004 | float distance = 9999; | ||
4005 | int closest = -1; | ||
4006 | |||
4007 | for (int i = 0; i < spawnPoints.Length; i++) | ||
4008 | { | ||
4009 | Vector3 spawnPosition = spawnPoints[i].GetLocation( | ||
4010 | telehub.AbsolutePosition, | ||
4011 | telehub.GroupRotation | ||
4012 | ); | ||
4013 | Vector3 offset = spawnPosition - pos; | ||
4014 | float d = Vector3.Mag(offset); | ||
4015 | if (d >= distance) | ||
4016 | continue; | ||
4017 | ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); | ||
4018 | if (land == null) | ||
4019 | continue; | ||
4020 | if (land.IsEitherBannedOrRestricted(UUID)) | ||
4021 | continue; | ||
4022 | distance = d; | ||
4023 | closest = i; | ||
4024 | } | ||
4025 | if (closest == -1) | ||
4026 | return; | ||
4027 | |||
4028 | pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); | ||
4031 | return; | 4029 | return; |
4030 | |||
4032 | } | 4031 | } |
4033 | } | 4032 | } |
4034 | } | 4033 | } |